cxx
cxx copied to clipboard
Cross Compilation triplet issue
I have a nested projected that uses cxx. If I cross compile the nested project directly from it's subdirectory, it builds fine. When I build from top level directory it fails to use the correct TARGET triplet.
Building from nested project:
CXX include path:
/b/myapp/target/aarch64-poky-linux/debug/build/cool_service-16727f468527f4a3/out/cxxbridge/include
/b/myapp/target/aarch64-poky-linux/debug/build/cool_service-16727f468527f4a3/out/cxxbridge/crate
TARGET = Some("aarch64-poky-linux")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-unknown-linux-gnu")
CXX_aarch64-poky-linux = None
CXX_aarch64_poky_linux = None
TARGET_CXX = None
CXX = Some("aarch64-poky-linux-g++ -mcpu=cortex-a72+crc+crypto -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/poky/3.1.9/sysroots/aarch64-poky-linux")
CXXFLAGS_aarch64-poky-linux = None
CXXFLAGS_aarch64_poky_linux = None
TARGET_CXXFLAGS = None
CXXFLAGS = Some(" -O2 -pipe -g -feliminate-unused-debug-types ")
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = None
Building from top level project:
TARGET = Some("x86_64-unknown-linux-gnu")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-unknown-linux-gnu")
CXX_x86_64-unknown-linux-gnu = None
CXX_x86_64_unknown_linux_gnu = None
HOST_CXX = None
CXX = Some("aarch64-poky-linux-g++ -mcpu=cortex-a72+crc+crypto -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/poky/3.1.9/sysroots/aarch64-poky-linux")
CXXFLAGS_x86_64-unknown-linux-gnu = None
CXXFLAGS_x86_64_unknown_linux_gnu = None
HOST_CXXFLAGS = None
CXXFLAGS = Some(" -O2 -pipe -g -feliminate-unused-debug-types ")
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
CXX_x86_64-unknown-linux-gnu = None
CXX_x86_64_unknown_linux_gnu = None
HOST_CXX = None
CXX = Some("aarch64-poky-linux-g++ -mcpu=cortex-a72+crc+crypto -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/poky/3.1.9/sysroots/aarch64-poky-linux")
Notice in failure case it's picking up the wrong target triplet.
Any ideas?
I don't know of anything in this crate that would be relevant to the propagation of the target triple. That seems like purely a Cargo behavior. Cargo is responsible for setting the TARGET environment variable during all build script executions (https://doc.rust-lang.org/1.54.0/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts) and passing appropriate --target on every rustc command line.
I suspect you would have better luck searching the Cargo issue tracker about this.