[英]cross compile bluetooth C program(blueZ) for Android
In order to run the bluetooth C program on my ubuntu desktop I installed the libbluetooth-dev
using为了在我的 ubuntu 桌面上运行蓝牙 C 程序,我使用以下libbluetooth-dev
安装了libbluetooth-dev
sudo apt-get install libbluetooth-dev
Then I compiled the code with然后我编译了代码
gcc -o simplescan simplescan.c -lbluetooth
and it executed just fine.它执行得很好。 However when I tried to cross compiled it for Android using但是,当我尝试使用它为 Android 交叉编译它时
arm-linux-gnueabi-gcc -o simplescan simplescan.c -lbluetooth
It gave me the error它给了我错误
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: cannot find -lbluetooth
collect2: error: ld returned 1 exit status
I noticed there was similar post here: Bluetooth programming in Linux - cross compiler issue我注意到这里有类似的帖子: Linux 中的蓝牙编程 - 交叉编译器问题
But seems like it didn't give a solution, I am still confused how to install the libbluetooth-dev
support for the cross compiler.但似乎它没有给出解决方案,我仍然很困惑如何为交叉编译器安装libbluetooth-dev
支持。
You cannot link the libbluetooth library that was compiled for a different architecture.您不能链接为不同架构编译的 libbluetooth 库。 You need to build the libbluetooth library for the architecture your application will be build for.您需要为您的应用程序将为其构建的架构构建 libbluetooth 库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.