Skip to content

Incorrect compiler used when cross compiling build tools #382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
axos88 opened this issue Mar 15, 2019 · 3 comments
Closed

Incorrect compiler used when cross compiling build tools #382

axos88 opened this issue Mar 15, 2019 · 3 comments

Comments

@axos88
Copy link

axos88 commented Mar 15, 2019

Encountered this when trying to use github.com/alexcrichton/flate2-rs as a build dependency for a cross-compiled project.

As a dependency flate2-rs compiles fine, but as a build-dependency it seems to want to use the cross compiler to compile the build tools, even though the TARGET is correctly reckognized:

See rust-lang/flate2-rs#190 for details.

.cargo/config:

[target.armv5te-unknown-linux-gnueabi]

linker = "/usr/xcc/armv5-unknown-linux-gnueabi/bin/armv5-unknown-linux-gnueabi-gcc"
ar = "/usr/xcc/armv5-unknown-linux-gnueabi/bin/armv5-unknown-linux-gnueabi-ar"

Using the command cargo build --target armv5te-unknown-linux-gnueabi results in:

error: failed to run custom build command for `miniz-sys v0.1.11`
process didn't exit successfully: `/work/target/debug/build/miniz-sys-984d5c2802e24372/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("x86_64-unknown-linux-gnu")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = Some("/usr/xcc/armv5-unknown-linux-gnueabi/bin/armv5-unknown-linux-gnueabi-gcc")
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "/usr/xcc/armv5-unknown-linux-gnueabi/bin/armv5-unknown-linux-gnueabi-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-fvisibility=hidden" "-DMINIZ_NO_STDIO" "-DMINIZ_NO_ARCHIVE_APIS" "-DMINIZ_NO_ARCHIVE_WRITING_APIS" "-DMINIZ_NO_TIME" "-DMINIZ_NO_ZLIB_COMPATIBLE_NAMES" "-o" "/work/target/debug/build/miniz-sys-276877788d47903a/out/miniz.o" "-c" "miniz.c"
cargo:warning=armv5-unknown-linux-gnueabi-gcc: error: unrecognized command line option '-m64'
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "/usr/xcc/armv5-unknown-linux-gnueabi/bin/armv5-unknown-linux-gnueabi-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-fvisibility=hidden" "-DMINIZ_NO_STDIO" "-DMINIZ_NO_ARCHIVE_APIS" "-DMINIZ_NO_ARCHIVE_WRITING_APIS" "-DMINIZ_NO_TIME" "-DMINIZ_NO_ZLIB_COMPATIBLE_NAMES" "-o" "/work/target/debug/build/miniz-sys-276877788d47903a/out/miniz.o" "-c" "miniz.c" with args "armv5-unknown-linux-gnueabi-gcc" did not execute successfully (status code exit code: 1).

', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.31/src/lib.rs:2367:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
@alexcrichton
Copy link
Member

Thanks for the report! This crate currently does not read cargo toml configuration and the error here is that CC is set which sets the default compiler for all compilations, not just the target one. The wrong compiler is being used as a result for host compilation, which causes the error here.

@axos88
Copy link
Author

axos88 commented Mar 18, 2019

Why close the issue, if it's still outstanding? Is this not something that should be fixed sooner or later?

@alexcrichton
Copy link
Member

This crate is working as intended because CC is the fallback for compiler configuration after other env vars are checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants