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

servo-linux-cross2 is having trouble building arm64 #683

Closed
jdm opened this issue May 30, 2017 · 15 comments
Closed

servo-linux-cross2 is having trouble building arm64 #683

jdm opened this issue May 30, 2017 · 15 comments

Comments

@jdm
Copy link
Member

@jdm jdm commented May 30, 2017

--- stderr
configure: error: in `/home/servo/buildbot/slave/arm64/build/target/release/build/backtrace-sys-204dc57c91e9a514/out':
configure: error: C compiler cannot create executables
See `config.log' for more details.
thread 'main' panicked at 'failed with: exit code: 77', /home/servo/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.11/build.rs:136
@jdm
Copy link
Member Author

@jdm jdm commented Oct 10, 2017

Haven't seen this for a long time.

@jdm jdm closed this Oct 10, 2017
@jdm
Copy link
Member Author

@jdm jdm commented Oct 11, 2017

Saw this again on servo-linux-cross1 today in servo/servo#18821.

@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Oct 11, 2017

This happened for both arm32 and arm64 in servo/servo#18821, both times on servo-linux-cross1.

@jdm
Copy link
Member Author

@jdm jdm commented Oct 11, 2017

Both arm32 and arm64 failed both times, and across all of servo-linux-cross1, servo-linux-cross2, and servo-linux-cross3. I wish I could get ahold of the config.log files that were generated for those builds :(

@jdm
Copy link
Member Author

@jdm jdm commented Oct 11, 2017

configure:2977: checking for C compiler default output file name
configure:2999: aarch64-linux-gnu-gcc -O3 -ffunction-sections -fdata-sections -fPIC -m64   conftest.c  >&5
aarch64-linux-gnu-gcc: error: unrecognized command line option '-m64'
@jdm
Copy link
Member Author

@jdm jdm commented Oct 11, 2017

The argument in question comes from https://github.com/alexcrichton/cc-rs/blob/a84c5ee84e1a18091dd8c46b45912567fde9dbda/src/lib.rs#L614-L619 but I'm still confused how this sometimes works and sometimes does not.

@jdm
Copy link
Member Author

@jdm jdm commented Oct 11, 2017

Apparently when the build succeeds, the command executed is this instead:

configure:2977: checking for C compiler default output file name
configure:2999: aarch64-linux-gnu-gcc -O3 -ffunction-sections -fdata-sections -fPIC   conftest.c  >&5

Specifically, the -m64 is missing. The failing log was retried from /home/servo/buildbot/slave/arm64/build/target/release/build/backtrace-sys-ef6211128d6f7e04/out/config.log, while the successful log was at /home/servo/buildbot/slave/arm64/build/target/aarch64-unknown-linux-gnu/release/build/backtrace-sys-87e91972833634cb/out/config.log. Note how one is build/target/release/build, while the other is build/target/aarch64-unknown-linux-gnu/release/build.

@jdm
Copy link
Member Author

@jdm jdm commented Oct 11, 2017

Accordingly, the two configure scripts are invoked slightly differently:
Failed:
/home/servo/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.11/src/libbacktrace/configure --with-pic --disable-multilib --disable-shared --disable-host-shared --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu

Successful:
/home/servo/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.11/src/libbacktrace/configure --with-pic --disable-multilib --disable-shared --disable-host-shared --host=aarch64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu

@jdm
Copy link
Member Author

@jdm jdm commented Oct 11, 2017

Cargo is definitely building backtrace-sys with an unexpected target, according to this output:

TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
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("aarch64-linux-gnu-gcc")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
PROFILE = Some("release")
@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Oct 11, 2017

CC @alexcrichton, in case you’ve seen this before or have some idea what’s going on.

@jdm
Copy link
Member Author

@jdm jdm commented Oct 11, 2017

Well, either it's an unexpected target, or it's expected but cc-rs is finding the wrong compiler for it (perhaps we're setting CC somehow before the backtrace-rs build script is invoked?).

@jdm
Copy link
Member Author

@jdm jdm commented Oct 11, 2017

Ok, so the compiler is being set to the cross binary by the build environment in

build_arm32 = build_arm.without(['SERVO_CACHE_DIR']) + Environment({
'BUILD_TARGET': 'arm-unknown-linux-gnueabihf',
'CC': 'arm-linux-gnueabihf-gcc',
'CXX': 'arm-linux-gnueabihf-g++',
'PATH': ':'.join([
'{{ common.servo_home }}/bin',
'/usr/local/sbin',
'/usr/local/bin',
'/usr/bin',
'/usr/sbin',
'/sbin',
'/bin',
]),
'PKG_CONFIG_PATH': '/usr/lib/arm-linux-gnueabihf/pkgconfig',
})
build_arm64 = build_arm + Environment({
'BUILD_TARGET': 'aarch64-unknown-linux-gnu',
'CC': 'aarch64-linux-gnu-gcc',
'CXX': 'aarch64-linux-gnu-g++',
'PATH': ':'.join([
'{{ common.servo_home }}/bin',
'/usr/local/sbin',
'/usr/local/bin',
'/usr/bin',
'/usr/sbin',
'/sbin',
'/bin',
]),
'PKG_CONFIG_PATH': '/usr/lib/aarch64-linux-gnu/pkgconfig',
'SERVO_RUSTC_WITH_GOLD': 'False',
})
. That's why we see an issue when Cargo builds backtrace with a non-cross target. The mystery remains as to why that's happening - any suggestions for how to figure that out @alexchrichton?

@jdm
Copy link
Member Author

@jdm jdm commented Oct 11, 2017

Oh, I know why this is hitting us on servo/servo#18821 - the new version of metadeps uses error-chain 0.10, which depends on backtrace. dbus and x11-rs both have a build dependency on metadeps, which means that we now compile backtrace for the host system, leading to the situation where we end up selecting the wrong compiler.

@alexcrichton
Copy link

@alexcrichton alexcrichton commented Oct 11, 2017

Interesting! Perhaps this is a case where the env var should be CC_arm-linux-gnueabihf-gcc instead of just CC?

@jdm
Copy link
Member Author

@jdm jdm commented Oct 11, 2017

That sounds like a good solution; thanks!

bors-servo added a commit that referenced this issue Oct 12, 2017
Specify compilers only for cross-compilation

This should fix #683.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/saltfs/732)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.