Code Monkey home page Code Monkey logo

Comments (7)

mosra avatar mosra commented on August 26, 2024

Hi!

I am surprised that for a project supporting android, there is only one bug filed in this project against android.

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 make VERBOSE=1 and post the full command-line so I can see what exactly it does in your case? In my case it looks like this (with the required include path highlighted):

/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android --gcc-toolchain=/opt/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 --sysroot=/opt/android-ndk/sysroot -I../src -Isrc -isystem /opt/android-ndk/sources/cxx-stl/llvm-libc++/include -isystem /opt/android-ndk/sources/android/support/include -isystem /opt/android-ndk/sources/cxx-stl/llvm-libc++abi/include -isystem /opt/android-ndk/sysroot/usr/include -isystem /opt/android-ndk/sysroot/usr/include/aarch64-linux-android -funwind-tables -no-canonical-prefixes -D__ANDROID_API__=22 -fexceptions -frtti -O3 -DNDEBUG -fPIC -std=c++11 -Wall -Wextra -Wold-style-cast -Winit-self -Werror=return-type -Wmissing-declarations -Wpedantic -fvisibility=hidden -fvisibility-inlines-hidden -Wmissing-prototypes -Wno-shorten-64-to-32 -MD -MT src/Corrade/Utility/CMakeFiles/CorradeUtilityObjects.dir/Directory.cpp.o -MF src/Corrade/Utility/CMakeFiles/CorradeUtilityObjects.dir/Directory.cpp.o.d -o src/Corrade/Utility/CMakeFiles/CorradeUtilityObjects.dir/Directory.cpp.o -c ../src/Corrade/Utility/Directory.cpp

from corrade.

truedat101 avatar truedat101 commented on August 26, 2024

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.

from corrade.

mosra avatar mosra commented on August 26, 2024

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 :)

from corrade.

truedat101 avatar truedat101 commented on August 26, 2024

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?

from corrade.

mosra avatar mosra commented on August 26, 2024

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 (CMAKE_TOOLCHAIN_FILE at least) and then repeat that while building on the command line. What I'm doing when interfacing with Gradle is building all dependencies using new CMake (3.9+), installing those somewhere, and only using the bundled old cmake when I really need to build the final APK using Gradle.

Alternatively, you could go the CMake Subproject way -- add_subdirectory(corrade) etc. from your final project, and build everything from within Gradle, without doing separate installs. Basically what magnum's Getting Started Guide suggests, only adapted for Android -- that way, if the stars align correctly, Gradle's builtin cmake support might "just work" and build everything in one go. That could be also "customer friendly" enough :)

from corrade.

truedat101 avatar truedat101 commented on August 26, 2024

Thanks, I'll try to go though that set up later this week .

from corrade.

mosra avatar mosra commented on August 26, 2024

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.

from corrade.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.