I noticed that shaderc-rs builds pretty fine for iOS already but not for Android. But shaderc is de facto standard for Android.
I tried to build shaderc-rs for Android and got some weird errors from cmake:
Cropped error log:
[296/379] Linking CXX shared library spirv-tools/source/libSPIRV-Tools-shared.dylib
FAILED: spirv-tools/source/libSPIRV-Tools-shared.dylib
aarch64-linux-android29-clang++ -DANDROID -ffunction-sections -fdata-sections -fPIC -O3 -DNDEBUG -isysroot
/crtbegin_dynamic.o: In function _start_main':
crtbegin.c:(.text+0x38): undefined reference to main'
crtbegin.c:(.text+0x3c): undefined reference to `main'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[299/379] Building CXX object spirv-tools/source/CMakeFiles/SPIRV-Tools.dir/extensions.cpp.o
ninja: build stopped: subcommand failed.
Full error log:
$ cargo apk run
Compiling shaderc-sys v0.6.2
The following warnings were emitted during compilation:
warning: System installed library not found. Falling back to build from source
error: failed to run custom build command for `shaderc-sys v0.6.2`
Caused by:
process didn't exit successfully: `/Users/enfipy/Desktop/Development/Own/creator-rs/creator/target/debug/build/shaderc-sys-e7e8ad6d63e326cd/build-script-build` (exit code: 101)
--- stdout
cargo:warning=System installed library not found. Falling back to build from source
running: "cmake" "/Users/enfipy/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.2/build" "-G" "Ninja" "-DCMAKE_POSITION_INDEPENDENT_CODE=ON" "-DSPIRV_SKIP_EXECUTABLES=ON" "-DSPIRV_WERROR=OFF" "-DSHADERC_SKIP_TESTS=ON" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_PREFIX=/Users/enfipy/Desktop/Development/Own/creator-rs/creator/target/aarch64-linux-android/debug/build/shaderc-sys-128d78ee4a4deb1b/out" "-DCMAKE_C_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_C_COMPILER=/Users/enfipy/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android29-clang" "-DCMAKE_CXX_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_CXX_COMPILER=/Users/enfipy/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android29-clang++" "-DCMAKE_ASM_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_ASM_COMPILER=/Users/enfipy/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android29-clang" "-DCMAKE_BUILD_TYPE=Release"
-- Building SPIRV-Header examples
-- Installing SPIRV-Header
-- Google Mock was not found - tests based on that will not build
-- optimizer enabled
-- Shaderc: build type is "Release".
-- Configuring Shaderc to avoid building tests.
-- asciidoctor was not found - no documentation will be generated
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/enfipy/Desktop/Development/Own/creator-rs/creator/target/aarch64-linux-android/debug/build/shaderc-sys-128d78ee4a4deb1b/out/build
running: "cmake" "--build" "." "--target" "install" "--config" "Release" "--" "-j4"
[1/85] cd /Users/enfipy/Desktop/Development/Own/creator-rs/creator/target/aarch64-linux-android/debug/build/shaderc-sys-128d78ee4a4deb1b/out/build/spirv-tools && /usr/local/Cellar/cmake/3.17.0_1/bin/cmake -DCHANGES_FILE=/Users/enfipy/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.2/build/spirv-tools/CHANGES -DTEMPLATE_FILE=/Users/enfipy/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.2/build/spirv-tools/cmake/SPIRV-Tools-shared.pc.in -DOUT_FILE=/Users/enfipy/Desktop/Development/Own/creator-rs/creator/target/aarch64-linux-android/debug/build/shaderc-sys-128d78ee4a4deb1b/out/build/spirv-tools/SPIRV-Tools-shared.pc -DCMAKE_INSTALL_PREFIX=/Users/enfipy/Desktop/Development/Own/creator-rs/creator/target/aarch64-linux-android/debug/build/shaderc-sys-128d78ee4a4deb1b/out -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_INCLUDEDIR=include -DSPIRV_SHARED_LIBRARIES=-lSPIRV-Tools-shared -P /Users/enfipy/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.2/build/spirv-tools/cmake/write_pkg_config.cmake
[2/85] cd /Users/enfipy/Desktop/Development/Own/creator-rs/creator/target/aarch64-linux-android/debug/build/shaderc-sys-128d78ee4a4deb1b/out/build/spirv-tools && /usr/local/Cellar/cmake/3.17.0_1/bin/cmake -DCHANGES_FILE=/Users/enfipy/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.2/build/spirv-tools/CHANGES -DTEMPLATE_FILE=/Users/enfipy/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.2/build/spirv-tools/cmake/SPIRV-Tools.pc.in -DOUT_FILE=/Users/enfipy/Desktop/Development/Own/creator-rs/creator/target/aarch64-linux-android/debug/build/shaderc-sys-128d78ee4a4deb1b/out/build/spirv-tools/SPIRV-Tools.pc -DCMAKE_INSTALL_PREFIX=/Users/enfipy/Desktop/Development/Own/creator-rs/creator/target/aarch64-linux-android/debug/build/shaderc-sys-128d78ee4a4deb1b/out -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_INCLUDEDIR=include -DSPIRV_LIBRARIES=-lSPIRV-Tools-opt\ -lSPIRV-Tools\ -lSPIRV-Tools-link -P /Users/enfipy/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.2/build/spirv-tools/cmake/write_pkg_config.cmake
[3/85] Linking CXX shared library spirv-tools/source/libSPIRV-Tools-shared.dylib
FAILED: spirv-tools/source/libSPIRV-Tools-shared.dylib
: && /Users/enfipy/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android29-clang++ -DANDROID -ffunction-sections -fdata-sections -fPIC -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -dynamiclib -Wl,-headerpad_max_install_names -o spirv-tools/source/libSPIRV-Tools-shared.dylib -install_name /Users/enfipy/Desktop/Development/Own/creator-rs/creator/target/aarch64-linux-android/debug/build/shaderc-sys-128d78ee4a4deb1b/out/build/spirv-tools/source/libSPIRV-Tools-shared.dylib spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/util/bit_vector.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/util/parse_number.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/util/string_utils.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/assembly_grammar.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/binary.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/diagnostic.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/disassemble.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/enum_string_mapping.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/ext_inst.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/extensions.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/libspirv.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/name_mapper.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/opcode.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/operand.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/parsed_operand.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/print.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/software_version.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/spirv_endian.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/spirv_fuzzer_options.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/spirv_optimizer_options.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/spirv_reducer_options.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/spirv_target_env.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/spirv_validator_options.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/table.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/text.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/text_handler.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_adjacency.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_annotation.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_arithmetics.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_atomics.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_barriers.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_bitwise.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_builtins.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_capability.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_cfg.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_composites.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_constants.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_conversion.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_debug.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_decorations.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_derivatives.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_extensions.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_execution_limitations.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_function.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_id.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_image.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_interfaces.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_instruction.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_layout.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_literals.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_logicals.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_memory.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_memory_semantics.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_misc.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_mode_setting.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_non_uniform.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_primitives.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_scopes.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_small_type_uses.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_type.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/basic_block.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/construct.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/function.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/instruction.cpp.o spirv-tools/source/CMakeFiles/SPIRV-Tools-shared.dir/val/validation_state.cpp.o && :
clang++: warning: argument unused during compilation: '-dynamiclib' [-Wunused-command-line-argument]
clang++: warning: argument unused during compilation: '-install_name /Users/enfipy/Desktop/Development/Own/creator-rs/creator/target/aarch64-linux-android/debug/build/shaderc-sys-128d78ee4a4deb1b/out/build/spirv-tools/source/libSPIRV-Tools-shared.dylib' [-Wunused-command-line-argument]
/Users/enfipy/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/lib/aarch64-linux-android/29/crtbegin_dynamic.o: In function `_start_main':
crtbegin.c:(.text+0x38): undefined reference to `main'
crtbegin.c:(.text+0x3c): undefined reference to `main'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[4/85] Building CXX object spirv-tools/source/CMakeFiles/SPIRV-Tools.dir/print.cpp.o
[5/85] Building CXX object spirv-tools/source/CMakeFiles/SPIRV-Tools.dir/parsed_operand.cpp.o
[6/85] Building CXX object spirv-tools/source/CMakeFiles/SPIRV-Tools.dir/operand.cpp.o
ninja: build stopped: subcommand failed.
--- stderr
CMake Warning (dev) at CMakeLists.txt:8 (project):
Policy CMP0048 is not set: project() command manages VERSION variables.
Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
The following variable(s) would be set to empty:
CMAKE_PROJECT_VERSION
CMAKE_PROJECT_VERSION_MAJOR
CMAKE_PROJECT_VERSION_MINOR
CMAKE_PROJECT_VERSION_PATCH
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev):
Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
--help-policy CMP0042" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
MACOSX_RPATH is not specified for the following targets:
SPIRV-Tools-shared
shaderc_shared
This warning is for project developers. Use -Wno-dev to suppress it.
thread 'main' panicked at '
command did not execute successfully, got: exit code: 1
build script failed, must exit now', /Users/enfipy/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.44/src/lib.rs:885:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: Command 'cargo build --target aarch64-linux-android' had a non-zero exit code.
I'm not sure what exactly is broken here. Any help will be highly appreciated!
I noticed that
shaderc-rs
builds pretty fine for iOS already but not for Android. But shaderc is de facto standard for Android.I tried to build
shaderc-rs
for Android and got some weird errors from cmake:Cropped error log:
Full error log:I'm not sure what exactly is broken here. Any help will be highly appreciated!