LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 12-09-2014, 11:12 AM   #1
someguy23
LQ Newbie
 
Registered: Dec 2014
Posts: 2

Rep: Reputation: Disabled
Understanding of Path and Delimiters


Hello,

I'm doing some toolchain/library experimentation, and have been working on an LFS build up through section "5.10. GCC-4.9.1 - Pass 2". What this appears to leave me with, is a functional gcc in /tools/bin, that uses glibc that was compiled (as shown by ldd). This is exactly what I'm after.

The issue comes here- If I prepend /tools/bin to my PATH (as stated earlier in the LFS build doc), ldd shows /tools/bin/gcc using the libraries in the proper /tools/ tree. However, if I don't prepend /tools/bin to my PATH, running ldd on that same executable shows it using system libraries. If relevant, I'm working on Centos 6.6 x64.

Can someone explain to me why this is so? Why does only changing my PATH change library locations as well? Is it possible to force gcc to use a specific c library location regardless of the PATH being set?



Also, looking at the instructions for building gcc (such as 5.5. GCC-4.9.1 - Pass 1), I wanted to make sure I'm understanding what the sed statements are doing:

Code:
 sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
      -e 's@/usr@/tools@g' $file.orig > $file
From what I know of sed (not much) and looking at file diffs, if I understand this correctly, the statements:
- Use the @ symbol as the delimiter
- The first one searches for /lib64, /lib32, and /lib/ld and replaces any instances with /tools (this one is my main confusion)
- The second statement looks for /usr and replaces it with /tools

Are these assumptions correct?
 
Old 12-10-2014, 05:06 AM   #2
EmaRsk
Member
 
Registered: Mar 2006
Distribution: Mint, WSL Ubuntu
Posts: 134

Rep: Reputation: 32
I can't help you with your main topic, but about sed:

Quote:
Originally Posted by someguy23 View Post
- Use the @ symbol as the delimiter
Yes.

Quote:
Originally Posted by someguy23 View Post
- The first one searches for /lib64, /lib32, and /lib/ld and replaces any instances with /tools (this one is my main confusion)
No, it searches for /lib/ld, /lib64/ld and /lib32/ld (well, tecnically, also /lib6432/ld would match) and substitutes with /tool/lib/ld, /tool/lib64/ld and /tool/lib32/ld. The "&" in the substitute part is replaced with the matched part.

Quote:
Originally Posted by someguy23 View Post
- The second statement looks for /usr and replaces it with /tools
Yes.
 
Old 12-11-2014, 04:29 PM   #3
someguy23
LQ Newbie
 
Registered: Dec 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
Excellent, thanks for the reply. That makes the sed entries clearer.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] awk command for different delimiters ip_address Programming 3 09-10-2012 03:48 AM
awk delimiters saini_mw Programming 4 06-08-2011 08:32 AM
[SOLVED] awk delimiters Philip Kiser Programming 3 08-18-2010 11:14 AM
Simple (?) awk, two delimiters int0x80 Programming 3 02-25-2009 08:53 AM
Using Delimiters to get the end of the string champak Programming 3 12-16-2007 06:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 07:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration