Ch 5.9 Binutils Pass 2 Error: Cannot run C compiled programs
Hello everyone,
I am currently trying to get through the Binutils Pass 2 of LFS book version 6.6. I am getting an error stating: "configure: error: cannot run C compiled programs" I have tried searching Google for answers, and while I have found similar problems, nothing has seemed to be directly correlating to my problem. I am attempting to do this on Virtual Box v. 3.1.6, running LFS Live v.6.2-5. The exact output when trying to run: CC="$LFS_TGT-gcc -B/tools/lib/" \ AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \ ../binutils-2.19.1/configure --prefix=/tools \ --disable-nls --with-lib-path=/tools/lib in the binutils-build directory, I get: checking whether the C compiler works.. configure: error: in `/mnt/lfs/sources/binutils-build': configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host`. I have not posted any information from config.log, but if I am told to do so, I will. Thanks in advance for any help or suggestions posted in reply, Strungmind |
Hi,
it seems like your cross-compiler did not compile properly or the toolchain adjustment might have gone wrong. The information about the error you provided is a bit sparse. Can you post the last ~20 lines before the error occurred? Also post the output of Code:
echo $LFS_TGT |
Quote:
Code:
CC="$LFS_TGT-gcc -B/$LFS/tools/lib/" \ Code:
echo $LFS_TGT |
Sorry for putting this in another reply, had to attend to a few issues. The first lines of the config.log look like this...
Code:
hostname = lfslivecd Code:
configure:4040: $? = 0 |
Was the compilation in 5.8 ok? What was the requested program interpreter?
Code:
echo 'main(){}' > dummy.c |
I have this same problem . the dummy.c file compiled without a problem but it appears for some reason it will not compile this file.
|
This mostly occurs when glibc didn't build properly. The file crt1.o that you are missing is installed by glibc. I suggest since you are not too far from having started off, try rebuilding. That ways if the error repeats, you'll be able to better isolate it.
|
Hmm that was strange. I had this same error after having mistakenly decided that I could correctly hand-type the SPECS="..." bit in the glibc section (5.8). I also noted that, after running
Code:
readelf -l a.out | grep ': /tools' Code:
[Requesting program interpreter: /tools/lib/ld-linux.so.2] Code:
[Requesting program interpreter: /tools/usr/lds/lib/ld-linux.so.2] After simply re-running the SPECS='...' command (pasted this time), I was able to enter CC="..." and it ran fine. I'm now continuing with 5.9 (CC="...") without observable error, though I'll repost if this f***s something up further down the track. |
@strungmind :I have this same problem . the dummy.c file compiled without a problem but it appears for some reason it will not compile this file.Did you solve the problem now?
@duskxiv :I re-running the Quote:
Quote:
|
Ch 5.9 Binutils Pass 2 Error: configure is WRONG.. DO THIS!
Ch 5.9 Binutils Pass 2 Error: Cannot run C compiled programs ## CONFIGURE SCRIPT IS WRONG
after beating my head against the wall for 3 days I finally figured out HOW to get the ./configure script to make a Makefile that will use a newly compiled gcc.. ie: the new cross-compiled gcc built from directions at the Linux From Scratch website.. I got hung up on Binutils (2nd pass).. at this point you MUST get the compiler to use the new gcc.. your new gcc should be here: /tools/bin/i686-lfs-linux-gnu=gcc trying to do the configure as Linux From Scratch (on the Binutils 2nd pass) says WON'T WORK.. trust me! I have tried everything.. ... sorry, but I am still have problems.. will post as soon as I work the issues out.. sorry, Bob |
@linux_tales: Hi and welcome to LQ!
Can you start a new thread when you have an LFS issue. This one is rather old and I doubt you are trying to build LFS 6.6. Quote:
- Which LFS version are you trying to build, - What are you using as host for building LFS, - If you do not use the LFS livsCD, did you make your host compliant, - What are the error messages you are seeing (10-15 lines before the Cannot run C compiled programs message). I seriously doubt that the book doesn't work. Many have successfully build an LFS system, including me on different hardware platforms. Don't get me wrong, your hardware might be the exception to the rule, but in almost all the cases the builder did something wrong in the step they are working on or one of the previous steps. Hope this helps. |
I apologize about the previous posting.. I had planned to come back and finish the post.. and be more clear.. what I was trying to say was this:
On the 2nd pass of Binutils (where the fun really starts) the ./configure does not work.. can't find the C compiler, gcc? right? CC="$LFS_TGT-gcc -B/tools/lib/" \ AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \ ../binutils-2.21/configure --prefix=/tools \ --disable-nls --with-lib-path=/tools/lib I believe the problem is the configure script above which uses this statement: CC="$LFS_TGT-gcc -B/tools/lib/" is not correct.. {{ by the way the binary is in the bin, not the lib directory }} I got this to work on the first pass but not the second.. it really is a PATH problem I believe.. the ./configure script finds the gcc binary but upon testing calls an error.. it keeps trying to use the default "host" binary.. Cheers, Bob |
by the way, if I gave the impression that there is something wrong with the LFS website, that is incorrect and I apologize.. I believe the guy that created the LFS concept and the website is brilliant.. I am sure most of the problems we peons have in creating Linux distros are because of our own making, NOT from LFS.
Cheers, Bob |
I'm having the same kind of issue here. I'm using the book 6.8 with corresponding packages/patches.
The adjusting the toolchain chapter went all fine. No errors and it generated a dummy.c file (which I couldn't run by the way) and an a.out file. Second pass of binutils went wrong at configuring. Contents of config.log: Code:
This file contains any messages produced by compilers while Contents of the specs file which can be found under: /mnt/lfs/tools/lib/gcc/i686-lfs-linux-gnu/4.5.2 Code:
*asm: |
Oh by the way, I'm using a very old Via epia M100000 board with a Via Nehemiah C3 CPU. One SBU is about 14 mins :).
If there's anything of info that 's useful give me a shout. |
All times are GMT -5. The time now is 08:00 PM. |