Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: CMake android build errors  (Read 2185 times)

0 Members and 1 Guest are viewing this topic.

stav

  • Newbie
  • *
  • Posts: 10
    • View Profile
CMake android build errors
« on: March 21, 2019, 03:46:02 pm »
Hi guys
im trying to build sfml libraries for the android platform from my linux machine.

I've got everyting installed: cmake, android ndk, make, gcc, and all of SFML's dependencies.

However when i invoke cmake with the following command:
Code: [Select]
cmake -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=/home/stav/Android/Sdk/ndk-bundle -DCMAKE_ANDROID_ARCH_ABI=x86-64 ..

I get this error:
Code: [Select]
CMake Error at /usr/share/cmake-3.12/Modules/Platform/Android-Determine.cmake:243 (message):
  Android: Unknown ABI CMAKE_ANDROID_ARCH_ABI='x86-64'.
Call Stack (most recent call first):
  /usr/share/cmake-3.12/Modules/CMakeDetermineSystem.cmake:130 (include)
  CMakeLists.txt:45 (project)


CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!


I initially thought it was because i didn't have the x86-64 abi installed or something
However if i change the x86-64 to any other arch (x86 in this example) i get this error:
Code: [Select]
Android: No toolchain for ABI 'x86' found in the NDK:

Also when i look under {NDK}/platform/android-xx/ i do have a folder called arch-x86 and one called arch-x86-64

Is anyone else having trouble with generating the build system for android?
Can someone please help me?
« Last Edit: March 22, 2019, 04:32:18 pm by stav »

Jonny

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Email
Re: CMake android build errors
« Reply #1 on: March 22, 2019, 07:18:59 pm »
I beleive you're looking for x86_64 (_ instead of -)

stav

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: CMake android build errors
« Reply #2 on: March 22, 2019, 09:34:36 pm »
Ah yes thank you i didn't notice that.
This explains the first error but im still getting the "no toolchain found" error:
Code: [Select]
-- Android: Targeting API '28' with architecture 'x86_64', ABI 'x86_64', and processor 'x86_64'
CMake Error at /usr/share/cmake-3.12/Modules/Platform/Android/Determine-Compiler-NDK.cmake:97 (message):
  Android: No toolchain for ABI 'x86_64' found in the NDK:

    /home/stav/Android/Sdk/ndk-bundle

Call Stack (most recent call first):
  /usr/share/cmake-3.12/Modules/Platform/Android/Determine-Compiler.cmake:39 (include)
  /usr/share/cmake-3.12/Modules/Platform/Android-Determine-C.cmake:1 (include)
  /usr/share/cmake-3.12/Modules/CMakeDetermineCCompiler.cmake:27 (include)
  CMakeLists.txt:45 (project)


Even though there is a folder called arch-x86_64 under {NDK}/platforms/android-28 ?
(As well as that there is also a folder called x86_64-4.9 under {NDK}/toolschains, So i definitely do have the toolchain)
« Last Edit: March 24, 2019, 12:25:11 am by stav »

texus

  • Sr. Member
  • ****
  • Posts: 499
    • View Profile
    • TGUI
    • Email
Re: CMake android build errors
« Reply #3 on: March 29, 2019, 01:57:26 pm »
I have no issues when using NDK 17b which I downloaded manually some time ago.

However if I install the ndk-bundle by running `./sdkmanager "ndk-bundle"` and run the same command (but with the new NDK directory) then I get some errors about the compiler it tries to use. So maybe your issue could also be solved by downloading the NDK manually instead of using the ndk-bundle from the SDK.

Edit: the tutorial also states that when using NDK 18 or above, "-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang" should be added to the cmake command (and ndk-bundle seems to download NDK 19).
I seem to also get the errors when downloading NDK 19c manually, but 17b and 18b works fine for me. But my errors occur after the place where it fails for you, so downgrading NDK might not solve your issue.
« Last Edit: March 29, 2019, 02:33:40 pm by texus »
TGUI: C++ SFML GUI