This is the mail archive of the
crossgcc@sourceware.org
mailing list for the crossgcc project.
See crosstool-NG for lots
more information.
general cross-compilation question: cross ld not prepending the sysroot for linker scripts
- From: mailinglists at bdn dot de
- To: crossgcc at sourceware dot org
- Date: Wed, 23 Jan 2013 13:24:16 +0100
- Subject: general cross-compilation question: cross ld not prepending the sysroot for linker scripts
Hi guys,
I have built a cross-gcc for win32 which generates code for linux and
links to files in a sysroot directory:
The toolchain seems to be working, however when the linker opens
linker scripts, the paths referred to therein are not prepended with
the $sysroot prefix (C:/mingw/msys/1.0/opt/emlix/ews/sysroot/).
so since /opt/emlix/ews/sysroot/usr/lib/libc.so contains the implicit
reference to "/lib/libc.so.6" and such, it tries to open
"/lib/libc.so.6" rather than
"c:/mingw/msys/1.0/opt/emlix/ews/sysroot/lib/libc.so.6" as it should
be and as ld.exe does for regular shared object files.
binutils has been built with the following options:
CC=i586-mingw32msvc-gcc \
CC_FOR_TARGET=i586-mingw32msvc-gcc \
GCC_FOR_TARGET=i586-mingw32msvc-gcc \
../binutils-2.23/configure \
--prefix=/opt/emlix/ews/mingw \
--build=i686-unknown-linux-gnu \
--host=mingw32 \
--target=i686-unknown-linux-gnu \
--with-lib-path=/opt/emlix/ews/sysroot/usr/lib:/opt/emlix/ews/sysroot/lib \
--disable-nls \
--enable-shared \
--disable-multilib \
--with-sysroot=C:/mingw/msys/1.0//opt/emlix/ews/sysroot/ \
--with-build-sysroot=C:/mingw/msys/1.0//opt/emlix/ews/sysroot/
LDFLAGS_FOR_TARGET="--sysroot=C:/mingw/msys/1.0//opt/emlix/ews/sysroot/" \
CPPFLAGS_FOR_TARGET="--sysroot=C:/mingw/msys/1.0//opt/emlix/ews/sysroot/ \
CPPFLAGS_FOR_TARGET="--sysroot=C:/mingw/msys/1.0//opt/emlix/ews/sysroot/ \
make
emlix@emlix-$ i686-unknown-linux-gnu-gcc main.c -Wl,--verbose
[...]
==================================================
attempt to open
C:/mingw/msys/1.0/opt/emlix/ews/sysroot//usr/lib/crt1.o succeeded
C:/mingw/msys/1.0/opt/emlix/ews/sysroot//usr/lib/crt1.o
attempt to open
C:/mingw/msys/1.0/opt/emlix/ews/sysroot//usr/lib/crti.o succeeded
C:/mingw/msys/1.0/opt/emlix/ews/sysroot//usr/lib/crti.o
attempt to open
c:/mingw/msys/1.0/opt/emlix/ews/mingw/bin/../lib/gcc/i686-unknown-linux-gnu/4.6.3/crtbegin.o
succeeded
c:/mingw/msys/1.0/opt/emlix/ews/mingw/bin/../lib/gcc/i686-unknown-linux-gnu/4.6.3/crtbegin.o
attempt to open C:\DOKUME~1\emlix\LOKALE~1\Temp\ccSou3Dx.o succeeded
C:\DOKUME~1\emlix\LOKALE~1\Temp\ccSou3Dx.o
attempt to open
c:/mingw/msys/1.0/opt/emlix/ews/mingw/bin/../lib/gcc/i686-unknown-linux-gnu/4.6.3/libgcc.so
failed
attempt to open
c:/mingw/msys/1.0/opt/emlix/ews/mingw/bin/../lib/gcc/i686-unknown-linux-gnu/4.6.3\libgcc.a
succeeded
attempt to open
c:/mingw/msys/1.0/opt/emlix/ews/mingw/bin/../lib/gcc/i686-unknown-linux-gnu/4.6.3/libc.so
failed
attempt to open
c:/mingw/msys/1.0/opt/emlix/ews/mingw/bin/../lib/gcc/i686-unknown-linux-gnu/4.6.3\libc.a
failed
attempt to open
c:/mingw/msys/1.0/opt/emlix/ews/mingw/bin/../lib/gcc/libc.so failed
attempt to open
c:/mingw/msys/1.0/opt/emlix/ews/mingw/bin/../lib/gcc\libc.a failed
attempt to open
c:/mingw/msys/1.0/opt/emlix/ews/mingw/bin/../lib/gcc/i686-unknown-linux-gnu/4.6.3/../../../../i686-unknown-linux-gnu/lib/libc.so
failed
attempt to open
c:/mingw/msys/1.0/opt/emlix/ews/mingw/bin/../lib/gcc/i686-unknown-linux-gnu/4.6.3/../../../../i686-unknown-linux-gnu/lib\libc.a
failed
attempt to open C:/mingw/msys/1.0/opt/emlix/ews/sysroot//lib/libc.so failed
attempt to open C:/mingw/msys/1.0/opt/emlix/ews/sysroot//lib\libc.a failed
attempt to open
C:/mingw/msys/1.0/opt/emlix/ews/sysroot//usr/lib/libc.so succeeded
opened script file C:/mingw/msys/1.0/opt/emlix/ews/sysroot//usr/lib/libc.so
opened script file C:/mingw/msys/1.0/opt/emlix/ews/sysroot//usr/lib/libc.so
attempt to open /opt/emlix/ews/sysroot/lib/libc.so.6 failed
attempt to open /opt/emlix/ews/sysroot/usr/lib/libc_nonshared.a failed
attempt to open /opt/emlix/ews/sysroot/lib/ld-linux.so.2 failed
c:/mingw/msys/1.0/opt/emlix/ews/mingw/bin/../lib/gcc/i686-unknown-linux-gnu/4.6.3/../../../../i686-unknown-linux-gnu/bin/ld.exe: cannot find
/opt/emlix/ews/sysroot/lib/libc.so.6
c:/mingw/msys/1.0/opt/emlix/ews/mingw/bin/../lib/gcc/i686-unknown-linux-gnu/4.6.3/../../../../i686-unknown-linux-gnu/bin/ld.exe: cannot find
/opt/emlix/ews/sysroot/usr/lib/libc_nonshared.a
c:/mingw/msys/1.0/opt/emlix/ews/mingw/bin/../lib/gcc/i686-unknown-linux-gnu/4.6.3/../../../../i686-unknown-linux-gnu/bin/ld.exe: cannot find
/opt/emlix/ews/sysroot/lib/ld-linux.so.2
collect2: ld returned 1 exit status
If I modify the group paths in /opt/emlix/ews/sysroot/usr/lib/libc.so
to prefix
C:/mingw/msys/1.0/opt/emlix/ews/sysroot/ then it links fine.
does anybody know why this is happening?
any help would be much appreciated. Thanks,
Joel Thomas
--
For unsubscribe information see http://sourceware.org/lists.html#faq