touchHLE
touchHLE copied to clipboard
Android build compilation error on macOS
I encountered an error while compiling an Android build on macOS using Android Studio 2022.2.1 Patch 2 and ndk 25.2.9519653. The compilation failed specifically on the 'sdl2-sys' component. The error message show:
-- Check for working C compiler: /Users/user/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - broken
-- Configuring incomplete, errors occurred!
However, other dependencies were built successfully without any issues. It's also important to note that if I exclude the cross compilation step and create a build solely for macOS, the entire build process proceeds without any problems.
Here is the complete log for the Android build:
> Task :app:buildCargoNdkDebug
[2023-06-02T13:12:18Z INFO cargo_ndk::cli] Using NDK at path: /Users/user/Library/Android/sdk/ndk/25.2.9519653 (ANDROID_NDK_HOME)
[2023-06-02T13:12:18Z INFO cargo_ndk::cli] NDK API level: 21
[2023-06-02T13:12:18Z INFO cargo_ndk::cli] Building targets: arm64-v8a
[2023-06-02T13:12:18Z INFO cargo_ndk::cli] Building arm64-v8a (aarch64-linux-android)
Compiling proc-macro2 v1.0.47
Compiling unicode-ident v1.0.5
Compiling quote v1.0.21
Compiling cc v1.0.77
Compiling syn v1.0.105
Compiling serde_derive v1.0.148
Compiling serde v1.0.148
Compiling cfg-if v1.0.0
Compiling version_check v0.9.4
Compiling autocfg v1.1.0
Compiling log v0.4.17
Compiling thiserror v1.0.37
Compiling memchr v2.5.0
Compiling khronos_api v3.1.0
Compiling cmake v0.1.49
Compiling proc-macro-error-attr v1.0.4
Compiling proc-macro-error v1.0.4
Compiling libc v0.2.137
Compiling indexmap v1.9.2
Compiling ryu v1.0.12
Compiling version-compare v0.1.1
Compiling xml-rs v0.8.4
Compiling semver v1.0.16
Compiling camino v1.1.2
Compiling serde_json v1.0.91
Compiling sdl2-sys v0.35.2 (https://github.com/hikari-no-yume/rust-sdl2.git?tag=touchHLE-2#15c58be7)
Compiling regex-automata v0.1.10
Compiling anyhow v1.0.68
Compiling heck v0.4.1
Compiling os_str_bytes v6.4.1
Compiling hashbrown v0.12.3
Compiling itoa v1.0.4
Compiling lazy_static v1.4.0
Compiling gl_generator v0.14.0
Compiling clap_lex v0.2.4
Compiling atty v0.2.14
Compiling csv-core v0.1.10
Compiling strsim v0.10.0
Compiling termcolor v1.2.0
Compiling crc32fast v1.3.2
Compiling bitflags v1.3.2
Compiling once_cell v1.17.0
Compiling itoa v0.4.8
Compiling textwrap v0.16.0
Compiling unicode-width v0.1.10
Compiling time-core v0.1.0
Compiling getopts v0.2.21
Compiling time-macros v0.2.6
Compiling adler v1.0.2
Compiling byteorder v1.4.3
Compiling ansi_term v0.12.1
Compiling miniz_oxide v0.6.2
Compiling touchHLE_gl_bindings v0.1.2 (/Users/user/projects/gamedev/touchHLE/src/window/gl_bindings)
Compiling touchHLE_pvrt_decompress_wrapper v0.1.2 (/Users/user/projects/gamedev/touchHLE/src/image/pvrt_decompress_wrapper)
Compiling touchHLE_dynarmic_wrapper v0.1.2 (/Users/user/projects/gamedev/touchHLE/src/cpu/dynarmic_wrapper)
Compiling touchHLE_stb_image_wrapper v0.1.2 (/Users/user/projects/gamedev/touchHLE/src/image/stb_image_wrapper)
Compiling touchHLE_dr_mp3_wrapper v0.1.2 (/Users/user/projects/gamedev/touchHLE/src/audio/dr_mp3_wrapper)
Compiling touchHLE_openal_soft_wrapper v0.1.2 (/Users/user/projects/gamedev/touchHLE/src/audio/openal_soft_wrapper)
Compiling sdl2 v0.35.2 (https://github.com/hikari-no-yume/rust-sdl2.git?tag=touchHLE-2#15c58be7)
Compiling safemem v0.3.3
Compiling ttf-parser v0.15.2
Compiling flate2 v1.0.25
error: failed to run custom build command for `sdl2-sys v0.35.2 (https://github.com/hikari-no-yume/rust-sdl2.git?tag=touchHLE-2#15c58be7)`
Caused by:
process didn't exit successfully: `/Users/user/projects/gamedev/touchHLE/target/debug/build/sdl2-sys-9e4229196165030f/build-script-build` (exit status: 101)
--- stdout
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 "/Users/user/projects/gamedev/touchHLE/target/aarch64-linux-android/debug/build/sdl2-sys-3438285845c4459e/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/Users/user/.cargo/git/checkouts/rust-sdl2-d99d7f693515dc24/15c58be/sdl2-sys/SDL" "-DANDROID_NDK=/Users/user/Library/Android/sdk/ndk/25.2.9519653" "-DSDL_SHARED=ON" "-DSDL_STATIC=OFF" "-DCMAKE_SYSTEM_NAME=Android" "-DCMAKE_SYSTEM_PROCESSOR=aarch64" "-DCMAKE_INSTALL_PREFIX=/Users/user/projects/gamedev/touchHLE/target/aarch64-linux-android/debug/build/sdl2-sys-3438285845c4459e/out" "-DCMAKE_C_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC --target=aarch64-linux-android" "-DCMAKE_C_COMPILER=/Users/user/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang" "-DCMAKE_CXX_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC --target=aarch64-linux-android" "-DCMAKE_CXX_COMPILER=/Users/user/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++" "-DCMAKE_ASM_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC --target=aarch64-linux-android" "-DCMAKE_ASM_COMPILER=/Users/user/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang" "-DCMAKE_BUILD_TYPE=release"
-- Android: Targeting API '21' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
-- Android: Selected unified Clang toolchain
-- The C compiler identification is Clang 14.0.7
-- The CXX compiler identification is Clang 14.0.7
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Users/user/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
-- Check for working C compiler: /Users/user/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - broken
-- Configuring incomplete, errors occurred!
See also "/Users/user/projects/gamedev/touchHLE/target/aarch64-linux-android/debug/build/sdl2-sys-3438285845c4459e/out/build/CMakeFiles/CMakeOutput.log".
See also "/Users/user/projects/gamedev/touchHLE/target/aarch64-linux-android/debug/build/sdl2-sys-3438285845c4459e/out/build/CMakeFiles/CMakeError.log".
--- stderr
CMake Error at /usr/local/Cellar/cmake/3.22.0/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"/Users/user/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/user/projects/gamedev/touchHLE/target/aarch64-linux-android/debug/build/sdl2-sys-3438285845c4459e/out/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_84c13/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_84c13.dir/build.make CMakeFiles/cmTC_84c13.dir/build
Building C object CMakeFiles/cmTC_84c13.dir/testCCompiler.c.o
/Users/user/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=aarch64-none-linux-android21 -DANDROID -ffunction-sections -fdata-sections -fPIC --target=aarch64-linux-android -O2 -g -DNDEBUG -MD -MT CMakeFiles/cmTC_84c13.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_84c13.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_84c13.dir/testCCompiler.c.o -c /Users/user/projects/gamedev/touchHLE/target/aarch64-linux-android/debug/build/sdl2-sys-3438285845c4459e/out/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_84c13
/usr/local/Cellar/cmake/3.22.0/bin/cmake -E cmake_link_script CMakeFiles/cmTC_84c13.dir/link.txt --verbose=1
/Users/user/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=aarch64-none-linux-android21 -DANDROID -ffunction-sections -fdata-sections -fPIC --target=aarch64-linux-android -O2 -g -DNDEBUG -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--gc-sections -Qunused-arguments -Wl,--no-undefined -Wl,--gc-sections CMakeFiles/cmTC_84c13.dir/testCCompiler.c.o -o cmTC_84c13 -latomic -lm
ld: error: cannot open crtbegin_dynamic.o: No such file or directory
ld: error: cannot open crtend_android.o: No such file or directory
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_84c13] Error 1
make: *** [cmTC_84c13/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:6 (project)
thread 'main' panicked at '
command did not execute successfully, got: exit status: 1
build script failed, must exit now', /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.49/src/lib.rs:1104:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
[2023-06-02T13:12:36Z INFO cargo_ndk::cli] If the build failed due to a missing target, you can run this command:
[2023-06-02T13:12:36Z INFO cargo_ndk::cli]
[2023-06-02T13:12:36Z INFO cargo_ndk::cli] rustup target install aarch64-linux-android
> Task :app:buildCargoNdkDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:buildCargoNdkDebug'.
> Process 'command 'cargo'' finished with non-zero exit value 101
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.6.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 19s
1 actionable task: 1 executed
Please let me know if you require any further assistance with this issue.
Huh. I'm not sure what's wrong there. It looks like it's failing to find some file, but I don't know why, and I haven't encountered this error myself.
I'm having the same issue compiling the Windows build on Windows 10, and compiling the Windows build on Ubuntu.
The error above looks like this:
error: failed to run custom build command for `sdl2-sys v0.35.2 (https://github.com/hikari-no-yume/rust-sdl2.git?tag=touchHLE-2#15c58be7)`
Caused by:
process didn't exit successfully: `/Users/user/projects/gamedev/touchHLE/target/debug/build/sdl2-sys-9e4229196165030f/build-script-build` (exit status: 101)
--- stdout
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 "/Users/user/projects/gamedev/touchHLE/target/aarch64-linux-android/debug/build/sdl2-sys-3438285845c4459e/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/Users/user/.cargo/git/checkouts/rust-sdl2-d99d7f693515dc24/15c58be/sdl2-sys/SDL" "-DANDROID_NDK=/Users/user/Library/Android/sdk/ndk/25.2.9519653" "-DSDL_SHARED=ON" "-DSDL_STATIC=OFF" "-DCMAKE_SYSTEM_NAME=Android" "-DCMAKE_SYSTEM_PROCESSOR=aarch64" "-DCMAKE_INSTALL_PREFIX=/Users/user/projects/gamedev/touchHLE/target/aarch64-linux-android/debug/build/sdl2-sys-3438285845c4459e/out" "-DCMAKE_C_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC --target=aarch64-linux-android" "-DCMAKE_C_COMPILER=/Users/user/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang" "-DCMAKE_CXX_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC --target=aarch64-linux-android" "-DCMAKE_CXX_COMPILER=/Users/user/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++" "-DCMAKE_ASM_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC --target=aarch64-linux-android" "-DCMAKE_ASM_COMPILER=/Users/user/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang" "-DCMAKE_BUILD_TYPE=release"
-- Android: Targeting API '21' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
-- Android: Selected unified Clang toolchain
-- The C compiler identification is Clang 14.0.7
-- The CXX compiler identification is Clang 14.0.7
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Users/user/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
-- Check for working C compiler: /Users/user/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - broken
-- Configuring incomplete, errors occurred!
See also "/Users/user/projects/gamedev/touchHLE/target/aarch64-linux-android/debug/build/sdl2-sys-3438285845c4459e/out/build/CMakeFiles/CMakeOutput.log".
See also "/Users/user/projects/gamedev/touchHLE/target/aarch64-linux-android/debug/build/sdl2-sys-3438285845c4459e/out/build/CMakeFiles/CMakeError.log".
Mine on Windows 10 looks like this:
error: failed to run custom build command for `sdl2-sys v0.35.2 (https://github.com/hikari-no-yume/rust-sdl2.git?tag=touchHLE-2#15c58be7)`
Caused by:
process didn't exit successfully: `C:\touchHLE\touchHLE\target\debug\build\sdl2-sys-0e70c9caaa158bd9\build-script-build` (exit code: 101)
--- stdout
CMAKE_TOOLCHAIN_FILE_x86_64-pc-windows-msvc = None
CMAKE_TOOLCHAIN_FILE_x86_64_pc_windows_msvc = None
HOST_CMAKE_TOOLCHAIN_FILE = None
CMAKE_TOOLCHAIN_FILE = None
CMAKE_GENERATOR_x86_64-pc-windows-msvc = None
CMAKE_GENERATOR_x86_64_pc_windows_msvc = None
HOST_CMAKE_GENERATOR = None
CMAKE_GENERATOR = None
CMAKE_PREFIX_PATH_x86_64-pc-windows-msvc = None
CMAKE_PREFIX_PATH_x86_64_pc_windows_msvc = None
HOST_CMAKE_PREFIX_PATH = None
CMAKE_PREFIX_PATH = None
CMAKE_x86_64-pc-windows-msvc = None
CMAKE_x86_64_pc_windows_msvc = None
HOST_CMAKE = None
CMAKE = None
running: "cmake" "C:\\Users\\jcast\\.cargo\\git\\checkouts\\rust-sdl2-d99d7f693515dc24\\15c58be\\sdl2-sys\\SDL" "-G" "Visual Studio 16 2019" "-Thost=x64" "-Ax64" "-DSDL_SHARED=OFF" "-DSDL_STATIC=ON" "-DSDL_MAIN_HANDLED=ON" "-DCMAKE_INSTALL_PREFIX=C:\\touchHLE\\touchHLE\\target\\debug\\build\\sdl2-sys-a3b426bd216b8970\\out" "-DCMAKE_C_FLAGS= -D__FLTUSED__ -nologo -MD -Brepro" "-DCMAKE_C_FLAGS_RELEASE= -D__FLTUSED__ -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS_RELEASE= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS_RELEASE= -nologo -MD -Brepro" "-DCMAKE_BUILD_TYPE=release"
--- stderr
thread 'main' panicked at '
failed to execute command: program not found
is `cmake` not installed?
build script failed, must exit
So I assume something is wrong with rust-sdl2 that is causing CMAKE to not be detected at all on our devices, making at least the Windows and Android builds fail to compile at this time.
I'm new to this stuff but I hope this somewhat points towards the right direction to getting this issue fixed.
I managed to successfully build the windows version but the android version has this problem. The cmake error can be fixed by adding the cmake path to the PATH variable, but it will still have the problem to build. I also checked the cmake .log files and noticed the following error: "failed to determine sysroot for ndk". I don't know what it is but I think it's part of the problem