Modern Android Flags

GitHub action builds of packages depending on swift-cmark began failing at some point between Sept. 23 and Sept. 27, where there is absolutely no difference between the commits, and no change of any explicitly downloaded components (Swift toolchain, Android SDK, etc.) GitHub’s host must have changed something, and I presume that would be the NDK. Looking at the NDK revision notes makes it seem that it has been rearranged and the flags I am using are now out of date. This is what worked before:

But I have thus far been unable to translate that for more recent NDK releases. Everything I try results in more headers not being found, and due to complications with #include_next, it seems not just the paths, but the order is very important.

Do any Android enthusiasts around here know what the proper import sequence and flags are?

Or maybe it has something to do with Clang/LLVM 10, which was changed on Sept. 23? The NDK does not appear to have been changed recently and even manually downloading older NDKs to use instead does not fix it. But doesn’t the Swift toolchain contain its own instance of Clang?

I finally solved it by making SwiftPM build C targets with the same clang as swiftc’s -tools-directory:

export CC=${ANDROID_HOME}/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
1 Like