Bluetooth Cross-compile problem
yi_jun_mail at yahoo.com
Mon Sep 8 05:58:09 CEST 2008
I had a compilation problem with my bluetooth application. In my source code bluez.c, function hci_get_route, hic_open_dev, etc., are called. I already installed the bluetooth stack to the toolchain. I check that /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib has the libbluetooth static and shared objects, and /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include has all the required header files, such as hci.h, hci_lib.h, bluetooth.h. By the way, I already add "-lbluetooth" to the projectdir/src/Makefile.am" (openmoko_sample_LDADD = @DEPENDENCIES_LIBS@ -lbluetooth). om-config runs well, and I check the resulted projectdir/src/Makefile, the bluetooth library is already added into this file (openmoko_sample_LDADD = -lmokoui2 -lgtk-x11-2.0 -lgdk-x11-2.0 ..... -lbluetooth)
However, when I run "make" command under the projectdir. I run into some errors (link errors), the compilation is correct since I saw the corresponding object (bluez.o) file is generated, and I use "nm bluez.o" to check the external symbols, and find those called functions are there. By the way, "nm libbluetooth.so" lists those functions as well.
The error prompts is like:
bluez.o: in function main:
bluez.c: (.text+0x3c): undefined reference to "hci_open_dev"
bluez.c: (.text+0x3c): undefined reference to "hci_get_route"
My phone is the newest GAT02. I checked LDFLAGS environment variable does not include /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib, only include /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/lib, but when I add /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib into the LDFLAGS, and re-run om-config,...., I still got the same error.
Another question, gtk-x11-2.0 is under the /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib, LDFLAGS only includes /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/lib, but I can successfully build a GUI program and run at the phone. Why that happen? Is that (/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib) the default library search path for the toolchain?
Very much appreciate your help
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the community