LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Understanding of Path and Delimiters (https://www.linuxquestions.org/questions/linux-from-scratch-13/understanding-of-path-and-delimiters-4175527801/)

someguy23 12-09-2014 11:12 AM

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?

EmaRsk 12-10-2014 05:06 AM

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

Quote:

Originally Posted by someguy23 (Post 5282018)
- Use the @ symbol as the delimiter

Yes.

Quote:

Originally Posted by someguy23 (Post 5282018)
- 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 (Post 5282018)
- The second statement looks for /usr and replaces it with /tools

Yes.

someguy23 12-11-2014 04:29 PM

Excellent, thanks for the reply. That makes the sed entries clearer.


All times are GMT -5. The time now is 04:08 AM.