The build system needs to be setting the minimum API level so that the code isn't built to use symbols introduced in newer versions. I don't think this actually has to do with that old minor SDK issue but rather this is the canary in the coal mine breaking from having that issue.
Conversation
I'm upgrading NDK-- if it's ok I'd like to check back if I upgrade and it's still not working. (It is *super* interesting to me tho this problem was not present when I was building the project as Gradle invoking CMake, but when I build the project with pure CMake it appears!)
1
Make sure the build system is setting __ANDROID_API__ to your minSdkVersion i.e. -D__ANDROID_API__=21 for how you have it set up. I think that's probably your actual problem rather than an SDK / NDK bug now that I actually think about it more.
1
See developer.android.com/ndk/guides/sdk for more details. Maybe the build system is broken and setting __ANDROID_API__ to targetSdkVersion instead of minSdkVersion? That would cause it to use fortified sendto (API >= 26) but then at runtime the linker isn't going to make it available.
1
I think that's the actual problem and that actually entirely makes sense as an explanation. I can't really see how the problem could be anything else other than that, actually.
1
That makes sense, but that wouldn't explain why add_subdirectory was "passing" the correct variables when invoking add_subdirectory on ode (so appears to have loaded without problems) but not when invoking add_subdirectory on puredata (so having problems).
1
It could be there is some sort of bug in CMake. Android Studio offers no cmake more recent than 3.10.2.4988404.
Do -Wno-unused-volatile-lvalue -Wno-array-bounds -Wno-undefined-var-template sound relevant? ODE was built with those.
1
Actually, ignore my thought about cmake-- I think I'm using host system CMake not Android SDK CMake. THough that in itself could have interesting effects.
1
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
I only really deal with the proper Android build system used by AOSP. I don't have to deal with all the broken external stuff for app developers. I have no clue how to use gradle, CMake, etc. and it's super painful when I try to deal with those. So, can't really help with that.
1
This is the only way I know how to build native code for Android:
github.com/GrapheneOS/har
I don't really understand why app devs have to deal with horrible external build systems. I have no clue why the Android SDK people chose gradle. Android itself doesn't use that nonsense.

