Conversation

The issue is almost certainly that the build system is supposed to be passing -D__ANDROID_API__=21 to communicate that minSdkVersion is 21 but it's passing something else instead. If you set it to that by hand, the problem would go away, but you should figure out what's wrong.
2
- The way CMake (our build system) does Android support is we feed it an android.toolchain.cmake from NDK_HOME and this sets all relevant variables. It doesn't appear to set __ANDROID_API__, nor does our CMakeLists.txt (CMake project config).
1
I cannot vouch for our current system as I did not design it. I maintained the prior build system, which had Gradle invoking CMake. The pure-CMake setup is new. It's possible Gradle read AndroidManifest.xml, saw the minSdkVersion there, and translated that into a CMake define...
1
If this is the case, then this simply means that our new non-Gradle setup would need to have the human specify those AndroidManifest.xml-related defines by hand. But I'm not clear who they should be defined to (to CMake? To toolchain.cmake? To clang?)
1
You definitely need -D__ANDROID_API__=21 in CPPFLAGS to match your minSdkVersion 21. It's broken overall, but you only happen to be seeing it when _FORTIFY_SOURCE is used because _FORTIFY_SOURCE will automatically use the new symbols introduced for newly fortified functions.
1
1
Since you have minSdkVersion 21, Android hides the symbols introduced after API 21 from your app in the linker and there's no fortified sendto available. However, your build system isn't setting __ANDROID_API__=21 so it's building code for the latest API level, probably API 30.
2