Hi Waldemar,
Ср, 18 трав. 2016 о 21:45 Waldemar Brodkorb <wbx(a)uclibc-ng.org> пише:
Hmm. Are you compiling natively on a ARM uclibc-ng
system?
gcc -v
gcc -v hello.c -o hello
Yes, I'm compiling natively. Optware-ng provides gcc for native
compilation. /opt/bin/gcc is a wrapper around /opt/bin/gcc.real -- the
actual compiler:
root@unknown:/tmp/home/root# cat /opt/bin/gcc
#!/bin/sh
/opt/bin/gcc.real -Wl,--dynamic-linker=/opt/lib/ld-uClibc.so.1 -pipe "$@"
-I/opt/include -L/opt/lib -Wl,-rpath,/opt/lib -Wl,-rpath-link,/opt/lib
root@unknown:/tmp/home/root# gcc.real -v
Using built-in specs.
COLLECT_GCC=gcc.real
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)
root@unknown:/tmp/home/root# gcc -v hello.c -o hello
Using built-in specs.
COLLECT_GCC=/opt/bin/gcc.real
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='-pipe' '-v' '-o' 'hello'
'-I' '/opt/include'
'-L/opt/lib' '-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 -I
/opt/include -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 - |
/opt/lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/as
-v -I /opt/include -mcpu=cortex-a9 -mfloat-abi=soft -meabi=5 -o
/tmp/ccS2W9jB.o
GNU assembler version 2.25.1 (arm-buildroot-linux-uclibcgnueabi) using BFD
version (GNU Binutils) 2.25.1
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"
ignoring duplicate directory "/opt/include"
as it is a non-system directory that duplicates a system directory
#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: c08c84285b122b419bc5a2ddcee6c301
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='-pipe' '-v' '-o' 'hello'
'-I' '/opt/include'
'-L/opt/lib' '-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/ccKYWI8O.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 /lib/ld-uClibc.so.0 -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
-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/../../..
--dynamic-linker=/opt/lib/ld-uClibc.so.1 /tmp/ccS2W9jB.o -rpath /opt/lib
-rpath-link /opt/lib -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/ccS2W9jB.o: In function `main':
hello.c:(.text+0x44): undefined reference to `atexit'
collect2: error: ld returned 1 exit status
When I cross-compile your test program for ARM and
then
run it on qemu-system-arm, everything is fine.
I confirm, it works when cross-compiled! Is there something wrong with my
native gcc? The libs and the headers are the same. Here's cross gcc config,
it looks to be compatible with the native one:
jenkins@u0:/tmp$
/home/jenkins/Optware-ng/buildroot-armeabi-ng/toolchain/buildroot-arm-linux-2.6.36-uclibc-ng-5.3.0/bin/arm-buildroot-linux-uclibcgnueabi-gcc
-v
Using built-in specs.
COLLECT_GCC=/home/jenkins/Optware-ng/buildroot-armeabi-ng/toolchain/buildroot-arm-linux-2.6.36-uclibc-ng-5.3.0/bin/arm-buildroot-linux-uclibcgnueabi-gcc.br_real
COLLECT_LTO_WRAPPER=/home/jenkins/Optware-ng/buildroot-armeabi-ng/toolchain/buildroot-arm-linux-2.6.36-uclibc-ng-5.3.0/bin/../libexec/gcc/arm-buildroot-linux-uclibcgnueabi/5.3.0/lto-wrapper
Target: arm-buildroot-linux-uclibcgnueabi
Configured with: ./configure
--prefix=/home/jenkins/Optware-ng/buildroot-armeabi-ng/toolchain/buildroot-2016.02/output/host/usr
--sysconfdir=/home/jenkins/Optware-ng/buildroot-armeabi-ng/toolchain/buildroot-2016.02/output/host/etc
--enable-static --target=arm-buildroot-linux-uclibcgnueabi
--with-sysroot=/home/jenkins/Optware-ng/buildroot-armeabi-ng/toolchain/buildroot-arm-linux-2.6.36-uclibc-ng-5.3.0/arm-buildroot-linux-uclibcgnueabi/sysroot
--disable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib
--with-gmp=/home/jenkins/Optware-ng/buildroot-armeabi-ng/toolchain/buildroot-2016.02/output/host/usr
--with-mpfr=/home/jenkins/Optware-ng/buildroot-armeabi-ng/toolchain/buildroot-2016.02/output/host/usr
--with-pkgversion='Buildroot 2016.02-g5068547' --with-bugurl=
http://bugs.buildroot.net/ --disable-libsanitizer --enable-tls
--disable-libmudflap --enable-threads
--with-mpc=/home/jenkins/Optware-ng/buildroot-armeabi-ng/toolchain/buildroot-2016.02/output/host/usr
--without-isl --without-cloog --with-float=soft --disable-decimal-float
--with-abi=aapcs-linux --with-cpu=cortex-a9 --with-float=soft
--with-mode=arm --enable-languages=c,c++
--with-build-time-tools=/home/jenkins/Optware-ng/buildroot-armeabi-ng/toolchain/buildroot-2016.02/output/host/usr/arm-buildroot-linux-uclibcgnueabi/bin
--enable-shared --disable-libgomp
--with-default-libstdcxx-abi=gcc4-compatible
Thread model: posix
gcc version 5.3.0 (Buildroot 2016.02-g5068547)
Any ideas what may be wrong here (though this probably isn't a uClibc-ng
issue)?
Thanks!