主题 : 关于arm-linux-gcc 4.5.1 和glibc_2 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 70008
精华: 0
发帖: 24
金钱: 120 两
威望: 24 点
综合积分: 48 分
注册时间: 2012-05-14
最后登录: 2018-02-08
楼主  发表于: 2014-05-08 09:07

 关于arm-linux-gcc 4.5.1 和glibc_2

今天用友善之臂提供的arm-linux-gcc 4.5.1编译链接一个动态链接库 遇到一下报错信息:
root@wing:/mnt/hgfs/work/ARM-EXAMPLE# make
arm-linux-gcc pubsync.c -o pubsync  libmqttv3c.so -lpthread
libmqttv3c.so: undefined reference to `realloc@GLIBC_2.0'
libmqttv3c.so: undefined reference to `stdout@GLIBC_2.0'
libmqttv3c.so: undefined reference to `inet_ntop@GLIBC_2.0'
libmqttv3c.so: undefined reference to `fgets@GLIBC_2.0'
libmqttv3c.so: undefined reference to `mkdir@GLIBC_2.0'
libmqttv3c.so: undefined reference to `readdir@GLIBC_2.0'
libmqttv3c.so: undefined reference to `pthread_mutex_init@GLIBC_2.0'
libmqttv3c.so: undefined reference to `memset@GLIBC_2.0'
libmqttv3c.so: undefined reference to `shutdown@GLIBC_2.0'
libmqttv3c.so: undefined reference to `difftime@GLIBC_2.0'
libmqttv3c.so: undefined reference to `closedir@GLIBC_2.0'
libmqttv3c.so: undefined reference to `strrchr@GLIBC_2.0'
libmqttv3c.so: undefined reference to `strncpy@GLIBC_2.0'
libmqttv3c.so: undefined reference to `writev@GLIBC_2.0'
libmqttv3c.so: undefined reference to `strerror@GLIBC_2.0'
libmqttv3c.so: undefined reference to `recv@GLIBC_2.0'
libmqttv3c.so: undefined reference to `getsockopt@GLIBC_2.0'
libmqttv3c.so: undefined reference to `usleep@GLIBC_2.0'
libmqttv3c.so: undefined reference to `vsnprintf@GLIBC_2.0'
libmqttv3c.so: undefined reference to `select@GLIBC_2.0'
libmqttv3c.so: undefined reference to `strcmp@GLIBC_2.0'
libmqttv3c.so: undefined reference to `getaddrinfo@GLIBC_2.0'
libmqttv3c.so: undefined reference to `__lxstat@GLIBC_2.0'
libmqttv3c.so: undefined reference to `localtime@GLIBC_2.0'
libmqttv3c.so: undefined reference to `ftell@GLIBC_2.0'
libmqttv3c.so: undefined reference to `fcntl@GLIBC_2.0'
libmqttv3c.so: undefined reference to `strftime@GLIBC_2.0'
libmqttv3c.so: undefined reference to `strtok_r@GLIBC_2.0'
libmqttv3c.so: undefined reference to `strchr@GLIBC_2.0'
libmqttv3c.so: undefined reference to `pthread_cond_destroy@GLIBC_2.3.2'
libmqttv3c.so: undefined reference to `fwrite@GLIBC_2.0'
libmqttv3c.so: undefined reference to `getenv@GLIBC_2.0'
libmqttv3c.so: undefined reference to `fseek@GLIBC_2.0'
libmqttv3c.so: undefined reference to `__xstat@GLIBC_2.0'
libmqttv3c.so: undefined reference to `rename@GLIBC_2.0'
libmqttv3c.so: undefined reference to `malloc@GLIBC_2.0'
libmqttv3c.so: undefined reference to `strstr@GLIBC_2.0'
libmqttv3c.so: undefined reference to `strncmp@GLIBC_2.0'
libmqttv3c.so: undefined reference to `freeaddrinfo@GLIBC_2.0'
libmqttv3c.so: undefined reference to `fflush@GLIBC_2.0'
libmqttv3c.so: undefined reference to `fread@GLIBC_2.0'
libmqttv3c.so: undefined reference to `stderr@GLIBC_2.0'
libmqttv3c.so: undefined reference to `memcpy@GLIBC_2.0'
libmqttv3c.so: undefined reference to `rmdir@GLIBC_2.0'
libmqttv3c.so: undefined reference to `strlen@GLIBC_2.0'
libmqttv3c.so: undefined reference to `close@GLIBC_2.0'
libmqttv3c.so: undefined reference to `__errno_location@GLIBC_2.0'
libmqttv3c.so: undefined reference to `pthread_self@GLIBC_2.0'
libmqttv3c.so: undefined reference to `signal@GLIBC_2.0'
libmqttv3c.so: undefined reference to `pthread_cond_timedwait@GLIBC_2.3.2'
libmqttv3c.so: undefined reference to `fopen@GLIBC_2.1'
libmqttv3c.so: undefined reference to `remove@GLIBC_2.0'
libmqttv3c.so: undefined reference to `connect@GLIBC_2.0'
libmqttv3c.so: undefined reference to `pthread_mutex_lock@GLIBC_2.0'
libmqttv3c.so: undefined reference to `socket@GLIBC_2.0'
libmqttv3c.so: undefined reference to `pthread_cond_signal@GLIBC_2.3.2'
libmqttv3c.so: undefined reference to `time@GLIBC_2.0'
libmqttv3c.so: undefined reference to `fprintf@GLIBC_2.0'
libmqttv3c.so: undefined reference to `pthread_mutex_destroy@GLIBC_2.0'
libmqttv3c.so: undefined reference to `atoi@GLIBC_2.0'
libmqttv3c.so: undefined reference to `strcpy@GLIBC_2.0'
libmqttv3c.so: undefined reference to `getpeername@GLIBC_2.0'
libmqttv3c.so: undefined reference to `opendir@GLIBC_2.0'
libmqttv3c.so: undefined reference to `sprintf@GLIBC_2.0'
libmqttv3c.so: undefined reference to `exit@GLIBC_2.0'
libmqttv3c.so: undefined reference to `snprintf@GLIBC_2.0'
libmqttv3c.so: undefined reference to `pthread_cond_init@GLIBC_2.3.2'
libmqttv3c.so: undefined reference to `pthread_mutex_unlock@GLIBC_2.0'
libmqttv3c.so: undefined reference to `gettimeofday@GLIBC_2.0'
libmqttv3c.so: undefined reference to `unlink@GLIBC_2.0'
libmqttv3c.so: undefined reference to `free@GLIBC_2.0'
libmqttv3c.so: undefined reference to `fclose@GLIBC_2.1'
collect2: ld returned 1 exit status
make: *** [all] 错误 1



查看了下arm-linux-gcc的信息 如下:

root@wing:~# arm-linux-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gcc
COLLECT_LTO_WRAPPER=/usr/arm-linux-gcc-4.5.1/bin/../libexec/gcc/arm-none-linux-gnueabi/4.5.1/lto-wrapper
Target: arm-none-linux-gnueabi
Configured with: /work/toolchain/build/src/gcc-4.5.1/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-none-linux-gnueabi --prefix=/opt/FriendlyARM/toolschain/4.5.1 --with-sysroot=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root --enable-languages=c,c++ --disable-multilib --with-cpu=arm1176jzf-s --with-tune=arm1176jzf-s --with-fpu=vfp --with-float=softfp --with-pkgversion=ctng-1.8.1-FA --with-bugurl=http://www.arm9.net/ --disable-sjlj-exceptions --enable-__cxa_atexit --disable-libmudflap --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-gmp=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-mpfr=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-ppl=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-cloog=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-mpc=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-libelf=/work/toolchain/build/arm-none-linux-gnueabi/build/static --enable-threads=posix --with-local-prefix=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root --disable-nls --enable-symvers=gnu --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.5.1 (ctng-1.8.1-FA)

不知道是不是因为友善之臂没有吧glibc库编译到gcc里面,
有没有哪位仁兄遇到过类似问题,或者知道原因的  希望共同探讨下
不胜感激!!!!!!!!
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2014-05-08 13:32
看起来友善之臂的工具链里的glibc只支持“GLIBC_2.4”到“GLIBC_2.11”, 这是“readelf -a /opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/lib/libc-2.11.so”的输出的一部分:


Version definition section '.gnu.version_d' contains 10 entries:
  Addr: 0x0000000000012890  Offset: 0x012890  Link: 4 (.dynstr)
  000000: Rev: 1  Flags: BASE   Index: 1  Cnt: 1  Name: libc.so.6
  0x001c: Rev: 1  Flags: none  Index: 2  Cnt: 1  Name: GLIBC_2.4
  0x0038: Rev: 1  Flags: none  Index: 3  Cnt: 2  Name: GLIBC_2.5
  0x0054: Parent 1: GLIBC_2.4
  0x005c: Rev: 1  Flags: none  Index: 4  Cnt: 2  Name: GLIBC_2.6
  0x0078: Parent 1: GLIBC_2.5
  0x0080: Rev: 1  Flags: none  Index: 5  Cnt: 2  Name: GLIBC_2.7
  0x009c: Parent 1: GLIBC_2.6
  0x00a4: Rev: 1  Flags: none  Index: 6  Cnt: 2  Name: GLIBC_2.8
  0x00c0: Parent 1: GLIBC_2.7
  0x00c8: Rev: 1  Flags: none  Index: 7  Cnt: 2  Name: GLIBC_2.9
  0x00e4: Parent 1: GLIBC_2.8
  0x00ec: Rev: 1  Flags: none  Index: 8  Cnt: 2  Name: GLIBC_2.10
  0x0108: Parent 1: GLIBC_2.9
  0x0110: Rev: 1  Flags: none  Index: 9  Cnt: 2  Name: GLIBC_2.11
  0x012c: Parent 1: GLIBC_2.10
  0x0134: Rev: 1  Flags: none  Index: 10  Cnt: 2  Name: GLIBC_PRIVATE
  0x0150: Parent 1: GLIBC_2.11


你能自己编译一个libmqttv3c.so吗?
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."