-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android Cmake cross compile build CI instructions don't build #84
Comments
Hi!
You mean this one, right? mosra/magnum#310 What's your CMake version? I didn't have a chance to test with 3.16 yet, so there's a possibility they broke something while attempting to fix everything else. The NDK sysroot should be added to the include path by CMake and that's what the code relies on, I'm not doing anything extra to get that include. Can you run with
|
Ha, yes, every project I've seen that aims to support multiple platforms always seems to have to dedicate a lot of resources fixing things related the evolution of Android builds, and the people who try to build them. And yes, there's this confusing aspect of Android Studio, in the SDK Manager pane for tools where it lists two different cmakes, one with a version (3.4 old stuff) and a newer one (3.6 or something but it isn't marked). That might be part of the issue, just discovered that looking at a different build I am working on. As far as the NDK being picked up the by the include path, I see a point on the travis ci page that you have CMAKE_PREFIX_PATH= . Should I point this to the location where my NDK is installed? I am having trouble understanding how it is picking up the NDK from the install path, other than there being an ndk-build in my PATH. |
Oh, I think I know where this comes from, then (and the 100-page long Android troubleshooting guide doesn't mention it early enough for some reason -- sorry. Going to update that.). CMake has builtin Android support since 3.7 (but ideally the newer versions, 3.9 and up), if you're using the vintage ones that are bundled with Android Studio, those won't work -- CMake will ignore all the options passed and then die on the missing include. With 3.6 and below it needs to use some toolchain from hell that's bundled inside the NDK and to be frank I never even tried to use that one (instead made my own, and then scrapped it once CMake's builtin support appeared). I also never used Android Studio so I don't know how hard it is to convince it to use system CMake instead of the bundled one -- probably easiest to build it completely outside via the command line? Hope this helps, and sorry for the pain :) |
Gah , android tool chain .... Thanks for the response. So I'm clear, should I not use the one bundled in Android stuidio? I hate using studio but customers use it so I have to provide things that work with it. As far as the bundled cmake, It's old for sure, clocked at cmake 3.6.x.? So should I just be using whatever latest and greatest cmake 3.16.x version is available? |
I can confirm anything between 3.9.2 and 3.15 works, didn't have a chance to test with 3.16 yet but I assume it would work too. With the bundled 3.6 it should work in some way also but you'd need to figure out what all magic spells Gradle is passing to it to make it work ( Alternatively, you could go the CMake Subproject way -- |
Thanks, I'll try to go though that set up later this week . |
Things seem to work well again with NDK r19+ and CMake 3.16+ (and a bunch of extra things to help CMake find libraries), see mosra/magnum@8bc1fa1 for updated instructions. |
I've attempted to follow docs here: https://doc.magnum.graphics/magnum/platforms-android.html
and also here: https://doc.magnum.graphics/corrade/building-corrade.html#building-corrade-cross-android
I've set a variable for ANDROID_NDK_HOME to point to my ndk, and set paths for tools needed like the cmake included in the SDK. In the case of the Android CI instructions, there is a nice description of grabbing the NDKr16b, unzipping it, and a simple cmake command, cmake .. -DCMAKE_ANDROID_NDK=$ANDROID_NDK_HOME -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=22 -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_static -DCMAKE_BUILD_TYPE=Release
That configures nicely. When I build, I get an error right away when compiling Directory.cpp:
Scanning dependencies of target CorradeUtilityObjects
[ 3%] Building CXX object src/Corrade/Utility/CMakeFiles/CorradeUtilityObjects.dir/Debug.cpp.o
[ 6%] Building CXX object src/Corrade/Utility/CMakeFiles/CorradeUtilityObjects.dir/Directory.cpp.o
corrade.git/src/Corrade/Utility/Directory.cpp:50:31: fatal error: android/api-level.h: No such file or directory
The build is unable to find the path to the platform version headers, which are most definitely present in the NDK.
I'm looking for some pointers on what configure step I am missing. I am fairly competent with the NDK, although the integration with cmake has changed a bit over the years and I am no expert. Also, I am surprised that for a project supporting android, there is only one bug filed in this project against android. Any help would be appreciated so I can complete evaluation of this project.
The text was updated successfully, but these errors were encountered: