Skip to content

Building libbladeRF for Android

Jon Szymaniak edited this page Aug 4, 2015 · 5 revisions

This page serves as a place to document notes and developments in building libbladeRF for Android, which has spun off from discussions in issue #386. It is expected that notes documented here will yield fine-grained tasks and patches that may be submitted to the issue tracker.

Android NDK

The preferred approach for libbladeRF support on Android is via the Android NDK. We would rathermaintain a single codebase that is portable, rather than introduce a Java reimplementation.

Toolchain files and build scripts

Below is a list of some reference CMake toolchain setups and build scripts

pthread_cancel()

pthread_cancel() does not exist in Android. This is used in the libbladeRF code base as a "last ditch effort" if an attempt to join a thread times out. We will need to be able to remove this at compile time. One approach will be to add a BLADERF_OS_ANDROID definition and add the following to thread.h:

#ifdef BLADERF_OS_ANDROID
#    define THREAD_CANCEL(thread) do {} while (0)
#else
#    define THREAD_CANCEL(thread) pthread_cancel(thread)
#endif