Message306432
When cross-compiling, the gcc and clang `--sysroot=` compiler option may be used to change the logical path of the system headers and libraries to a path located within the install path of the cross-compiler tool chain.
Android is a special case:
--------------------------
With Unified Headers [1], the most recent versions of the Android NDK add an additional constraint: the root paths of usr/include and usr/lib are distinct. For example when cross-compiling for API 24 and the x86_64 architecture the full paths are:
* headers: ANDROID_NDK_ROOT/sysroot/usr/include
* libraries: ANDROID_NDK_ROOT/platforms/android-24/arch-x86_64/usr/lib64
To use sysroot in this example one needs to set sysroot to ANDROID_NDK_ROOT/sysroot in CFLAGS or CPPFLAGS and to set sysroot to ANDROID_NDK_ROOT/platforms/android-24/arch-x86_64 in LDFLAGS, while on a standard platform where the root path of usr/include and usr/lib is common, one would only need to set sysroot to this root path in CFLAGS.
[1] https://android.googlesource.com/platform/ndk.git/+/master/docs/UnifiedHeaders.md |
|
Date |
User |
Action |
Args |
2017-11-17 11:19:21 | xdegaye | set | recipients:
+ xdegaye, Alex.Willmer |
2017-11-17 11:19:21 | xdegaye | set | messageid: <1510917561.84.0.213398074469.issue32059@psf.upfronthosting.co.za> |
2017-11-17 11:19:21 | xdegaye | link | issue32059 messages |
2017-11-17 11:19:21 | xdegaye | create | |
|