SQLite Android Bindings
View Ticket
Not logged in
Ticket UUID: 28d442a2c39bd54683a6ff74467336939e305a7e
Title: Build error when SQLITE_ENABLE_BATCH_ATOMIC_WRITE is set because of ambiguous cast
Status: Open Type: Code_Defect
Severity: Severe Priority:
Subsystem: Resolution:
Last Modified: 2018-09-05 12:50:23
Version Found In: latest
User Comments:
anonymous added on 2018-09-05 12:50:23: (text/x-fossil-plain)
Before Android NDK r17, there was only one ioctl() function defined.
    int ioctl(int __fd, int __request, ...);

However, since Android NDK r17, another one has been added:
    int ioctl(int __fd, unsigned __request, ...)


When compiling SQLite with SQLITE_ENABLE_BATCH_ATOMIC_WRITE this will produce a build error since clang does not know which ioctl() function to cast, since sqlite2_syscall_ptr is defined as:
    typedef void (*sqlite3_syscall_ptr)(void);


====
[x86_64] Compile        : sqliteX <= sqlite3.c
  /home/mathieu/Documents/Sources/Temp/SQlite/sqlite/sqlite3/src/main/jni/sqlite/sqlite3.c:32184:43: error: address of overloaded function 'ioctl' is ambiguous
    { "ioctl",         (sqlite3_syscall_ptr)ioctl,          0 },
                                            ^~~~~
  /home/mathieu/Android/NDK/android-ndk-r17b/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);
      ^
  /home/mathieu/Android/NDK/android-ndk-r17b/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, ...);
      ^
  /home/mathieu/Documents/Sources/Temp/SQlite/sqlite/sqlite3/src/main/jni/sqlite/sqlite3.c:32184:22: error: initializer element is not a compile-time constant
    { "ioctl",         (sqlite3_syscall_ptr)ioctl,          0 },
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
  2 errors generated.
  make: *** [/home/mathieu/Documents/Sources/Temp/SQlite/sqlite/sqlite3/build/intermediates/ndkBuild/release/obj/local/x86_64/objs/sqliteX/sqlite3.o] Error 1
====