Author xdegaye
Recipients Alex.Willmer, xdegaye
Date 2017-11-17.11:19:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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.

Date User Action Args
2017-11-17 11:19:21xdegayesetrecipients: + xdegaye, Alex.Willmer
2017-11-17 11:19:21xdegayesetmessageid: <>
2017-11-17 11:19:21xdegayelinkissue32059 messages
2017-11-17 11:19:21xdegayecreate