LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Failed to compile libatomic at the first time to compile gcc(step 5.5) (https://www.linuxquestions.org/questions/linux-from-scratch-13/failed-to-compile-libatomic-at-the-first-time-to-compile-gcc-step-5-5-a-4175470059/)

clicdl 07-18-2013 07:50 AM

Failed to compile libatomic at the first time to compile gcc(step 5.5)
 
I am praticing LFS 5.5, compile gcc for the fist time.
But got the following errors:
configure: error: in `/mnt/lfs/sources/gcc-build/i686-lfs-linux-gnu/libatomic':
configure: error: C compiler cannot create executables
See `config.log' for more details.
make[1]: *** [configure-target-libatomic] Error 1
make[1]: Leaving directory `/mnt/lfs/sources/gcc-build'
make: *** [all] Error 2


The config.log is :
Target: i686-lfs-linux-gnu
Configured with: ../gcc-4.8.1/configure --target=i686-lfs-linux-gnu --prefix=/tools --with-sysroot=/mnt/lfs --with-newlib --without-headers --with-local-prefix=/tools --with-native-system-header-dir=/tools/include --disable-nls --disable-shared --disable-multilib --disable-decimal-float --disable-threads --disable-libmudflap --disable-libssp --disable-libgomp --disable-libquadmath --enable-languages=c --with-mpfr-include=/mnt/lfs/sources/gcc-build/../gcc-4.8.1/mpfr/src --with-mpfr-lib=/mnt/lfs/sources/gcc-build/mpfr/src/.libs
Thread model: single
gcc version 4.8.1 (GCC)
configure:3457: $? = 0
configure:3477: checking for C compiler default output file name
configure:3499: /mnt/lfs/sources/gcc-build/./gcc/xgcc -B/mnt/lfs/sources/gcc-build/./gcc/ -B/tools/i686-lfs-linux-gnu/bin/ -B/tools/i686-lfs-linux-gnu/lib/ -isystem /tools/i686-lfs-linux-gnu/include -isystem /tools/i686-lfs-linux-gnu/sys-include -g -O2 conftest.c >&5
/tools/i686-lfs-linux-gnu/bin/ld: cannot find crt1.o: No such file or directory
/tools/i686-lfs-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
/tools/i686-lfs-linux-gnu/bin/ld: cannot find -lc
/tools/i686-lfs-linux-gnu/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
configure:3503: $? = 1
configure:3540: result:
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU Atomic Library"
| #define PACKAGE_TARNAME "libatomic"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU Atomic Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libatomic/"
| #define PACKAGE "libatomic"
| #define VERSION "1.0"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }


I have configure gcc successfully by the following cmd:
../gcc-4.8.1/configure \
--target=$LFS_TGT \
--prefix=/tools \
--with-sysroot=$LFS \
--with-newlib \
--without-headers \
--with-local-prefix=/tools \
--with-native-system-header-dir=/tools/include \
--disable-nls \
--disable-shared \
--disable-multilib \
--disable-decimal-float \
--disable-threads \
--disable-libmudflap \
--disable-libssp \
--disable-libgomp \
--disable-libquadmath \
--enable-languages=c \
--with-mpfr-include=$(pwd)/../gcc-4.8.1/mpfr/src \
--with-mpfr-lib=$(pwd)/mpfr/src/.libs

Is there anything wrong with my enironment?
B.R.

clicdl 07-18-2013 07:54 AM

By the way, my OS is ubuntu12.04
Follwing is the result of version-check :

bash, version 4.2.24(1)-release
/bin/sh -> /bin/bash
Binutils: (GNU Binutils for Ubuntu) 2.22
bison (GNU Bison) 2.5
/usr/bin/yacc -> /usr/bin/bison.yacc
bzip2, Version 1.0.6, 6-Sept-2010.
Coreutils: 8.13
diff (GNU diffutils) 3.2
find (GNU findutils) 4.4.2
GNU Awk 3.1.8
/usr/bin/awk -> /usr/bin/gawk
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
(Ubuntu EGLIBC 2.15-0ubuntu10.3) 2.15
grep (GNU grep) 2.10
gzip 1.4
Linux version 3.2.0-33-generic-pae (buildd@lamiak) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #52-Ubuntu SMP Thu Oct 18 16:39:21 UTC 2012
m4 (GNU M4) 1.4.16
GNU Make 3.81
patch 2.6.1
Perl version='5.14.2';
GNU sed version 4.2.1
tar (GNU tar) 1.26
Texinfo: makeinfo (GNU texinfo) 4.13
xz (XZ Utils) 5.1.0alpha
g++ compilation OK

re_nelson 07-20-2013 10:07 PM

Quote:

Originally Posted by clicdl (Post 4992522)
/tools/i686-lfs-linux-gnu/bin/ld: cannot find crt1.o: No such file or directory
/tools/i686-lfs-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
/tools/i686-lfs-linux-gnu/bin/ld: cannot find -lc
/tools/i686-lfs-linux-gnu/bin/ld: cannot find crtn.o: No such file or directory

First, if its any consolation, this is a well crafted problem report providing a wealth of good information that I took the liberty of trimming. It's very specific and the title is appropriate.

My initial thoughts are:

1). Double check that you're functioning in the role of the LFS user.

2). Since the start and end object files (crt?.o) aren't found, examine your host system to ensure they're present. Typically they'll be in one of /lib, lib32 or /lib64. Use the command locate crt1.o to identify their presence. Likewise locate libc.so should be executed to verify that the C library is available to the linker.

3). Can I presume that 5.4. Binutils-2.23.2 - Pass 1 yielded no errors?

knudfl 07-21-2013 03:53 AM

Quote:

cannot find crt1.o
cannot find -lc
$ locale crt1.o : EDIT ..
EDIT typo to : $ locate crt1.o : /usr/lib/i386-linux-gnu/crt1.o
$ dpkg -L libc6-dev | grep crt1.o : /usr/lib/i386-linux-gnu/crt1.o
-lc : That's libc.so : Same location.

I.e. Debian / Ubuntu are now now using "a hideaway location" for a lot of files.

Configuring gcc can be like :

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/i386-linux-gnu/ && ../gcc-4.8.1/configure -- .......


-

druuna 07-21-2013 04:06 AM

@knudfl: That info might come in handy!

BTW: Typo -> locale crt1.o should be locate crt1.o has been fixed

clicdl 07-22-2013 08:37 AM

Thanks for all your replies.
But I get the same problem after I doing the following action.
Quote:

Originally Posted by knudfl (Post 4994055)
Configuring gcc can be like :

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/i386-linux-gnu/ && ../gcc-4.8.1/configure -- .......


-

Yet, I totoally clean my envirmont and repeat the binutils compiling again, but it doesn't work.

Is there any other solutions?

druuna 07-22-2013 09:07 AM

Quote:

Originally Posted by clicdl (Post 4992525)
bash, version 4.2.24(1)-release
/bin/sh -> /bin/bash
Binutils: (GNU Binutils for Ubuntu) 2.22
bison (GNU Bison) 2.5
/usr/bin/yacc -> /usr/bin/bison.yacc
bzip2, Version 1.0.6, 6-Sept-2010.
Coreutils: 8.13
diff (GNU diffutils) 3.2
find (GNU findutils) 4.4.2
GNU Awk 3.1.8
/usr/bin/awk -> /usr/bin/gawk
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
(Ubuntu EGLIBC 2.15-0ubuntu10.3) 2.15
grep (GNU grep) 2.10
gzip 1.4
Linux version 3.2.0-33-generic-pae (buildd@lamiak) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #52-Ubuntu SMP Thu Oct 18 16:39:21 UTC 2012
m4 (GNU M4) 1.4.16
GNU Make 3.81
patch 2.6.1
Perl version='5.14.2';
GNU sed version 4.2.1
tar (GNU tar) 1.26
Texinfo: makeinfo (GNU texinfo) 4.13
xz (XZ Utils) 5.1.0alpha
g++ compilation OK

The bold/red parts look suspicious.

The g++ part shouldn't be there, and looking at the compilation part it seems to be using g++ instead of gcc.

I'm not sure what you did to make Ubuntu 12.04 compliant, but you might have done something wrong. Maybe this will help (specifically the Preparing Ubuntu steps):
- LFS 7.1 on Ubuntu 12.04

BTW: knudfl's post deals with the latest Debian/Ubuntu versions, which would not include Ubuntu 12.04 (which you can check yourself).

clicdl 07-23-2013 05:09 AM

Thanks for you help. Following the steps in your blog, I have successfully compiled gcc pass 1.

Quote:

Originally Posted by druuna (Post 4994665)
The bold/red parts look suspicious.

The g++ part shouldn't be there, and looking at the compilation part it seems to be using g++ instead of gcc.

I'm not sure what you did to make Ubuntu 12.04 compliant, but you might have done something wrong. Maybe this will help (specifically the Preparing Ubuntu steps):
- LFS 7.1 on Ubuntu 12.04

BTW: knudfl's post deals with the latest Debian/Ubuntu versions, which would not include Ubuntu 12.04 (which you can check yourself).


druuna 07-23-2013 05:20 AM

You're welcome :)

BTW: Can you put up the [SOLVED] tag? (link is on the top right hand side)


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