Skip to content
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

build for target=arm...musl fails #35

Closed
rainboh opened this issue Dec 29, 2017 · 4 comments
Closed

build for target=arm...musl fails #35

rainboh opened this issue Dec 29, 2017 · 4 comments

Comments

@rainboh
Copy link

rainboh commented Dec 29, 2017

I tried to x-compile on a x86_64 linux system

cargo build --target=arm-unknown-linux-musleabihf
cargo build --target=arm-unknown-linux-musleabi
cargo build --target=armv7-unknown-linux-musleabihf

all are failing with error "Compiler error reporting is too harsh for ./configure (perhaps remove -Werror)", e.g.

   Compiling libz-sys v1.0.18 (https://github.com/alexcrichton/libz-sys.git#8eb6f9e8)
error: failed to run custom build command for `libz-sys v1.0.18 (https://github.com/alexcrichton/libz-sys.git#8eb6f9e8)`
process didn't exit successfully: `/home/rainer/test/rust/lg2/lg2_test/target/debug/build/libz-sys-79688570e7235f69/build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-env-changed=LIBZ_SYS_STATIC
cargo:rerun-if-changed=build.rs
OPT_LEVEL = Some("0")
TARGET = Some("arm-unknown-linux-musleabihf")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("arm-unknown-linux-musleabihf")
TARGET = Some("arm-unknown-linux-musleabihf")
HOST = Some("x86_64-unknown-linux-gnu")
CC_arm-unknown-linux-musleabihf = None
CC_arm_unknown_linux_musleabihf = None
TARGET_CC = None
CC = None
HOST = Some("x86_64-unknown-linux-gnu")
CROSS_COMPILE = None
TARGET = Some("arm-unknown-linux-musleabihf")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_arm-unknown-linux-musleabihf = None
CFLAGS_arm_unknown_linux_musleabihf = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "./configure" "--prefix=/home/rainer/test/rust/lg2/lg2_test/target/arm-unknown-linux-musleabihf/debug/build/libz-sys-a4825891e6086beb/out"
Compiler error reporting is too harsh for ./configure (perhaps remove -Werror).
** ./configure aborting.


command did not execute successfully, got: exit code: 1

Some additonal setup or parameters are needed for cross-compiling ?

@rainboh
Copy link
Author

rainboh commented Dec 29, 2017

configure.log reports

./configure: 182: ./configure: arm-linux-musleabihf-gcc: not found

Now I tried compiling with

1) CC=arm-linux-gnueabihf-gcc cargo build --target=arm-unknown-linux-musleabihf
2) CC=arm-linux-gnueabihf-cpp cargo build --target=arm-unknown-linux-musleabihf
3) CC=arm-linux-gnueabihf-g++ cargo build --target=arm-unknown-linux-musleabihf
  1. does succeed.
  2. reports in configure.log
arm-linux-gnueabi-cpp: fatal error: ‘-c’ is not a valid option to the preprocessor
  1. outputs a bunch of compile errors on console

Is 1) a proper solution to compile the crate ? (I thought 'cargo build target=...' is sufficient )
Or do I need to get "arm-linux-musleabihf-gcc" ? If yes where can I get it ? (I'm on Ubuntu 17.10)

@rainboh
Copy link
Author

rainboh commented Dec 31, 2017

Ok. My expectation was same as expresssed here rust-lang/cargo#4741 (comment)

From discussion there I can see, currently it is still necessary to pass via environment variables proper information about compiler, include path, library path ... beside cargo's 'target=...' option

So either "CC=arm-linux-gnueabihf-gcc" or "CROSS_COMPILE="arm-linux-gnueabihf-" are good to pick proper cross-compiler.

I assume "CROSS_COMPILE=..." should be preferred ?

And in case wrong header files are used I can fix it by using "CFLAGS=I..." (faced that issue here tailhook/vagga#482 (comment))

Before closing this thread it would be nice if someone can confirm if my understanding is correct now or point out where I'm still wrong.
Thanks.

@alexcrichton
Copy link
Member

Hello and thanks for the report! Looks like you've found what's up though in the sense that it looks like you needed to configure the C compiler for the cross-compilation. I'd recommend using CC_$target personally.

@rainboh
Copy link
Author

rainboh commented Jan 3, 2018

Thanks for your confirmation.

@rainboh rainboh closed this as completed Jan 3, 2018
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