You are not logged in.
Pages: 1
So right now I'm in the middle of a LFS build (current stable). I'm at Chapter 5 and currently doing the first build of glibc. I'm having problems with the command:
ln -vs libgcc.a 'gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/''
I've tried the above, escaping the sed command with '\' and doing a new line, a whole bunch of things. It's all typed correctly because the 'gcc -print... | sed 's/libgcc/&_eh/'' line works fine by itself, but not with the whole command. I would just use the absolute path that the second half (I think) is looking for, but I'm on a fresh Arch install, no X or anything and the path it prints me is "/mnt/lfs/tools/bin/../lib/gcc..." and that's not going to work.
Any help would be greatly appreciated.
Offline
could you post the exact output?
When everything's coming your way, you're in the wrong lane I say.
FAQ / Beginners Guide / The Arch Way
Offline
I accidently hit the left-arrow after I finished typing my reply so eLinks dominated me, so sorry for the briefness of this one.
Here's the output:
ln: target 'gcc -print-libgcc-file-name | \\\nsed 's/libgcc/' is not a directory: No such file or directory
[1]7370 #Changes randomly, I don't know why
bash: _eh/: No such file or directory
[1]+ Exit 1 ln -vs libgcc.a 'gcc -print-libgcc-file-name | \
sed 's/libgcc/
Seems like it's escaping in weird places, ideas? I've tried different combinations of single and double quotes but nothing seems to work out (except typing the commands separately, and I can't see the full output of the gcc/sed command).
Thanks again.
Offline
Hey it is supposed to be back quotes (`), the one above tab, wrapping `gcc .. | sed ...` .
ln -vs libgcc.a `gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/'`
Offline
Hey it is supposed to be back quotes (`), the one above tab, wrapping `gcc .. | sed ...` .
ln -vs libgcc.a `gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/'`
Thank you so much! I don't know why I didn't notice that, they seem so obvious now...
Also, I know next to nothing about sed, could you explain what the 'gcc...sed' line is actually doing? The LFS page says it's just creating the symlink, but I'd like to know how it found the file to link to, not just why I'm linking to it.
Offline
Sure, I don't know much about sed but I think i know what this does.
gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/'
This takes the output of gcc .. and passes it as the input to sed ..
sed 's/libgcc/&_eh/'
Then this replaces the first occurance of 'libgcc' with '&_eh' and outputs the result.
Last edited by bobdob (2009-03-19 11:59:50)
Offline
So, the "gcc -printt-libgcc-file-name" command will print something like "/usr/lib/gcc/i686-pc-linux-gnu/4.3.3/libgcc.a" and the sed changes that to "/usr/lib/gcc/i686-pc-linux-gnu/4.3.3/libgcc_eh.a". I can not remember why you do that off the top of my head (been a couple of years since I did an LFS build...)
Edit: it is something to do with the way gcc is built to minimise the influence of the host system. That does not create the libgcc_ed.a file which it appears glibc uses in a compile. This appears to be something newer to the LFS build that is not explained very well...
Offline
Thanks bobdob and Allan. I think I'm going to start over (having some problems with finishing up the second gcc build, can't find a directory and Google yields 8 results...) but this will definitely help me out when I start over.
Offline
Just so you know, sed is sort of like a filter. If you do
echo "hello" | sed s/hello/bye/
The output will be bye instead of hello. It subsistuted hello with bye. It's a very handy dandy tool. If you can master it, you can do some very powerful and meaningful things with your outputs and files. The amp (&) is what you filtered (libgcc in your case) and then you added the _eh to the end of it (replacing all libgcc with libgcc_eh instead). I really recommend looking into sed, I find it very useful. Even if you don't have anything useful to do with it, you can definitely make yourself look cool using it instead which is really why we all use Linux (just kidding - sort of). B)
echo "hello" | sed 's/hello/Then I said "&" to her./'
Last edited by Aprz (2009-03-20 06:14:15)
Offline
But why use Backticks instead of "$()"?
Then it would be much clearer.
Offline
But why use Backticks instead of "$()"?
Then it would be much clearer.
Preference. *shrugs*
Offline
@Aprz - Yeah, after the few sed commands they've done I've decided to read O'Reilly's book "sed & awk". awk seems a little more useful than sed (for me anyways) but not knowing much about either I can't really say much about it yet.
@lilith - They do use "$()" in the later pages, and yeah, it's much clearer .
Offline
Pages: 1