Skip to content

Incorrect compiler used when cross compiling build tools #382

Closed
@axos88

Description

@axos88

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions