I am trying to configure and build a cross compiler for a powerpc-unknown-linux-gnu target to run on a i686-pc-linux-gnu host. The target C library is glibc-2.3.1, built as a shared library. The build process fails when it comes to building libgcc. The error message I get is about being unable to read symbol information from /lib/libc.so, and so I looked at the Makefile and found that it attempts to link libgcc with libc. It does this by defining SHLIB_LC as '-lc'. When I redefine SHLIB_LC as an empty string, the problem goes away. I do not quite understand why libgcc would be linked against libc at this stage. I also noticed that the compiler invokes collect2 to link libgcc, even though I am using GNU ld (and specified -with-gnu-ld as a configure argument). I always assumed collect2 was only required to overcome deficiencies in non-GNU linkers? Release: gcc-3.2.1 Environment: Host: i686-pc-linux-gnu Target: powerpc-unknown-linux-gnu
From: Dara Hazeghi <dhazeghi@yahoo.com> To: thomas.koeller@baslerweb.com, gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org Cc: Subject: Re: bootstrap/9451: Cannot build cross gcc /w shared libs Date: Wed, 14 May 2003 12:02:49 -0700 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit- trail&database=gcc&pr=9451 Hello, could the submitter of this bug report please include the exact options they are using to configure gcc and the exact message that the build is failing with? Finally, if it is possible to check whether this problem still exists on gcc 3.3, that would be great. Thanks, Dara
State-Changed-From-To: open->feedback State-Changed-Why: See Dara's question.
The compiler is configured as follows: "~/src/gnu/gcc-3.2.3/configure" \ --prefix="/opt/linux-cross" \ --build="i686-pc-linux-gnu" --host="i686-pc-linux-gnu" \ --target="powerpc-unknown-linux-gnu" \ --with-gnu-as --with-gnu-ld --enable-threads=posix \ --enable-languages=c,c++ --with-system-zlib \ --with-headers="${target}/usr/include" \ --with-libs="${target}/usr/lib" ${target} is the root of the target file system; glibc-2.3.2 is installed there. The exact failure is: /home/thomas/build-cross-toolchain-test/stage-2/gcc-3.2.3/gcc/xgcc -B/home/thomas/build-cross-toolchain-test/stage-2/gcc-3.2.3/gcc/ -B/opt/linux-cross/powerpc-unknown-linux-gnu/bin/ -B/opt/linux-cross/powerpc-unknown-linux-gnu/lib/ -isystem /opt/linux-cross/powerpc-unknown-linux-gnu/include -O2 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc/./libgcc.map -o libgcc_s.so.1 -fPIC -mstrict-align libgcc/./_muldi3.o libgcc/./_negdi2.o libgcc/./_lshrdi3.o libgcc/./_ashldi3.o libgcc/./_ashrdi3.o libgcc/./_ffsdi2.o libgcc/./_clz.o libgcc/./_cmpdi2.o libgcc/./_ucmpdi2.o libgcc/./_floatdidf.o libgcc/./_floatdisf.o libgcc/./_fixunsdfsi.o libgcc/./_fixunssfsi.o libgcc/./_fixunsdfdi.o libgcc/./_fixdfdi.o libgcc/./_fixunssfdi.o libgcc/./_fixsfdi.o libgcc/./_fixxfdi.o libgcc/./_fixunsxfdi.o libgcc/./_floatdixf.o libgcc/./_fixunsxfsi.o libgcc/./_fixtfdi.o libgcc/./_fixunstfdi.o libgcc/./_floatditf.o libgcc/./_clear_cache.o libgcc/./_trampoline.o libgcc/./__main.o libgcc/./_exit.o libgcc/./_absvsi2.o libgcc/./_absvdi2.o libgcc/./_addvsi3.o libgcc/./_addvdi3.o libgcc/./_subvsi3.o libgcc/./_subvdi3.o libgcc/./_mulvsi3.o libgcc/./_mulvdi3.o libgcc/./_negvsi2.o libgcc/./_negvdi2.o libgcc/./_ctors.o libgcc/./_divdi3.o libgcc/./_moddi3.o libgcc/./_udivdi3.o libgcc/./_umoddi3.o libgcc/./_udiv_w_sdiv.o libgcc/./_udivmoddi4.o libgcc/./_pack_sf.o libgcc/./_unpack_sf.o libgcc/./_addsub_sf.o libgcc/./_mul_sf.o libgcc/./_div_sf.o libgcc/./_fpcmp_parts_sf.o libgcc/./_compare_sf.o libgcc/./_eq_sf.o libgcc/./_ne_sf.o libgcc/./_gt_sf.o libgcc/./_ge_sf.o libgcc/./_lt_sf.o libgcc/./_le_sf.o libgcc/./_unord_sf.o libgcc/./_si_to_sf.o libgcc/./_sf_to_si.o libgcc/./_negate_sf.o libgcc/./_make_sf.o libgcc/./_sf_to_df.o libgcc/./_thenan_sf.o libgcc/./_sf_to_usi.o libgcc/./_usi_to_sf.o libgcc/./_pack_df.o libgcc/./_unpack_df.o libgcc/./_addsub_df.o libgcc/./_mul_df.o libgcc/./_div_df.o libgcc/./_fpcmp_parts_df.o libgcc/./_compare_df.o libgcc/./_eq_df.o libgcc/./_ne_df.o libgcc/./_gt_df.o libgcc/./_ge_df.o libgcc/./_lt_df.o libgcc/./_le_df.o libgcc/./_unord_df.o libgcc/./_si_to_df.o libgcc/./_df_to_si.o libgcc/./_negate_df.o libgcc/./_make_df.o libgcc/./_df_to_sf.o libgcc/./_thenan_df.o libgcc/./_df_to_usi.o libgcc/./_usi_to_df.o libgcc/./tramp.o libgcc/./unwind-dw2.o libgcc/./unwind-dw2-fde-glibc.o libgcc/./unwind-sjlj.o -lc && rm -f libgcc_s.so && ln -s libgcc_s.so.1 libgcc_s.so /lib/libc.so.6: could not read symbols: Invalid operation collect2: ld returned 1 exit status make[2]: *** [libgcc_s.so] Error 1 make[2]: Leaving directory `/home/thomas/build-cross-toolchain-test/stage-2/gcc-3.2.3/gcc' make[1]: *** [stmp-multilib] Error 2 make[1]: Leaving directory `/home/thomas/build-cross-toolchain-test/stage-2/gcc-3.2.3/gcc' make: *** [all-gcc] Error 2 This result has been obtained using gcc-3.2.3, glibc-2.3.2 and binutils-2.13.2.1. I also tried gcc-3.3, with identical results.
Hello, I think I might have an idea about the problem. Check what the contents of ${target}/usr/lib/ libc.so are. I think you need to edit the paths in that file accordingly, for the cross-compiler to work (change the paths to those of the powerpc glibc you have copied). Tell me if that helps. Thanks, Dara
Subject: RE: Cannot build cross gcc /w shared libs Yes, you are right, libc.so is actually a linker script containing absolute paths, and I installed glibc in a directory different from what I configured it for (I wanted to export it via NFS as the target's root fs). Thank you very much for your assistance. Just one last question: once --with-sysroot becomes available, will I then be able to do this sort of thing? Thanks again, Thomas > -----Original Message----- > From: dhazeghi@yahoo.com [mailto:gcc-bugzilla@gcc.gnu.org] > Sent: Saturday, May 31, 2003 10:18 AM > To: thomas.koeller@baslerweb.com > Subject: [Bug bootstrap/9451] Cannot build cross gcc /w shared libs > > > PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* > gcc-bugs@gcc.gnu.org. > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9451 > > > > ------- Additional Comments From dhazeghi@yahoo.com > 2003-05-31 08:17 ------- > Hello, > > I think I might have an idea about the problem. Check what > the contents of ${target}/usr/lib/ > libc.so are. I think you need to edit the paths in that file > accordingly, for the cross-compiler to > work (change the paths to those of the powerpc glibc you have > copied). Tell me if that helps. > Thanks, > > Dara > > > > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. >
Thomas, yes --with-sysroot should do what you're asking, in the form of --sysroot=${target} in your case. If that fails, by all means, send another bug reports. Given all the effort put into making it work, I'm sure people will be responsive. I'm closing this report as not actually a bug, although if you have a suggestion where this information should go, send me an e-mail, and I'll reopen this as a documentation enhancement request... Dara