Skip to content

Cannot build compiler_builtins_shim for i686 targets #216

@robert-w-gries

Description

@robert-w-gries

While building i686 targets, there is an internal error while building compiler_builtins due to a missing file: fatal error: sys/cdefs.h: No such file or directory.

Initially I thought it was an issue with the compiler_builtins crate, but it seems like there's some magic that xargo needs to do in order to compile the C shims in compiler_builtins. Can I get some clarification on what xargo is expected to do? Did rust-lang/rust#49503 cause a regression in xargo?

From rust-lang/compiler-builtins#239 (comment)

Ah sorry indeed! Regardless to compile compiler-builtins you'll need a C compiler as some C shims are compiled. To disable this I believe xargo has necessary support to disable the C shims from being compiled, right?

Nightly Version

$ rustup show
[snip]

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.27.0-nightly (4b9b70c39 2018-04-09)

Reproduction Steps

$ rustup component add rust-src
$ cargo install xargo
$ xargo new foo --bin
     Created binary (application) `foo` project
$ cd foo/
$ echo "[dependencies.alloc]" > Xargo.toml
$ xargo build --target i686-unknown-linux-gnu

Error Message

$ xargo build --target i686-unknown-linux-gnu
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling cc v1.0.9                                                          
   Compiling core v0.0.0 (file:///home/rob/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore)
   Compiling compiler_builtins v0.0.0 (file:///home/rob/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/rustc/compiler_builtins_shim)
error: failed to run custom build command for `compiler_builtins v0.0.0 (file:///home/rob/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/rustc/compiler_builtins_shim)`
process didn't exit successfully: `/tmp/xargo.Uqnk6A23t05W/target/release/build/compiler_builtins-f55661e1d900651e/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=build.rs
cargo:rerun-if-changed=../../libcompiler_builtins/compiler-rt/lib/builtins/absvdi2.c
[snip]
TARGET = Some("i686-unknown-linux-gnu")
OPT_LEVEL = Some("3")
TARGET = Some("i686-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("i686-unknown-linux-gnu")
TARGET = Some("i686-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_i686-unknown-linux-gnu = None
CC_i686_unknown_linux_gnu = None
TARGET_CC = None
CC = None
HOST = Some("x86_64-unknown-linux-gnu")
CROSS_COMPILE = None
TARGET = Some("i686-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_i686-unknown-linux-gnu = None
CFLAGS_i686_unknown_linux_gnu = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
TARGET = Some("i686-unknown-linux-gnu")
CC_i686-unknown-linux-gnu = None
CC_i686_unknown_linux_gnu = None
HOST_CC = None
CC = None
CFLAGS_i686-unknown-linux-gnu = None
CFLAGS_i686_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m32" "-march=i686" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/tmp/xargo.Uqnk6A23t05W/target/i686-unknown-linux-gnu/release/build/compiler_builtins-2536234101d25e1c/out/../../libcompiler_builtins/compiler-rt/lib/builtins/absvdi2.o" "-c" "../../libcompiler_builtins/compiler-rt/lib/builtins/absvdi2.c"
cargo:warning=In file included from /usr/include/limits.h:25:0,
cargo:warning=                 from /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h:168,
cargo:warning=                 from /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h:7,
cargo:warning=                 from /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h:34,
cargo:warning=                 from ../../libcompiler_builtins/compiler-rt/lib/builtins/int_lib.h:68,
cargo:warning=                 from ../../libcompiler_builtins/compiler-rt/lib/builtins/absvdi2.c:15:
cargo:warning=/usr/include/features.h:367:25: fatal error: sys/cdefs.h: No such file or directory
cargo:warning=compilation terminated.
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m32" "-march=i686" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/tmp/xargo.Uqnk6A23t05W/target/i686-unknown-linux-gnu/release/build/compiler_builtins-2536234101d25e1c/out/../../libcompiler_builtins/compiler-rt/lib/builtins/absvdi2.o" "-c" "../../libcompiler_builtins/compiler-rt/lib/builtins/absvdi2.c" with args "cc" did not execute successfully (status code exit code: 1).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions