On Thu, May 19, 2016 at 8:24 PM, Lance Fredrickson
<lancethepants(a)gmail.com> wrote:
If not helpful in this case, using --with-sysroot
should at least help with
other corner cases like I've encountered.
Agree, this may prove be helpful: it limits the locations where ld
searchs libs by default to /opt/lib and /opt/usr/lib, which is good.
After I applied gcc-5.3.0-specs-1.patch
(
https://github.com/lancethepants/tomatoware/blob/ee309db223572ccd1ddc2d58a2…)
patch and rebuilt glibc with proper prefix (uClibc-ng targets had
correct prefix already), gcc works without additional flags fine now,
so I removed the dirty wrappers. However, uClibc-ng targets still
suffer from the atexit issue:
root@unknown:/tmp/home/root# gcc hello.c -o hello
-v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/libexec/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/lto-wrapper
Target: arm-buildroot-linux-uclibcgnueabi
Configured with: ../gcc-5.3.0/configure --build=x86_64-pc-linux-gnu
--host=arm-buildroot-linux-uclibcgnueabi --target=arm-buildroot-linux-uclibcgnueabi
--prefix=/opt --disable-nls --disable-static
--with-as=/home/jenkins/Optware-ng/buildroot-armeabi-ng/toolchain/buildroot-arm-linux-2.6.36-uclibc-ng-5.3.0/bin/arm-buildroot-linux-uclibcgnueabi-as
--with-ld=/home/jenkins/Optware-ng/buildroot-armeabi-ng/toolchain/buildroot-arm-linux-2.6.36-uclibc-ng-5.3.0/bin/arm-buildroot-linux-uclibcgnueabi-ld
--enable-languages=c,c++ --disable-multilib --with-gxx-include-dir=/opt/include/c++/5.3.0
--disable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-libsanitizer --enable-tls
--disable-libmudflap --enable-threads --without-isl --without-cloog --with-float=soft
--disable-decimal-float --with-abi=aapcs-linux --with-cpu=cortex-a9 --with-mode=arm
--enable-shared --disable-libgomp
--with-gmp=/home/jenkins/Optware-ng/buildroot-armeabi-ng/staging/opt
--with-mpfr=/home/jenkins/Optware-ng/buildroot-armeabi-ng/staging/opt
--with-mpc=/home/jenkins/Optware-ng/buildroot-armeabi-ng/staging/opt
--with-default-libstdcxx-abi=gcc4-compatible --with-system-zlib
Thread model: posix
gcc version 5.3.0 (GCC)
COLLECT_GCC_OPTIONS='-o' 'hello' '-v' '-mcpu=cortex-a9'
'-mfloat-abi=soft' '-mabi=aapcs-linux' '-marm'
'-mtls-dialect=gnu'
/opt/libexec/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/cc1 -quiet -v -imultilib .
-imultiarch arm-linux-gnueabi hello.c -quiet -dumpbase hello.c -mcpu=cortex-a9
-mfloat-abi=soft -mabi=aapcs-linux -marm -mtls-dialect=gnu -auxbase hello -version -o
/tmp/cc6Ys36c.s
GNU C11 (GCC) version 5.3.0 (arm-buildroot-linux-uclibcgnueabi)
compiled by GNU C version 5.3.0, GMP version 6.0.0, MPFR version 3.1.3, MPC
version 1.0.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory "/usr/local/include/arm-linux-gnueabi"
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/include"
ignoring nonexistent directory "/usr/include/arm-linux-gnueabi"
ignoring nonexistent directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/include
/opt/include
/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/include-fixed
End of search list.
GNU C11 (GCC) version 5.3.0 (arm-buildroot-linux-uclibcgnueabi)
compiled by GNU C version 5.3.0, GMP version 6.0.0, MPFR version 3.1.3, MPC
version 1.0.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 2407f8e2f7e722b4fd559f0775bed36e
COLLECT_GCC_OPTIONS='-o' 'hello' '-v' '-mcpu=cortex-a9'
'-mfloat-abi=soft' '-mabi=aapcs-linux' '-marm'
'-mtls-dialect=gnu'
/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/as
-v -mcpu=cortex-a9 -mfloat-abi=soft -meabi=5 -o /tmp/ccJeIKY3.o /tmp/cc6Ys36c.s
GNU assembler version 2.25.1 (arm-buildroot-linux-uclibcgnueabi) using BFD version (GNU
Binutils) 2.25.1
COMPILER_PATH=/opt/libexec/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/:/opt/libexec/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/:/opt/libexec/gcc/arm-buildroot-linux-uclibcgnueabi/:/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/:/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/:/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/
LIBRARY_PATH=/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/:/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/lib/:/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-o' 'hello' '-v' '-mcpu=cortex-a9'
'-mfloat-abi=soft' '-mabi=aapcs-linux' '-marm'
'-mtls-dialect=gnu'
/opt/libexec/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/collect2 -plugin
/opt/libexec/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/liblto_plugin.so
-plugin-opt=/opt/libexec/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/lto-wrapper
-plugin-opt=-fresolution=/tmp/cca2Pva6.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr
-dynamic-linker /opt/lib/ld-uClibc.so.1 -X -m armelf_linux_eabi -o hello
/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/lib/crt1.o
/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/lib/crti.o
/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/crtbegin.o
-L/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0
-L/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/lib
-L/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/../../.. /tmp/ccJeIKY3.o -lgcc
--as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/crtend.o
/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/lib/crtn.o
/tmp/ccJeIKY3.o: In function `main':
hello.c:(.text+0x44): undefined reference to `atexit'
collect2: error: ld returned 1 exit status
Waldemar, or somebody, is there a way I can debug this further? Sorry
if this turns out to be uClibc-ng unrelated and I'm spamming the list,
but for some reason it happens with uClibc-ng targets only.
I think it is on topic. I have cross-compiled gcc and the resulting
gcc with prefix /usr can build hello.c.
Have you tried to add --with-sysroot/--with-build-sysroot while
configuring gcc? I normally use it on the host to build a
relocatable cross-compiler, but I think it might be a solution for
non-standard location, too.
For further debugging you could strace -f -e open -o log to see
if still something in /lib is opened while linking.
best regards
Waldemar