build for android failed on macos
Opened this issue · 5 comments
xuegao-tzx commented
This is my shell:
cargo clean
export NDK_HOST_TAG="darwin-x86_64"
NDK="/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837"
COMPILER_DIR="$NDK/toolchains/llvm/prebuilt/$NDK_HOST_TAG/bin"
export PATH="$COMPILER_DIR:$PATH"
echo "$COMPILER_DIR"
export CC_aarch64_linux_android=$COMPILER_DIR/aarch64-linux-android21-clang
export AR_aarch64_linux_android=$COMPILER_DIR/llvm-ar
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=$COMPILER_DIR/aarch64-linux-android21-clang
export CARGO_TARGET_AARCH64_LINUX_ANDROID_AR=$COMPILER_DIR/llvm-ar
cargo build --target aarch64-linux-android --release
the error is:
Compiling whisper-rs-sys v0.10.0 (/Volumes/Work/Gitlab/EIWork/whisper-rs/sys)
error: failed to run custom build command for `whisper-rs-sys v0.10.0 (/Volumes/Work/Gitlab/EIWork/whisper-rs/sys)`
Caused by:
process didn't exit successfully: `/Volumes/Work/Gitlab/EIWork/whisper-rs/target/release/build/whisper-rs-sys-d5275338df5e4bc6/build-script-build` (exit status: 101)
--- stdout
cargo:rustc-link-lib=dylib=c++_shared
cargo:rerun-if-changed=wrapper.h
cargo:rerun-if-env-changed=TARGET
cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_aarch64-linux-android
cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_aarch64_linux_android
cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS
cargo:rerun-if-changed=wrapper.h
cargo:rerun-if-changed=./whisper.cpp/whisper.h
cargo:rerun-if-changed=./whisper.cpp/ggml.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/stdbool.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/stddef.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/__stddef_ptrdiff_t.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/__stddef_size_t.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/__stddef_wchar_t.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/__stddef_null.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/__stddef_max_align_t.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/__stddef_offsetof.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/stdint.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/stdint.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/bits/wchar_limits.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/sys/cdefs.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/android/versioning.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/android/api-level.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/sys/cdefs.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/android/ndk-version.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/stddef.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/sys/cdefs.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/stdio.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/sys/cdefs.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/sys/types.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/stddef.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/stdint.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/sys/cdefs.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/linux/types.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/aarch64-linux-android/asm/types.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/asm-generic/types.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/asm-generic/int-ll64.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/aarch64-linux-android/asm/bitsperlong.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/asm-generic/bitsperlong.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/linux/posix_types.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/linux/stddef.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/linux/compiler_types.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/linux/compiler.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/aarch64-linux-android/asm/posix_types.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/asm-generic/posix_types.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/aarch64-linux-android/asm/bitsperlong.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/linux/posix_types.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/bits/pthread_types.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/sys/cdefs.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/sys/types.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/stdarg.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/__stdarg___gnuc_va_list.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/__stdarg_va_list.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/__stdarg_va_arg.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/__stdarg___va_copy.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/__stdarg_va_copy.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/stddef.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/bits/seek_constants.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/stddef.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/stdint.h
cargo:rerun-if-changed=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/include/stdbool.h
cargo:rerun-if-changed=./whisper.cpp/ggml.h
CMAKE_TOOLCHAIN_FILE_aarch64-linux-android = None
CMAKE_TOOLCHAIN_FILE_aarch64_linux_android = None
TARGET_CMAKE_TOOLCHAIN_FILE = None
CMAKE_TOOLCHAIN_FILE = None
CMAKE_GENERATOR_aarch64-linux-android = None
CMAKE_GENERATOR_aarch64_linux_android = None
TARGET_CMAKE_GENERATOR = None
CMAKE_GENERATOR = None
CMAKE_PREFIX_PATH_aarch64-linux-android = None
CMAKE_PREFIX_PATH_aarch64_linux_android = None
TARGET_CMAKE_PREFIX_PATH = None
CMAKE_PREFIX_PATH = None
CMAKE_aarch64-linux-android = None
CMAKE_aarch64_linux_android = None
TARGET_CMAKE = None
CMAKE = None
running: cd "/Volumes/Work/Gitlab/EIWork/whisper-rs/target/aarch64-linux-android/release/build/whisper-rs-sys-5d1df15a46578a4b/out/build" && CMAKE_PREFIX_PATH="" "cmake" "-Wdev" "--debug-output" "/Volumes/Work/Gitlab/EIWork/whisper-rs/target/aarch64-linux-android/release/build/whisper-rs-sys-5d1df15a46578a4b/out/whisper.cpp/" "-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=/Volumes/Work/Gitlab/EIWork/whisper-rs/target/aarch64-linux-android/release/build/whisper-rs-sys-5d1df15a46578a4b/out" "-DCMAKE_C_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_C_COMPILER=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang" "-DCMAKE_CXX_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_CXX_COMPILER=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang" "-DCMAKE_ASM_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_ASM_COMPILER=/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
Running with debug output on.
-- Configuring incomplete, errors occurred!
--- stderr
CMake Error at /Users/xuegao/Library/Android/sdk/cmake/3.22.1/share/cmake-3.22/Modules/Platform/Android-Determine.cmake:370 (message):
Android: Unknown processor CMAKE_SYSTEM_PROCESSOR='aarch64'.
Call Stack (most recent call first):
/Users/xuegao/Library/Android/sdk/cmake/3.22.1/share/cmake-3.22/Modules/CMakeDetermineSystem.cmake:160 (include)
CMakeLists.txt:6 (project)
Called from: [3] /Users/xuegao/Library/Android/sdk/cmake/3.22.1/share/cmake-3.22/Modules/Platform/Android-Determine.cmake
[2] /Users/xuegao/Library/Android/sdk/cmake/3.22.1/share/cmake-3.22/Modules/CMakeDetermineSystem.cmake
[1] /Volumes/Work/Gitlab/EIWork/whisper-rs/target/aarch64-linux-android/release/build/whisper-rs-sys-5d1df15a46578a4b/out/whisper.cpp/CMakeLists.txt
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.
Called from: [1] /Volumes/Work/Gitlab/EIWork/whisper-rs/target/aarch64-linux-android/release/build/whisper-rs-sys-5d1df15a46578a4b/out/whisper.cpp/CMakeLists.txt
thread 'main' panicked at /Users/xuegao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5:
command did not execute successfully, got: exit status: 1
build script failed, must exit now
stack backtrace:
0: rust_begin_unwind
at /rustc/3cf924b934322fd7b514600a7dc84fc517515346/library/std/src/panicking.rs:658:5
1: core::panicking::panic_fmt
at /rustc/3cf924b934322fd7b514600a7dc84fc517515346/library/core/src/panicking.rs:74:14
2: cmake::fail
at /Users/xuegao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5
3: cmake::run
at /Users/xuegao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1076:9
4: cmake::Config::build
at /Users/xuegao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:813:13
5: build_script_build::main
at ./build.rs:196:23
6: core::ops::function::FnOnce::call_once
at /rustc/3cf924b934322fd7b514600a7dc84fc517515346/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
tazz4843 commented
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.
Is make
installed?
xuegao-tzx commented
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.
Is
make
installed?
Yes:
$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
tazz4843 commented
That was my only idea, unfortunately I can't help more.
thewh1teagle commented
Checkout https://github.com/thewh1teagle/vibe/blob/feat/android-support/BUILDING.md#mobile
I also had similar issues, I resolved them and successfully built the repo that uses whisper.cpp. notice that some things are not relevant and related to Tauri.
xuegao-tzx commented
Checkout https://github.com/thewh1teagle/vibe/blob/feat/android-support/BUILDING.md#mobile
I also had similar issues, I resolved them and successfully built the repo that uses whisper.cpp. notice that some things are not relevant and related to Tauri.
export NDK_HOST_TAG="darwin-x86_64"
NDK="/Users/xuegao/Library/Android/sdk/ndk/27.0.11902837"
COMPILER_DIR="$NDK/toolchains/llvm/prebuilt/$NDK_HOST_TAG/bin"
export PATH="$COMPILER_DIR:$PATH"
export CMAKE_ANDROID_NDK=$NDK
export CMAKE_MAKE_PROGRAM=$NDK/prebuilt/darwin-x86_64/bin/make
export CMAKE_SYSTEM_PROCESSOR="armv7-a"
cargo build --target armv7-linux-androideabi --release
but it still prompts:
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.