tensorflow / rust

Rust language bindings for TensorFlow
Apache License 2.0
5.19k stars 422 forks source link

Build failure on Windows cross compilation for aarch64-linux #383

Open barakugav opened 2 years ago

barakugav commented 2 years ago

Im compiling using 'cargo build' with '--target=aarch64-unknown-linux-gnu', and the compilation fails as it doesn't detect bazel. I have installed bazel and added it to path on windows. As the script ./configure seems to run from 'bash' i have installed bazel in the bash too, using './bazel-5.3.1-installer-linux-x86_64.sh'.

Also the ./configure file had to be changed using dos2unix, as it was run from bash.

Full log:

cargo build --target=aarch64-unknown-linux-gnu Compiling tensorflow-sys v0.21.0 error: failed to run custom build command for tensorflow-sys v0.21.0

Caused by: process didn't exit successfully: C:\code\rl\target\debug\build\tensorflow-sys-a87e5a4a076eaf92\build-script-build (exit code: 101) --- stdout cargo:rerun-if-env-changed=TENSORFLOW_NO_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64_unknown_linux_gnu cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_gnu cargo:rerun-if-env-changed=TARGET_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR tensorflow-sys/build.rs:303: output = "C:\code\rl\target\aarch64-unknown-linux-gnu\debug\build\tensorflow-sys-08f60dab431ef5c2\out" tensorflow-sys/build.rs:305: source = "C:\Users\ugav\.cargo\registry\src\github.com-1ecc6299db9ec823\tensorflow-sys-0.21.0\target/source-v2.8.0" tensorflow-sys/build.rs:307: lib_dir = "C:\code\rl\target\aarch64-unknown-linux-gnu\debug\build\tensorflow-sys-08f60dab431ef5c2\out\lib-v2.8.0" tensorflow-sys/build.rs:309: Directory "C:\code\rl\target\aarch64-unknown-linux-gnu\debug\build\tensorflow-sys-08f60dab431ef5c2\out\lib-v2.8.0" already exists tensorflow-sys/build.rs:316: framework_library_path = "C:\code\rl\target\aarch64-unknown-linux-gnu\debug\build\tensorflow-sys-08f60dab431ef5c2\out\lib-v2.8.0\libtensorflow_framework.so.2" tensorflow-sys/build.rs:319: library_path = "C:\code\rl\target\aarch64-unknown-linux-gnu\debug\build\tensorflow-sys-08f60dab431ef5c2\out\lib-v2.8.0\libtensorflow.so.2" tensorflow-sys/build.rs:436: Executing "bazel" "version" tensorflow-sys/build.rs:438: Command "bazel" "version" finished successfully tensorflow-sys/build.rs:335: framework_target_path = "tensorflow/libtensorflow_framework.so.2" tensorflow-sys/build.rs:337: target_path = "tensorflow/libtensorflow.so" tensorflow-sys/build.rs:420: Executing "bash" "-c" "yes \'\'|./configure" Cannot find bazel. Please install bazel.

--- stderr thread 'main' panicked at 'failed to execute "bash" "-c" "yes \'\'|./configure"', C:\Users\ugav.cargo\registry\src\github.com-1ecc6299db9ec823\tensorflow-sys-0.21.0\build.rs:422:9 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace