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

Clippy and Miri don't build on arm* and aarch64 dist builders #57812

Closed
mati865 opened this issue Jan 21, 2019 · 6 comments
Closed

Clippy and Miri don't build on arm* and aarch64 dist builders #57812

mati865 opened this issue Jan 21, 2019 · 6 comments
Labels
O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state

Comments

@mati865
Copy link
Contributor

mati865 commented Jan 21, 2019

Originally reported as rust-lang/rust-clippy#3682

Building stage2 tool clippy-driver (armv7-unknown-linux-gnueabihf)
[01:30:05] �[0m�[0m�[1m�[32m   Compiling�[0m matches v0.1.8
[01:30:05] �[0m�[0m�[1m�[32m   Compiling�[0m cfg-if v0.1.6
[01:30:05] �[0m�[0m�[1m�[32m   Compiling�[0m rustc-demangle v0.1.10
[01:30:05] �[0m�[0m�[1m�[32m   Compiling�[0m void v1.0.2
[01:30:06] �[0m�[0m�[1m�[32m   Compiling�[0m itoa v0.4.3
[01:30:06] �[0m�[0m�[1m�[32m   Compiling�[0m unicode-normalization v0.1.7
[01:30:06] �[0m�[0m�[1m�[32m   Compiling�[0m pulldown-cmark v0.2.0
[01:30:06] �[0m�[0m�[1m�[32m   Compiling�[0m ucd-util v0.1.3
[01:30:06] �[0m�[0m�[1m�[32m   Compiling�[0m bitflags v1.0.4
[01:30:06] �[0m�[0m�[1m�[32m   Compiling�[0m lazy_static v1.2.0
[01:30:06] �[0m�[0m�[1m�[32m   Compiling�[0m rustc_tools_util v0.1.1 (/checkout/src/tools/clippy/rustc_tools_util)
[01:30:07] �[0m�[0m�[1m�[32m   Compiling�[0m either v1.5.0
[01:30:07] �[0m�[0m�[1m�[32m   Compiling�[0m getopts v0.2.17
[01:30:07] �[0m�[0m�[1m�[32m   Compiling�[0m percent-encoding v1.0.1
[01:30:07] �[0m�[0m�[1m�[32m   Compiling�[0m if_chain v0.1.3
[01:30:08] �[0m�[0m�[1m�[32m   Compiling�[0m utf8-ranges v1.0.2
[01:30:09] �[0m�[0m�[1m�[32m   Compiling�[0m quine-mc_cluskey v0.2.4
[01:30:09] [RUSTC-TIMING] if_chain test:false 0.088
[01:30:13] �[0m�[0m�[1m�[32m   Compiling�[0m libc v0.2.46
[01:30:14] [RUSTC-TIMING] quine_mc_cluskey test:false 3.619
[01:30:14] �[0m�[0m�[1m�[32m   Compiling�[0m ryu v0.2.7
[01:30:14] �[0m�[0m�[1m�[32m   Compiling�[0m unicode-bidi v0.3.4
[01:30:14] [RUSTC-TIMING] rustc_tools_util test:false 1.463
[01:30:14] �[0m�[0m�[1m�[32m   Compiling�[0m unreachable v1.0.0
[01:30:14] �[0m�[0m�[1m�[32m   Compiling�[0m thread_local v0.3.6
[01:30:14] �[0m�[0m�[1m�[32m   Compiling�[0m regex-syntax v0.6.4
[01:30:16] �[0m�[0m�[1m�[32m   Compiling�[0m regex v1.1.0
[01:30:17] �[0m�[0m�[1m�[32m   Compiling�[0m itertools v0.7.8
[01:30:17] �[0m�[0m�[1m�[32m   Compiling�[0m clippy v0.0.212 (/checkout/src/tools/clippy)
[01:30:18] �[0m�[0m�[1m�[32m   Compiling�[0m backtrace-sys v0.1.27
[01:30:18] �[0m�[0m�[1m�[31merror:�[0m failed to run custom build command for `backtrace-sys v0.1.27`
[01:30:18] process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/build/backtrace-sys-f26ee4d1457ff7f2/build-script-build` (exit code: 101)
[01:30:18] --- stdout
[01:30:18] cargo:rustc-cfg=rbt
[01:30:18] TARGET = Some("x86_64-unknown-linux-gnu")
[01:30:18] OPT_LEVEL = Some("2")
[01:30:18] HOST = Some("x86_64-unknown-linux-gnu")
[01:30:18] CC_x86_64-unknown-linux-gnu = None
[01:30:18] CC_x86_64_unknown_linux_gnu = None
[01:30:18] HOST_CC = None
[01:30:18] CC = Some("sccache armv7-unknown-linux-gnueabihf-gcc")
[01:30:18] CFLAGS_x86_64-unknown-linux-gnu = None
[01:30:18] CFLAGS_x86_64_unknown_linux_gnu = None
[01:30:18] HOST_CFLAGS = None
[01:30:18] CFLAGS = Some("-ffunction-sections -fdata-sections -fPIC -march=armv7-a")
[01:30:18] running: "sccache" "armv7-unknown-linux-gnueabihf-gcc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=armv7-a" "-m64" "-I" "src/libbacktrace" "-I" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/build/backtrace-sys-d9226a261fade31f/out" "-fvisibility=hidden" "-DBACKTRACE_ELF_SIZE=64" "-DBACKTRACE_SUPPORTED=1" "-DBACKTRACE_USES_MALLOC=1" "-DBACKTRACE_SUPPORTS_THREADS=0" "-DBACKTRACE_SUPPORTS_DATA=0" "-DHAVE_DL_ITERATE_PHDR=1" "-D_GNU_SOURCE=1" "-D_LARGE_FILES=1" "-Dbacktrace_full=__rbt_backtrace_full" "-Dbacktrace_dwarf_add=__rbt_backtrace_dwarf_add" "-Dbacktrace_initialize=__rbt_backtrace_initialize" "-Dbacktrace_pcinfo=__rbt_backtrace_pcinfo" "-Dbacktrace_syminfo=__rbt_backtrace_syminfo" "-Dbacktrace_get_view=__rbt_backtrace_get_view" "-Dbacktrace_release_view=__rbt_backtrace_release_view" "-Dbacktrace_alloc=__rbt_backtrace_alloc" "-Dbacktrace_free=__rbt_backtrace_free" "-Dbacktrace_vector_finish=__rbt_backtrace_vector_finish" "-Dbacktrace_vector_grow=__rbt_backtrace_vector_grow" "-Dbacktrace_vector_release=__rbt_backtrace_vector_release" "-Dbacktrace_close=__rbt_backtrace_close" "-Dbacktrace_open=__rbt_backtrace_open" "-Dbacktrace_print=__rbt_backtrace_print" "-Dbacktrace_simple=__rbt_backtrace_simple" "-Dbacktrace_qsort=__rbt_backtrace_qsort" "-Dbacktrace_create_state=__rbt_backtrace_create_state" "-Dbacktrace_uncompress_zdebug=__rbt_backtrace_uncompress_zdebug" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/build/backtrace-sys-d9226a261fade31f/out/src/libbacktrace/alloc.o" "-c" "src/libbacktrace/alloc.c"
[01:30:18] cargo:warning=armv7-unknown-linux-gnueabihf-gcc: error: unrecognized command line option '-m64'
[01:30:18] exit code: 1
[01:30:18] 
[01:30:18] --- stderr
[01:30:18] thread 'main' panicked at '
[01:30:18] 
[01:30:18] Internal error occurred: Command "sccache" "armv7-unknown-linux-gnueabihf-gcc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=armv7-a" "-m64" "-I" "src/libbacktrace" "-I" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/build/backtrace-sys-d9226a261fade31f/out" "-fvisibility=hidden" "-DBACKTRACE_ELF_SIZE=64" "-DBACKTRACE_SUPPORTED=1" "-DBACKTRACE_USES_MALLOC=1" "-DBACKTRACE_SUPPORTS_THREADS=0" "-DBACKTRACE_SUPPORTS_DATA=0" "-DHAVE_DL_ITERATE_PHDR=1" "-D_GNU_SOURCE=1" "-D_LARGE_FILES=1" "-Dbacktrace_full=__rbt_backtrace_full" "-Dbacktrace_dwarf_add=__rbt_backtrace_dwarf_add" "-Dbacktrace_initialize=__rbt_backtrace_initialize" "-Dbacktrace_pcinfo=__rbt_backtrace_pcinfo" "-Dbacktrace_syminfo=__rbt_backtrace_syminfo" "-Dbacktrace_get_view=__rbt_backtrace_get_view" "-Dbacktrace_release_view=__rbt_backtrace_release_view" "-Dbacktrace_alloc=__rbt_backtrace_alloc" "-Dbacktrace_free=__rbt_backtrace_free" "-Dbacktrace_vector_finish=__rbt_backtrace_vector_finish" "-Dbacktrace_vector_grow=__rbt_backtrace_vector_grow" "-Dbacktrace_vector_release=__rbt_backtrace_vector_release" "-Dbacktrace_close=__rbt_backtrace_close" "-Dbacktrace_open=__rbt_backtrace_open" "-Dbacktrace_print=__rbt_backtrace_print" "-Dbacktrace_simple=__rbt_backtrace_simple" "-Dbacktrace_qsort=__rbt_backtrace_qsort" "-Dbacktrace_create_state=__rbt_backtrace_create_state" "-Dbacktrace_uncompress_zdebug=__rbt_backtrace_uncompress_zdebug" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/build/backtrace-sys-d9226a261fade31f/out/src/libbacktrace/alloc.o" "-c" "src/libbacktrace/alloc.c" with args "armv7-unknown-linux-gnueabihf-gcc" did not execute successfully (status code exit code: 1).
[01:30:18] 

Full build logs are available here:
armv7 Travis: https://api.travis-ci.com/v3/job/171742865/log.txt
aarch64 Travis: https://api.travis-ci.com/v3/job/171742861/log.txt

These cross toolchains don't accept -m64 argument which shouldn't be passed for them.
I believe the issue is TARGET is the same as HOST ("x86_64-unknown-linux-gnu") while it should be arm* or aarch64 depending on the builder.

cc @alexcrichton

@alexcrichton
Copy link
Member

The TARGET and CC are mismatched here, I'm not really sure why but that's the bug

@mati865
Copy link
Contributor Author

mati865 commented Jan 23, 2019

CC looks fine for me, it matches the true target.

Looking at the Cargo invocation TARGET should be set correctly:
"/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "armv7-unknown-linux-gnueabihf" "-j" "4" "--release" "--locked" "--color" "always" "--manifest-path" "/checkout/src/tools/clippy/Cargo.toml" "--features" "rustc-workspace-hack/all-static" "--message-format" "json"
Maybe some environment variable takes precendence over --target armv7-unknown-linux-gnueabihf argument.

Have checked Rust dist code and I'm leaning towards caching or Cargo issue, --target argument should create proper environment after all.

@alexcrichton
Copy link
Member

It does not match the target:

[01:30:18] TARGET = Some("x86_64-unknown-linux-gnu")
[01:30:18] CC = Some("sccache armv7-unknown-linux-gnueabihf-gcc")

-m64 is pssed because the target is x86_64, adn it's not accepted because it's an arm compiler.

@mati865
Copy link
Contributor Author

mati865 commented Jan 23, 2019

I haven't worded it properly but it's what I tried to say.

CC matches true target (in this case rmv7-unknown-linux-gnueabihf-gcc) but TARGET is wrong because it's the same as HOST when the tool should be cross compiled to arm.

@alexcrichton
Copy link
Member

I don't believe that's in error, it's how cross compilation works that not everything is compiled for the target. Things like procedural macros and their dependencies are compiled for the host, and in this case something for the host depends on the backtrace crate which requires a C compiler.

Something in the build system is setting CC when it shouldn't, only CC_$target should be used by rustbuild.

@mati865
Copy link
Contributor Author

mati865 commented Jan 23, 2019

Thanks for the feedback, I thought it should produce tools that will run on the target at this point (it's stage 2 on the dist builder).

In this case I'll see if I can figure out where CC is coming from.

@jonas-schievink jonas-schievink added A-build O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state labels Jan 27, 2019
bors added a commit that referenced this issue Jan 29, 2019
Do not set CC, CFLAGS, CXX, CXXFLAGS, AR, RANLIB in bootstrap, it breaks cross compilation

Fixes #57812

I tested it in AArch64 Ubuntu container with several days old tree to have all the tools buildable.

I did **not** test native builds (amd64 -> amd64), leaving it to CI.

r? @alexcrichton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state
Projects
None yet
Development

No branches or pull requests

3 participants