5. At this point the linker , actually cross linker , references to anything "bluetooth" such as "-lbluethooth" or "-libbluetooth" yields " not found " cross linker error.
There's the problem. On your X86_64 box, you've installed bluez-X86_64. The linker will not link an X86_64 lib into an ARM target. Your X86_64 linux distribution may provide a libbluetooth-devel-arm package that will work with the cross compiler, but I doubt that.
I've just been poking about on my rpi-2 (raspian-debian jessie), and I think the following might work for you. Note that if you're on a pi3 or using something other jessie, things will be slightly different.
on the pi:
sudo apt-get install -d libbluetooth-dev
-d flag downloads the package and puts it in /var/cache/apt/archives/, but doesn't actually install it. I see there's a lot of files there, so it might be worth checking to see if you've already got the package there already. On my system its libbluetooth-dev_5.23-2+rpi2_armhf.deb, so I expect yours will be similar.
on the X86_64, we'll assume that you've got a $HOME/tmp that you will use for copying and you will put the package contents in $HOME/rpi. Vary as necessary in the following:
dpkg -x $HOME/tmp/libbluetooth-dev_5.23-2+rpi2_armhf.deb
This will unpack the contents of the libbluetooth-dev package in the current directory. You should now have
usr/include, usr/lib and
usr/share in the $HOME/rpi directory, and you can now remove $HOME/tmp/libbluetooth-dev_5.23-2+rpi2_armhf.deb file. If you check your $HOME/rpi/lib/arm-linux-gnueabihf directory, you will probably find a broken link for libbluetooth.so. If you're happy just using the static linked .a library, you can delete the broken link. If you'd like to use the shared library, then scp /usr/lib/arm-linux-gnueabihf/libbluetooth.so.3.17.1 from the pi to $HOME/pi/lib/arm-linux-gnueabeihf (once again things may be different if you're on a different OS version than me).
Now add flags for
-I $HOME/rpi/usr/include and
-L$HOME/rpi/usr/lib/arm-linux-gnueabihf -lbluetooth to your IDE. (check the last part of the -L path if not on jessie). This way, at least, you have the same includes and libs available to your cross compiler as you have on the pi, but you'll have to remember to update the X86_64 if you update the bluetooth package on the pi.
Now, I haven't tried this, beyond unpacking the pi package (on the pi...) so it might not work, but I think it should. If there are any dependencies that libbluetooth-dev has that are needed, you'll need to repeat this process with them, too.
If this doesn't work, you may have to use the crosscompiler to build libbluetooth (and any of its dependencies).
I have had a chance to try this out, and can confirm it should work. Not knowing where to start with libbluetooth, I wrote a short ncurses program which I was able to cross-compile using the technique above and run on my rpi. I did run into an issue where libncurses has a dependency on libtinfo, so I had to track that down and add it to my $HOME/rpi, so you may have to do the same with any dependencies libbluetooth might have.
modified 5-Mar-19 20:22pm.