LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (http://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   binutils-2.22 configure error "cannot run C compiled programs" (http://www.linuxquestions.org/questions/linux-from-scratch-13/binutils-2-22-configure-error-cannot-run-c-compiled-programs-4175412219/)

iceman911 06-19-2012 06:08 AM

binutils-2.22 configure error "cannot run C compiled programs"
 
Hi there,
Had trouble with configure script of binutils-2.22 (pass-2); section-5.9 of LFS book (Version 7.1)

Command I ran:
Code:

CC="$LFS_TGT-gcc -B/tools/lib/" \
> AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \
> ../binutils-2.22/configure --prefix=/tools \
> --disable-nls --with-lib-path=/tools/lib


Terminal output:

Code:

checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-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... i686-lfs-linux-gnu-gcc -B/tools/lib/
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: in `/mnt/lfs/binutils-build':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.


Output of config.log file:
Code:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.64.  Invocation command line was

  $ ../binutils-2.22/configure --prefix=/tools --disable-nls --with-lib-path=/tools/lib

## --------- ##
## Platform. ##
## --------- ##

hostname = linmachine
uname -m = i686
uname -r = 2.6.24-19-generic
uname -s = Linux
uname -v = #1 SMP Wed Jun 18 14:43:41 UTC 2008

/usr/bin/uname -p = unknown
/bin/uname -X    = unknown

/bin/arch              = unknown
/usr/bin/arch -k      = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine          = unknown
/usr/bin/oslevel      = unknown
/bin/universe          = unknown

PATH: /tools/bin
PATH: /bin
PATH: /usr/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2230: checking build system type
configure:2244: result: i686-pc-linux-gnu
configure:2291: checking host system type
configure:2304: result: i686-pc-linux-gnu
configure:2324: checking target system type
configure:2337: result: i686-pc-linux-gnu
configure:2391: checking for a BSD-compatible install
configure:2459: result: /usr/bin/install -c
configure:2470: checking whether ln works
configure:2492: result: yes
configure:2496: checking whether ln -s works
configure:2500: result: yes
configure:2507: checking for a sed that does not truncate output
configure:2571: result: /bin/sed
configure:2580: checking for gawk
configure:2596: found /usr/bin/gawk
configure:2607: result: gawk
configure:3742: checking for gcc
configure:3769: result: i686-lfs-linux-gnu-gcc -B/tools/lib/
configure:3998: checking for C compiler version
configure:4007: i686-lfs-linux-gnu-gcc -B/tools/lib/ --version >&5
i686-lfs-linux-gnu-gcc (GCC) 4.6.2
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:4018: $? = 0
configure:4007: i686-lfs-linux-gnu-gcc -B/tools/lib/ -v >&5
Reading specs from /mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.6.2/specs
COLLECT_GCC=i686-lfs-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/mnt/lfs/tools/bin/../libexec/gcc/i686-lfs-linux-gnu/4.6.2/lto-wrapper
Target: i686-lfs-linux-gnu
Configured with: ../gcc-4.6.2/configure --target=i686-lfs-linux-gnu --prefix=/tools --disable-nls --disable-shared --disable-multilib --disable-decimal-float --disable-threads --disable-libmudflap --disable-libssp --disable-libgomp --disable-libquadmath --disable-target-libiberty --disable-target-zlib --enable-languages=c --without-ppl --without-cloog --with-mpfr-include=/mnt/lfs/gcc-build/../gcc-4.6.2/mpfr/src --with-mpfr-lib=/mnt/lfs/gcc-build/mpfr/src/.libs
Thread model: single
gcc version 4.6.2 (GCC)
configure:4018: $? = 0
configure:4007: i686-lfs-linux-gnu-gcc -B/tools/lib/ -V >&5
i686-lfs-linux-gnu-gcc: error: unrecognized option '-V'
i686-lfs-linux-gnu-gcc: fatal error: no input files
compilation terminated.
configure:4018: $? = 1
configure:4007: i686-lfs-linux-gnu-gcc -B/tools/lib/ -qversion >&5
i686-lfs-linux-gnu-gcc: error: unrecognized option '-qversion'
i686-lfs-linux-gnu-gcc: fatal error: no input files
compilation terminated.
configure:4018: $? = 1
configure:4038: checking for C compiler default output file name
configure:4060: i686-lfs-linux-gnu-gcc -B/tools/lib/    conftest.c  >&5
configure:4064: $? = 0
configure:4101: result: a.out
configure:4117: checking whether the C compiler works
configure:4126: ./a.out
FATAL: kernel too old
configure:4130: $? = 1
configure:4137: error: in `/mnt/lfs/binutils-build':
configure:4141: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.

Output of $LFS_TGT variable:
Code:

lfs@linmachine:/mnt/lfs/binutils-build$ echo $LFS_TGT
i686-lfs-linux-gnu

Adjusting toolchain (section 5.8) had gone well without any errors.
Sanity check output:
Code:

echo 'main(){}' > dummy.c
$LFS_TGT-gcc -B/tools/lib dummy.c
readelf -l a.out | grep ': /tools'

      [Requesting program interpreter: /tools/lib/ld-linux.so.2]

So, no errors in section 5.8. but trying to configure binutils-2.22 pass-2 as directed, results in the above mentioned error.

Thanks for reading.
Sety.

Mordillo98 06-19-2012 06:45 AM

I had this issue before. Normally this is a result of a typo made earlier in the instructions that didn't pass the right parameters and now makes a compilation error.

as well, make sure that you always delete the previous folders created by older instructions every time you compile. That means that when compiling gcc part 2, you should have first deleted the gcc-build and gcc-4.6.2 folders from pass-1 before doing anything else.

Finally, I would suggest to download the Live ISO I've made for LFS 7.1 and use it to copy/paste the instructions from the manual. As well, make sure your VM use the Bridge networking as supposed of the NAT to make the entire thing work. :)

He're my YouTube video about it. Download link in the comments.

http://youtu.be/SzaFNOoGGrw?hd=1

spiky0011 06-19-2012 03:40 PM

Hi

What host are you using and what what kernel is installed
I see from 1 of your earlier posts that you used kernel
Quote:

uname -r = 2.6.24-19-generic
here
The requirements for lfs 7.1
Quote:

Linux Kernel-2.6.25 (having been compiled with GCC-4.1.2 or greater)

iceman911 06-21-2012 07:30 AM

Hi spiky0011,
thanks, mate. I think u r right. my kernel is out of date (2.6.24-19).

Instead of using live-cd, any chance i could upgrade my existing kernel?

spiky0011 06-21-2012 07:53 AM

Hi what host are you using, there must be an option to upgrade the kernel. I have used a debain live ce to build on. Or install debain as os

iceman911 06-23-2012 06:31 AM

Hi Spiky,
I am using ubuntu 8.04.1 as host.
I don't mind going for live cd or something like that, if i have to.
but if i can upgrade kernel on ubuntu, that would save me a lot of hassle.

thanks.

spiky0011 06-23-2012 07:49 AM

Hi

What is the output of
Code:

uname -r
Also there will be a few other host system requirements that will need to be fixed. You should be able to upgrade the kernel in the package manager (cant remember it,s name) Why dont you use a newer version of ubuntu, I,m not trying to put you off but You have to start with everything correct in the begining, Also before you start post the output of http://www.linuxfromscratch.org/lfs/.../hostreqs.html to make sure all is ok.


All times are GMT -5. The time now is 06:33 AM.