I am trying to compile a rust app in an aarch64 linux docker container to run on raspberry pi 4. I have things working except when a package is not pure rust and utilizes c libraries. The ring crate is an example of this, when I try to build the ring library without setting ENV TARGET_CC=something
it fails with the following error:
#18 32.35 Compiling ring v0.16.19
#18 38.13 error: failed to run custom build command for `ring v0.16.19`
#18 38.13
#18 38.13 Caused by:
#18 38.13 process didn't exit successfully: `/usr/src/content-manager/target/release/build/ring-902dd3bf18c6ec17/build-script-build` (exit code: 101)
#18 38.13 --- stdout
#18 38.13 OPT_LEVEL = Some("3")
#18 38.13 TARGET = Some("aarch64-unknown-linux-musl")
#18 38.13 HOST = Some("aarch64-unknown-linux-gnu")
#18 38.13 CC_aarch64-unknown-linux-musl = None
#18 38.13 CC_aarch64_unknown_linux_musl = None
#18 38.13 TARGET_CC = Some("aarch64-linux-musl-gcc")
#18 38.13 CFLAGS_aarch64-unknown-linux-musl = None
#18 38.13 CFLAGS_aarch64_unknown_linux_musl = None
#18 38.13 TARGET_CFLAGS = None
#18 38.13 CFLAGS = None
#18 38.13 CRATE_CC_NO_DEFAULTS = None
#18 38.13 DEBUG = Some("false")
#18 38.13 CARGO_CFG_TARGET_FEATURE = None
#18 38.13
#18 38.13 --- stderr
#18 38.13 running "aarch64-linux-musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-g3" "-U_FORTIFY_SOURCE" "-DNDEBUG" "-c" "-o/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/aesv8-armx-linux64.o" "/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.19/pregenerated/aesv8-armx-linux64.S"
#18 38.13 thread 'main' panicked at 'execution failed', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.19/build.rs:673:9
#18 38.13 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
In the ring build docs it mentions the need to set TARGET_CC and TARGET_AR, when I set TARGET_CC to aarch64-Linux-gnu-gcc I get the following error
#18 62.62 process didn't exit successfully: `/usr/src/content-manager/target/release/build/ring-902dd3bf18c6ec17/build-script-build` (exit code: 1)
#18 62.62 --- stdout
#18 62.62 OPT_LEVEL = Some("3")
#18 62.62 TARGET = Some("aarch64-unknown-linux-musl")
#18 62.62 HOST = Some("aarch64-unknown-linux-gnu")
#18 62.62 CC_aarch64-unknown-linux-musl = None
#18 62.62 CC_aarch64_unknown_linux_musl = None
...
#18 62.62 CRATE_CC_NO_DEFAULTS = None
#18 62.62 DEBUG = Some("false")
#18 62.62 CARGO_CFG_TARGET_FEATURE = None
#18 62.62 running: "aarch64-linux-musl-ar" "cq" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/libring-core.a" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/aesv8-armx-linux64.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/ghashv8-armx-linux64.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/vpaes-armv8-linux64.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/armv8-mont-linux64.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/chacha-armv8-linux64.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/ecp_nistz256-armv8-linux64.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/ghash-neon-armv8-linux64.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/sha512-armv8-linux64.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/sha256-armv8-linux64.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/aes_nohw.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/montgomery.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/montgomery_inv.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/limbs.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/mem.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/poly1305.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/crypto.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/curve25519.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/ecp_nistz.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/ecp_nistz256.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/gfp_p256.o" "/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/gfp_p384.o"
#18 62.62 exit code: 127
#18 62.62
#18 62.62 --- stderr
#18 62.62 running "aarch64-linux-gnu-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-g3" "-U_FORTIFY_SOURCE" "-DNDEBUG" "-c" "-o/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/aesv8-armx-linux64.o" "/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.19/pregenerated/aesv8-armx-linux64.S"
#18 62.62 running "aarch64-linux-gnu-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-g3" "-U_FORTIFY_SOURCE" "-DNDEBUG" "-c" "-o/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/ghashv8-armx-linux64.o" "/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.19/pregenerated/ghashv8-armx-linux64.S"
#18 62.62 running "aarch64-linux-gnu-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-g3" "-U_FORTIFY_SOURCE" "-DNDEBUG" "-c" "-o/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/vpaes-armv8-linux64.o" "/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.19/pregenerated/vpaes-armv8-linux64.S"
#18 62.62 running "aarch64-linux-gnu-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-g3" "-U_FORTIFY_SOURCE" "-DNDEBUG" "-c" "-o/usr/src/content-manager/target/aarch64-unknown-linux-musl/release/build/ring-ce2ec03868462ce3/out/armv8-mont-linux64.o" "/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.19/pregenerated/armv8-mont-linux64.S"
#18 62.62 running "aarch64-linux-gnu-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…