Building shared libraries for Bluetooth support

376 views
Skip to first unread message

mattFrazer

unread,
Oct 19, 2010, 7:24:06 PM10/19/10
to android-ndk
I am currently working on a project which will provide L2CAP
communication with a Bluetooth accessory. Unfortunately, the shared
library will not build:

matt@Ubuntu:~/src/android-ndk-r4b$ make APP=List2
Android NDK: Building for application 'List2'
Compile++ thumb: getList <= /home/matt/src/android-ndk-r4b/sources/
List2/jni/list2.cpp
SharedLibrary : libgetList.so
/home/matt/src/android-ndk-r4b/build/prebuilt/linux-x86/arm-eabi-4.4.0/
bin/../lib/gcc/arm-eabi/4.4.0/../../../../arm-eabi/bin/ld: cannot find
-lbluetooth
collect2: ld returned 1 exit status
make: *** [out/apps/List2/armeabi/libgetList.so] Error 1

Apparently, something (forgive my ignorance here, I'm quite new to the
ndk) cannot find -lbluetooth. I assume this is the same -lbluetooth i
specified in my android.mk file:

LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -lbluetooth

How, exactly, is this error coming about, and what can be done to
remedy it?

Thanks,
Matt

Christian Linne

unread,
Oct 20, 2010, 9:09:02 AM10/20/10
to andro...@googlegroups.com
'libbluetooth' isn't in the NDK, and yours will probably not match the requirements for ARM. Besides, directly accessing bluetooth from the native layer is not supported yet, and will not be in the near future.
(Several problems according to bluetooth do exist, i.e. different BlueZ-Versions, or even something instead of it - that's one issue occuring on customizable OS-builds.)

2010/10/20 mattFrazer <frazer....@gmail.com>

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.




--
_________
Mit freundlichen Grüßen
Yours sincerely

Christian Linne

Mail (private): linn...@aol.com
Mail (official): Christi...@googlemail.com,
ICQ: 293253013

David Turner

unread,
Oct 20, 2010, 10:08:06 PM10/20/10
to andro...@googlegroups.com
On Wed, Oct 20, 2010 at 6:09 AM, Christian Linne <christi...@googlemail.com> wrote:
'libbluetooth' isn't in the NDK, and yours will probably not match the requirements for ARM. Besides, directly accessing bluetooth from the native layer is not supported yet, and will not be in the near future.
(Several problems according to bluetooth do exist, i.e. different BlueZ-Versions, or even something instead of it - that's one issue occuring on customizable OS-builds.)

I confirm that several, incompatible, versions of BlueZ are being used on Android. We also have seen OEMs use a completely different, proprietary stack, in their Android implementation.

Don't expect this to be exposed directly in the NDK anytime soon :-/

Angus Lees

unread,
Oct 20, 2010, 11:45:33 PM10/20/10
to andro...@googlegroups.com
On Thu, Oct 21, 2010 at 13:08, David Turner <di...@android.com> wrote:
>
>
> On Wed, Oct 20, 2010 at 6:09 AM, Christian Linne
> <christi...@googlemail.com> wrote:
>>
>> 'libbluetooth' isn't in the NDK, and yours will probably not match the
>> requirements for ARM. Besides, directly accessing bluetooth from the native
>> layer is not supported yet, and will not be in the near future.
>> (Several problems according to bluetooth do exist, i.e. different
>> BlueZ-Versions, or even something instead of it - that's one issue occuring
>> on customizable OS-builds.)
>>
> I confirm that several, incompatible, versions of BlueZ are being used on
> Android. We also have seen OEMs use a completely different, proprietary
> stack, in their Android implementation.
> Don't expect this to be exposed directly in the NDK anytime soon :-/

Is it possible (in the future) to get a FileDescriptor object (and
hence a native fd) from BluetoothSockets, or is even that going to be
impossible to implement on the different stacks?
(It's a feature request I've been meaning to file for a while now)

- Gus

David Turner

unread,
Oct 23, 2010, 5:16:32 PM10/23/10
to andro...@googlegroups.com
On Wed, Oct 20, 2010 at 8:45 PM, Angus Lees <g...@inodes.org> wrote:
On Thu, Oct 21, 2010 at 13:08, David Turner <di...@android.com> wrote:
>
>
> On Wed, Oct 20, 2010 at 6:09 AM, Christian Linne
> <christi...@googlemail.com> wrote:
>>
>> 'libbluetooth' isn't in the NDK, and yours will probably not match the
>> requirements for ARM. Besides, directly accessing bluetooth from the native
>> layer is not supported yet, and will not be in the near future.
>> (Several problems according to bluetooth do exist, i.e. different
>> BlueZ-Versions, or even something instead of it - that's one issue occuring
>> on customizable OS-builds.)
>>
> I confirm that several, incompatible, versions of BlueZ are being used on
> Android. We also have seen OEMs use a completely different, proprietary
> stack, in their Android implementation.
> Don't expect this to be exposed directly in the NDK anytime soon :-/

Is it possible (in the future) to get a FileDescriptor object (and
hence a native fd) from BluetoothSockets, or is even that going to be
impossible to implement on the different stacks?
(It's a feature request I've been meaning to file for a while now)

I have no idea. I guess that if there is a Java API to do that, then it's only a JNI call away from your native code, but that's really not my area of expertise. You may ask on android-developer about this.
Reply all
Reply to author
Forward
0 new messages