SPIRV-Cross is used in gfx_device_gl, but it doesn't compile for Android.
Thanks, I opened grovesNL/spirv_cross#55. Could you provide a stack trace?
I think the problem is that it tries to access STL headers that aren't available.
OPT_LEVEL = Some("0")
TARGET = Some("arm-linux-androideabi")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("arm-linux-androideabi")
TARGET = Some("arm-linux-androideabi")
HOST = Some("x86_64-unknown-linux-gnu")
CXX_arm-linux-androideabi = Some("/opt/android-ndk-linux/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++")
TARGET = Some("arm-linux-androideabi")
HOST = Some("x86_64-unknown-linux-gnu")
CXXFLAGS_arm-linux-androideabi = Some("--sysroot /opt/android-ndk-linux/platforms/android-18/arch-arm")
DEBUG = Some("true")
TARGET = Some("arm-linux-androideabi")
OPT_LEVEL = Some("0")
TARGET = Some("arm-linux-androideabi")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("arm-linux-androideabi")
TARGET = Some("arm-linux-androideabi")
HOST = Some("x86_64-unknown-linux-gnu")
CXX_arm-linux-androideabi = Some("/opt/android-ndk-linux/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++")
TARGET = Some("arm-linux-androideabi")
HOST = Some("x86_64-unknown-linux-gnu")
CXXFLAGS_arm-linux-androideabi = Some("--sysroot /opt/android-ndk-linux/platforms/android-18/arch-arm")
DEBUG = Some("true")
TARGET = Some("arm-linux-androideabi")
CXX_arm-linux-androideabi = Some("/opt/android-ndk-linux/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++")
CXXFLAGS_arm-linux-androideabi = Some("--sysroot /opt/android-ndk-linux/platforms/android-18/arch-arm")
running: "/opt/android-ndk-linux/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "--sysroot" "/opt/android-ndk-linux/platforms/android-18/arch-arm" "-g" "-Wall" "-Wextra" "-std=c++14" "-o" "/home/thomas/Workspace/gfx/target/arm-linux-androideabi/debug/build/spirv_cross-bc81ad2c713b855b/out/src/wrapper.o" "-c" "src/wrapper.cpp"
cargo:warning=src/wrapper.cpp:1:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
cargo:warning= #pragma warning(disable : 4996 4101)
cargo:warning= ^
cargo:warning=In file included from src/vendor/SPIRV-Cross/spirv_cross.hpp:21:0,
cargo:warning= from src/vendor/SPIRV-Cross/spirv_glsl.hpp:20,
cargo:warning= from src/vendor/SPIRV-Cross/spirv_hlsl.hpp:20,
cargo:warning= from src/wrapper.cpp:2:
cargo:warning=src/vendor/SPIRV-Cross/spirv_common.hpp:22:18: fatal error: cstdio: No such file or directory
cargo:warning= #include <cstdio>
cargo:warning= ^
cargo:warning=compilation terminated.
exit code: 1
--- stderr
thread 'main' panicked at '
Internal error occurred: Command "/opt/android-ndk-linux/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "--sysroot" "/opt/android-ndk-linux/platforms/android-18/arch-arm" "-g" "-Wall" "-Wextra" "-std=c++14" "-o" "/home/thomas/Workspace/gfx/target/arm-linux-androideabi/debug/build/spirv_cross-bc81ad2c713b855b/out/src/wrapper.o" "-c" "src/wrapper.cpp" with args "arm-linux-androideabi-g++" did not execute successfully (status code exit code: 1).
', /home/thomas/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.4/src/lib.rs:1984:5
@torkleyy I spent some time trying various Android build configurations and found that it seems to build fine without any changes in spirv_cross.
I added a sample Android job to Travis that runs cargo apk build on one of the examples -- you can find the configuration in android_gcc.sh and dependencies in .travis.yml.
I think we need to verify:
stl flag (for example, --stl=libc++ passed to make_standalone_toolchain), or if verify it's included already if you're using the prebuilt NDKCPATH so cargo apk will search it later (there are probably multiple ways to include this directory in the search path, but I just used the environment variable for now)I'll try on another computer then, maybe my installation is broken?
Your installation is probably fine in general, it probably doesn't set some of this configuration by default.
I had lots of problems trying to get exactly the correct combination of environment variables and include paths needed for cargo-apk and NDK, but managed to simplify it down to the steps in android_gcc.sh (although it could still probably be simplified further). But at least now we can try to compare your configuration against android_gcc.sh.
Maybe better defaults could be set through NDK installation or cargo-apk to remove some of this manual configuration.
Okay, tried setting CPATH, now I'm getting
cargo:warning=/opt/android-ndk-linux/sources/cxx-stl/llvm-libc++/include/support/android/locale_bionic.h:21:21: fatal error: xlocale.h: No such file or directory
cargo:warning= #include <xlocale.h>
cargo:warning= ^
cargo:warning=compilation terminated.
Which is funny because I do have that file..
What's your updated CPATH? Does it contain the same directories as the android_gcc CPATH, and do all of the directories actually exist on your computer?
Let's also be sure you're prepending and not replacing it, i.e. export CPATH=/opt/android-ndk-linux/sources/cxx-stl/llvm-libc++/include:$CPATH
Maybe you could list any other relevant compiler environment variables too, at least to compare against the android_gcc script.
@grovesNL should this be closed now as you can build it on Android?
Sure!
Oh, you didn't ask me ^^ Anyways, I think I can close this :)