Compiling on Android using ndk-r15 or higher

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Description
Building using ndk-r15 will result in a build failure:
./os/os-android.h:87:7: error: redefinition of 'key' with a different type: 'char [11]' vs 'key_t' (aka 'int’)

Environment
Targeting Android API level 21 for arm-linux-androideabi with a standalone toolchain from ndk-r14 with a patched <sys/ipc.h> (backported from  ndk-r15).

Version
fio-2.19

Reproduction
Compile for Android using ndk-r15 or higher (or at least a patched <sys/ipc.h>).

More Information
Bionic in Android ndk-r15 makes changes to <sys/ipc.h> to work around inconsistencies between glibc and kernel declarations in struct ipc64_perm. See https://sourceforge.net/p/strace/mailman/message/35628355/ for more information on why the change was necessary.
<sys/ipc.h> now defines __key as key and __seq as seq
In os/os-android.h, shmget is declared as: static inline int shmget (key_t __key, size_t __size, int __shmflg)
Inside the function the variable char key[11] is declared.
With the new definitions in <sys/ipc.h>, the __key parameter and the key variable conflict (as __key is replaced by key).
The fix is simply renaming key to some other name.
I haven’t formally tested using ndk-r15 as it is still in beta, but I am using the same fix for <sys/ipc.h>. See https://android.googlesource.com/platform/bionic/+/a29821bb455e6c23b2c9fe13bf1436610c4eb412%5E%21/#F0 for the patch to Bionic.--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux