Important: Please read the Qt Code of Conduct -

Android app compilation on MAC - Wrong toolchain ?

  • Hello All! I feel like my question might be silly but so far I reached the limits of my knowledge for the Build Environments.

    I've got Mac with Android Studio, SDK, and NDK installed. Just trying to test simple examples (btchat)
    Building the desktop app works flawlessly, but when trying to compile the Android ARM or x86 App, I get such messages:

        /bin/sh: /Users/drob/Library/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/darwin-x86_64/bin/i686-linux-android-g++: No such file or directory
        /bin/sh: /Users/drob/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++: No such file or directory
        /bin/sh: /Users/drob/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++: No such file or directory
        Project ERROR: Cannot run target compiler '/Users/drob/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++'. Output:
        /bin/sh: /Users/drob/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++: No such file or directory
        Maybe you forgot to setup the environment?
        Error while parsing file /Users/drob/OneDrive/DEVEL/PROJECTS/QT_Projects/btchat/ Giving up.

    I also got this message in the Issues tab of QT Creator:

    :-1: warning: "/Applications/" is used by qmake, but "/Users/drob/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++" is configured in the kit.
    Please update your kit (Android for x86 (Clang Qt 5.9.9 for Android x86)) or choose a mkspec for qmake that matches your target environment better.

    I feel like the Toolchain / Build environment is not configured right, but how to fix this appropriately?
    I also have XCode installed, and I read that QT might use its Clang from XCode? But how di I tell QT to do so?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What version of Qt are you using ?
    What version of the NDK ?
    What SDK ?

  • You can't use the latest NDK with Qt. For Qt 5.9 you should use NDK version r10e.

  • Guys, thanks a lot for your answers! Due to some reason, I completely missed the "Android Getting Started" mentioned by @Leonardo.
    So according to this manual, I've reinstalled all of the components dozen of times, but so far still no luck. But I feel like now I am at least more clear in my understanding of how things work.
    Previously I had some incompatible combination of SDK's and NDK's and QT's, so today here is what I have:

    • SDK versions are 25 and 26 (25 should be working even with older QT)
    • SDK Build-tools,
    • QT version 5.9.9
    • NDK version r10e

    Today I ended up with the following stage - I have set Android JDK, SDK, and NDK in the Settings/Device/Android, but I do not have auto-added Kits for Android (the option for Automatically creating Kits is checked in Android Device). I still do not have Android compilers on the list whatever I am trying to do.

    I suppose the main question is - how to add the Compiler/Toolchain to QT ? Or how to let QT know that the Compiler is present?
    And other questions - which package of SDK actually contains the Compiler? (I suppose by name it is SDK Build Tools?)
    How do I make clean PERFECT install from the scratch? I removed QT once, and reinstalled it, but I see that it still holds my settings.

    I suppose I should:

    • Remove Android Studio (I heard rumors that SDK installed by Studio is not the "right one for QT")
    • Wipe manually the SDK directory
    • Install SDK Manager manually, and then using it, add SDK version 25 and SDK build tools?
    • Install NDK r10e
    • Add all of these to QT Creator
    • Anything else critical that I miss?

  • The compiler is part of NDK. In my experience, sometimes Qt Creator's settings get messed up and fail to detect the compiler. Usually I delete its settings folder to have a fresh start. On Linux it can be found at ~/.config/QtProject. I don't know on macOS.

  • I did the full reinstall of QT again with clearing all the settings. Once again completely reinstalled SDK 24 (I found the old google package which have GUI sdkmanager ) and NDK r10e.
    QT Creator does not see the Toolchains / Compilers despite they are clearly in the Toolchains folder of NDK and does not create Compilers... I am afraid I gave up, and will take the next Windows PC for my further experiments....

    P.S. Or do you think it is worth trying to create Kits/Toolchains manually?

  • I managed to fix the problems by installing QT 5.12 instead of 5.9, and latest NDK "side by side" instead of recommended NDK.
    Despite this is the official way - NDK r10e and/or QT 5.9 does not work whatever I did.

Log in to reply