Errors building couchbase lite 2 for android


#1

I’m trying to apply a simple patch to Couchbase Lite 2 Android to allow execution of queries using JSON schema. I’m getting the following errors when trying to build it using jitpack.io or locally:

In file included from /home/jitpack/build/libs/couchbase-lite-core/LiteCore/Storage/SQLiteChooser.c:27:
  /home/jitpack/build/libs/couchbase-lite-core/LiteCore/Storage/../../vendor/SQLiteCpp/sqlite3/sqlite3.c:30886:43: error: address of overloaded function 'ioctl' is ambiguous
    { "ioctl",         (sqlite3_syscall_ptr)ioctl,          0 },
                                            ^~~~~
  /android/ndk-bundle/sysroot/usr/include/bits/ioctl.h:57:5: note: candidate function has different number of parameters (expected 0 but has 2)
  int ioctl(int __fd, unsigned __request, ...) __overloadable __enable_if(1, "") __RENAME(ioctl);
      ^
  /android/ndk-bundle/sysroot/usr/include/bits/ioctl.h:36:5: note: candidate function has different number of parameters (expected 0 but has 2)
  int ioctl(int __fd, int __request, ...);
      ^
  In file included from /home/jitpack/build/libs/couchbase-lite-core/LiteCore/Storage/SQLiteChooser.c:27:
  /home/jitpack/build/libs/couchbase-lite-core/LiteCore/Storage/../../vendor/SQLiteCpp/sqlite3/sqlite3.c:30886:22: error: initializer element is not a compile-time constant
    { "ioctl",         (sqlite3_syscall_ptr)ioctl,          0 },

The full log is available here https://jitpack.io/com/github/couchbase/couchbase-lite-android/2.0.2/build.log. I’m getting the same errors when I’m trying to build locally in Android Studio on Mac OS X. What can be a problem here?


#2

Check the READMEs of couchbase-lite-android and couchbase-lite-core to make sure you’re building with the right versions of the NDK, etc. It looks from the errors as though there’s some conflict with the system header ioctl.h