LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 11-08-2010, 04:20 PM   #1
supern0va
LQ Newbie
 
Registered: May 2010
Posts: 12

Rep: Reputation: 0
./configure fails during Binutils Pass 2


(Latest LFS/6.7)
Host: LFS

Original Command:

Code:
CC="$TARGETOS-gcc -B$TARGETDIR/lib/" \
  AR=$TARGETOS-ar RANLIB=$TARGETOS-ranlib \
  ../binutils-$BINUTILS_VERSION/configure --prefix=$TARGETDIR \
        --disable-nls --with-lib-path=$TARGETDIR/lib
Error msg:

Quote:
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for gcc... x86_64-installOS-linux-gnu-gcc -B/root/installOS/os/lib/
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: in `/root/installOS/source/binutils-2.20.1':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
I imagined that this was caused by some mistake in my tool chain adjustment:

Code:
SPECS=`dirname $($TARGETOS-gcc -print-libgcc-file-name)`/specs
  $TARGETOS-gcc -dumpspecs | sed \
    -e 's@/lib\(64\)\?/ld@$TARGETDIR&@g' \
    -e "/^\*cpp:$/{n;s,$, -isystem $TARGETDIR/include,}" > $SPECS
  echo "New specs file is: $SPECS"
  unset SPECS
However gcc DOES seem to work:

Code:
echo 'main(){}' > dummy.c
$TARGETOS-gcc -B$TARGETDIR/lib dummy.c
readelf -l a.out | grep ': $TARGETDIR'
Quote:
[Requesting program interpreter: $TARGETDIR/lib64/ld-linux-x86-64.so.2]
Any ideas?

Last edited by supern0va; 11-08-2010 at 05:27 PM.
 
Old 11-08-2010, 07:35 PM   #2
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
follow book, book good.

This is a very good example why it is not recommended to deviate from the book. Especially if you have no idea what you are doing.
This
Code:
-e 's@/lib\(64\)\?/ld@$TARGETDIR&@g' \
is not what you were supposed to issue in chapter 5.8. As you can see, the statement is enclosed in single quotes, i.e. it got not expanded by bash as you thought it would. Also
Code:
[Requesting program interpreter: $TARGETDIR/lib64/ld-linux-x86-64.so.2]
This should had at least been whatever is stored in $TARGETDIR. I don't know what is stored in $TARGETDIR but I assume it will not work as you expect it to - even if you correct your previous statement and $TARGETDIR would get expanded in the sed statement. It would be probably best if you start over again and follow the book by the letter.
Code:
checking for gcc... x86_64-installOS-linux-gnu-gcc -B/root/installOS/os/lib/
Are you installing your toolchain on your host system? Again, do NOT deviate from the book.
 
Old 11-08-2010, 11:07 PM   #3
supern0va
LQ Newbie
 
Registered: May 2010
Posts: 12

Original Poster
Rep: Reputation: 0
OK some further explanation:

$TARGETDIR simply points to some directory on my host system. While I know that this isn't necessarily the best way to build my system it should be possible after all or am I mistaken there? By now I don't even want to build the whole system but only the temporary system for my future projects.

What I want to do is to learn more about Linux and also about scripting. I am prepared to run into problems, but if I do I want to know what I did wrong and how I can then correct my code. After all I already built a complete and working LFS sticking completely to the book, which is why I now dared making changes.

Now as you already pointed out this

Code:
-e 's@/lib\(64\)\?/ld@$TARGETDIR&@g' \
does not expand. Would you be so kind to explain the syntax which is necessary to actually make it expand? I would at least give it a try .

Thanks for your time,

Mario
 
Old 11-09-2010, 03:27 AM   #4
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Well, if you insist:
Do not it expand but type in the whatever content $TARGETDIR holds. E.g., if $TARGETDIR point to /root/installOS then
Code:
-e 's@/lib\(64\)\?/ld@/root/installOS/&@g' \
Do the same for the statement in the next sed line.
 
Old 11-09-2010, 06:48 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

About the (not) expanding part: If you use single quotes, nothing is expanded by the shell, if you use double quotes it is expanded.

So you either use crts idea (replace all $TARGETDIR's with /root/installOS) or you use double quotes and parenthesis (the latter to protect the content of the variable):

-e "s@/lib\(64\)\?/ld@${TARGETDIR}/&@g" \

Hope this clears things up a bit.
 
Old 11-09-2010, 10:46 AM   #6
supern0va
LQ Newbie
 
Registered: May 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Thank you it worked (even with expanding syntax). Should spend some hours with the grep and sed manuals now .
 
  


Reply



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
5.3. Binutils-2.17 - Pass 1 willz06jw Linux From Scratch 5 09-24-2008 02:54 AM
questions on GCC-3.4.3 - Pass 2 and Binutils-2.15.94.0.2.2 - Pass 2 satimis Linux From Scratch 7 12-26-2005 09:23 PM
make configure-host for binutils-2.16.1 fails under 7.0-cross-lfs-20051019-x86_64 Basel Linux From Scratch 2 10-24-2005 11:07 PM
Binutils-pass 1 v. 6.1 microsoft/linux Linux From Scratch 10 09-04-2005 07:27 AM
make: *** [configure-libiberty] Error 1 in 5.4. Binutils-2.15.91.0.2 - Pass 1 Flash_G Linux From Scratch 3 06-30-2005 08:51 PM

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

All times are GMT -5. The time now is 07:53 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