0

In order to run the bluetooth C program on my ubuntu desktop I installed the libbluetooth-dev using

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

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

But seems like it didn't give a solution, I am still confused how to install the libbluetooth-dev support for the cross compiler.

Community
  • 1
  • 1
xl46
  • 23
  • 4
  • The answer does in fact give a solution. You should look at it again and read it more carefully. – Ken White Mar 27 '17 at 02:33
  • Possible duplicate of [Bluetooth programming in Linux - cross compiler issue](http://stackoverflow.com/questions/36736362/bluetooth-programming-in-linux-cross-compiler-issue) – too honest for this site Mar 27 '17 at 03:34
  • Probably your toolchain doesn't shipped with bluetooth development library. So you need to cross compile BlueZ first (with dependency) and cross compile with according sysroot. – Parthiban Mar 27 '17 at 11:52
  • Try compiling BlueZ for android. URL from google, http://wiki.beyondlogic.org/index.php?title=Cross_Compiling_BlueZ_Bluetooth_tools_for_ARM – Parthiban Mar 27 '17 at 11:54

1 Answers1

0

You cannot link the libbluetooth library that was compiled for a different architecture. You need to build the libbluetooth library for the architecture your application will be build for.