linux交叉编译aix_请教arm-linux-gcc交叉编译的一个 错误

在使用arm-linux-gcc编译蓝牙程序时遇到错误,包括'PF_BLUETOOTH'和'AF_BLUETOOTH'重新定义的警告以及多个未定义的引用到GLIBC_2.3.4的函数。尝试了安装libglib2.0-0_2.12.4-2_arm库但问题未解决。问题可能涉及libbluetooth是否使用正确交叉编译器编译,以及蓝牙程序与libbluetooth的匹配性。解决方法包括确保库与编译器兼容,并正确使用链接选项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

用arm-linux-gcc编译蓝牙程序时出现了如下错误,已经将libbluetooth这个库放到/usr/local/arm/3.4.1/arm-linux/lib中,

In file included from /usr/include/sys/socket.h:36,

from /usr/include/bluetooth/rfcomm.h:32,

from obex.c:6:

/usr/include/bits/socket.h:92:1: warning: "PF_BLUETOOTH" redefined

In file included from obex.c:5:

/usr/include/bluetooth/bluetooth.h:41:1: warning: this is the location of the previous definition

In file included from /usr/include/sys/socket.h:36,

from /usr/include/bluetooth/rfcomm.h:32,

from obex.c:6:

/usr/include/bits/socket.h:126:1: warning: "AF_BLUETOOTH" redefined

In file included from obex.c:5:

/usr/include/bluetooth/bluetooth.h:40:1: warning: this is the location of the previous definition

/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/lib/libbluetooth.so: undefined reference to `__memcpy_chk@GLIBC_2.3.4'

/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/lib/libopenobex.so: undefined reference to `__strcpy_chk@GLIBC_2.3.4'

/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/lib/libbluetooth.so: undefined reference to `__vfprintf_chk@GLIBC_2.3.4'

/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/lib/libopenobex.so: undefined reference to `__fprintf_chk@GLIBC_2.3.4'

/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/lib/libbluetooth.so: undefined reference to `__strncat_chk@GLIBC_2.3.4'

/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/lib/libbluetooth.so: undefined reference to `__vprintf_chk@GLIBC_2.3.4'

/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/lib/libbluetooth.so: undefined reference to `__snprintf_chk@GLIBC_2.3.4'

/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/lib/libbluetooth.so: undefined reference to `__vsnprintf_chk@GLIBC_2.3.4'

/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/lib/libbluetooth.so: undefined reference to `__printf_chk@GLIBC_2.3.4'

/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/lib/libbluetooth.so: undefined reference to `__sprintf_chk@GLIBC_2.3.4'

collect2: ld returned 1 exit status

请高手们指教怎么解决上面的错误,安装了libglib2.0-0_2.12.4-2_arm这个库也没有解决问题。

|

checkpoint:

1)libbluetooth 使用该交叉编译器编译的吗?

2)你的蓝牙程序跟这个libbluetooth是匹配的吗,也就是说使用这个库的API进行编程的吗?

BTW,不需要把libbluetooth库放到交叉编译器的 那个lib目录下,

对于库的链接,Linux有它的方法:

-L -lbluetooth

就是找此目录下的libbluetooth.so或者libbluetooth.a去链接

|

库应该要用交叉编译工具编译

|

makefile

|

up 2 楼

遇到过一次

使用不同的编译器编译应用程序和库会造成这个问题

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值