irondash / cargokit

Integrate cargo build with flutter plugins and applications.
Other
51 stars 16 forks source link

Cmake cannot find NDK on MacOS #59

Open Mnieme opened 5 months ago

Mnieme commented 5 months ago

I've encountered an issue while attempting to run Android, and I've come here seeking assistance. The error I'm facing is:

[        ] SEVERE:   running: cd "/Users/Mnieme/projects/frb_libs/demo_app/build/rust_builder/build/aarch64-linux-android/debug/build/dart-rs-sys-26e25a64cb835ebf/out/build" && CMAKE_PREFIX_PATH="" "cmake" "-Wdev" "--debug-output" "/Users/Mnieme/projects/frb_libs/demo_app/build/rust_builder/build/aarch64-linux-android/debug/build/dart-rs-sys-26e25a64cb835ebf/out/" "-DBUILD_SHARED_LIBS=OFF" "-DWHISPER_ALL_WARNINGS=OFF" "-DWHISPER_ALL_WARNINGS_3RD_PARTY=OFF" "-DWHISPER_BUILD_TESTS=OFF" "-DWHISPER_BUILD_EXAMPLES=OFF" "-DWHISPER_METAL=OFF" "-DCMAKE_SYSTEM_NAME=Android" "-DCMAKE_SYSTEM_PROCESSOR=aarch64" "-DCMAKE_INSTALL_PREFIX=/Users/Mnieme/projects/frb_libs/demo_app/build/rust_builder/build/aarch64-linux-android/debug/build/dart-rs-sys-26e25a64cb835ebf/out" "-DCMAKE_C_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC --target=aarch64-linux-android --target=aarch64-linux-android21" "-DCMAKE_C_COMPILER=/Users/Mnieme/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang" "-DCMAKE_CXX_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC --target=aarch64-linux-android --target=aarch64-linux-android21" "-DCMAKE_CXX_COMPILER=/Users/Mnieme/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++" "-DCMAKE_ASM_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC --target=aarch64-linux-android --target=aarch64-linux-android21" "-DCMAKE_ASM_COMPILER=/Users/Mnieme/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
[        ] SEVERE:   Running with debug output on.
[        ] SEVERE:   -- Configuring incomplete, errors occurred!
[        ] SEVERE: 
[        ] SEVERE:   --- stderr
[        ] SEVERE:   CMake Error at /opt/homebrew/Cellar/cmake/3.28.1/share/cmake/Modules/Platform/Android-Determine.cmake:217 (message):
[        ] SEVERE:     Android: Neither the NDK or a standalone toolchain was found.
[        ] SEVERE:   Call Stack (most recent call first):
[        ] SEVERE:     /opt/homebrew/Cellar/cmake/3.28.1/share/cmake/Modules/CMakeDetermineSystem.cmake:212 (include)
[        ] SEVERE:     CMakeLists.txt:3 (project)

I have installed CMake and NDK using Android Studio. Additionally, I attempted to install CMake and Android NDK using Homebrew, and I added the environment paths for NDKs. However, the error persists.

Could someone provide guidance on resolving this issue? Any help would be greatly appreciated.

knopp commented 5 months ago

This is not necessarily related to cargokit (since it is an error during building of a specific crate), but cargokit does know the NDK location, so maybe it should be setting ANDROID_NDK or similar environment variable during android build. Is there a project I can reproduce this with?