Skip to content

Enable profiler=true in config.toml and target = [wasm32-unknown-unknown] will cause bootstrap fail #78329

Closed
@12101111

Description

@12101111

I'm trying to build rust with profiler support in Gentoo Linux.

The config.toml:

[llvm]
optimize = true
release-debuginfo = false
assertions = false
ninja = true
targets = "X86;ARM;AArch64;RISCV;WebAssembly;AMDGPU;BPF"
experimental-targets = ""
link-shared = true
use-libcxx = true
[build]
build = "x86_64-unknown-linux-gnu"
host = ["x86_64-unknown-linux-gnu"]
target = ["x86_64-unknown-linux-gnu","wasm32-unknown-unknown"]
cargo = "/usr/lib/rust/1.47.0/bin/cargo"
rustc = "/usr/lib/rust/1.47.0/bin/rustc"
docs = false
compiler-docs = false
submodules = false
python = "python3.9"
locked-deps = true
vendor = true
extended = true
tools = ["rustfmt","rls","analysis","src","miri","clippy","cargo",]
verbose = 1
sanitizers = true
profiler = true
cargo-native-static = false
[install]
prefix = "/usr/lib/rust/1.47.0"
sysconfdir = "etc"
docdir = "share/doc/rust"
bindir = "bin"
libdir = "lib"
mandir = "share/man"
[rust]
# https://github.com/rust-lang/rust/issues/54872
codegen-units-std = 1
optimize = true
debug = false
debug-assertions = false
debuginfo-level-rustc = 0
backtrace = true
incremental = false
default-linker = "clang"
parallel-compiler = true
channel = "nightly"
rpath = false
verbose-tests = true
optimize-tests = true
codegen-tests = true
dist-src = false
remap-debuginfo = true
lld = false
backtrace-on-ice = true
jemalloc = false
[dist]
src-tarball = false
[target.x86_64-unknown-linux-gnu]
cc = "clang"
cxx = "clang++"
linker = "clang"
ar = "llvm-ar"
llvm-config = "/usr/lib/llvm/11/bin/llvm-config"
[target.wasm32-unknown-unknown]
linker = "lld"

And log:

libdir: "/usr/lib/rust/1.47.0/lib"
     Running `/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/build/x86_64-unknown-linux-gnu/stage2-std/release/build/compiler_builtins-b5a017e01bbe25e7/build-script-build`
     Running `/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/build/x86_64-unknown-linux-gnu/stage2-std/release/build/unwind-e198a4d246959a50/build-script-build`
     Running `/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/build/x86_64-unknown-linux-gnu/stage2-std/release/build/dlmalloc-467a08e53f9bc8a2/build-script-build`
     Running `/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/build/x86_64-unknown-linux-gnu/stage2-std/release/build/profiler_builtins-9cfe97611d835f7d/build-script-build`
     Running `/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/build/x86_64-unknown-linux-gnu/stage2-std/release/build/hashbrown-302bc88665f9ec43/build-script-build`
     Running `/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/build/x86_64-unknown-linux-gnu/stage2-std/release/build/std-ab9e34662867ca47/build-script-build`
The following warnings were emitted during compilation:

warning: ../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c:24:10: fatal error: 'errno.h' file not found
warning: #include <errno.h>
warning:          ^~~~~~~~~
warning: 1 error generated.

error: failed to run custom build command for `profiler_builtins v0.0.0 (/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/library/profiler_builtins)`

Caused by:
  process didn't exit successfully: `/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/build/x86_64-unknown-linux-gnu/stage2-std/release/build/profiler_builtins-9cfe97611d835f7d/build-script-build` (exit code: 1)
  --- stdout
  TARGET = Some("wasm32-unknown-unknown")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_wasm32-unknown-unknown = Some("clang")
  CFLAGS_wasm32-unknown-unknown = Some("-ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown -march=skylake -mtune=skylake -pipe -falign-functions=32 -fomit-frame-pointer -ffunction-sections -fdata-sections -flto=thin -fdebug-prefix-map=/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src=/rustc/1.47.0")
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-march=skylake" "-mtune=skylake" "-pipe" "-falign-functions=32" "-fomit-frame-pointer" "-ffunction-sections" "-fdata-sections" "-flto=thin" "-fdebug-prefix-map=/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src=/rustc/1.47.0" "-I" "../../src/llvm-project/compiler-rt/include" "-fno-builtin" "-fvisibility=hidden" "-fomit-frame-pointer" "-DVISIBILITY_HIDDEN" "-DCOMPILER_RT_HAS_UNAME=1" "-DCOMPILER_RT_HAS_ATOMICS=1" "-o" "/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/build/x86_64-unknown-linux-gnu/stage2-std/wasm32-unknown-unknown/release/build/profiler_builtins-dba639b24db09605/out/../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.o" "-c" "../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c"
  cargo:warning=../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c:24:10: fatal error: 'errno.h' file not found
  cargo:warning=#include <errno.h>
  cargo:warning=         ^~~~~~~~~
  cargo:warning=1 error generated.
  exit code: 1

  --- stderr


  error occurred: Command "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-march=skylake" "-mtune=skylake" "-pipe" "-falign-functions=32" "-fomit-frame-pointer" "-ffunction-sections" "-fdata-sections" "-flto=thin" "-fdebug-prefix-map=/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src=/rustc/1.47.0" "-I" "../../src/llvm-project/compiler-rt/include" "-fno-builtin" "-fvisibility=hidden" "-fomit-frame-pointer" "-DVISIBILITY_HIDDEN" "-DCOMPILER_RT_HAS_UNAME=1" "-DCOMPILER_RT_HAS_ATOMICS=1" "-o" "/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/build/x86_64-unknown-linux-gnu/stage2-std/wasm32-unknown-unknown/release/build/profiler_builtins-dba639b24db09605/out/../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.o" "-c" "../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c" with args "clang" did not execute successfully (status code exit code: 1).


warning: build failed, waiting for other jobs to finish...
'skylake' is not a recognized processor for this target (ignoring processor)
'skylake' is not a recognized processor for this target (ignoring processor)
'skylake' is not a recognized processor for this target (ignoring processor)
'skylake' is not a recognized processor for this target (ignoring processor)
'skylake' is not a recognized processor for this target (ignoring processor)
'skylake' is not a recognized processor for this target (ignoring processor)
'skylake' is not a recognized processor for this target (ignoring processor)
'skylake' is not a recognized processor for this target (ignoring processor)
error: build failed
command did not execute successfully: "/usr/lib/rust/1.47.0/bin/cargo" "build" "--target" "wasm32-unknown-unknown" "-Zbinary-dep-depinfo" "-j" "12" "-v" "--release" "--locked" "--frozen" "--features" "panic-unwind backtrace profiler compiler-builtins-c" "--manifest-path" "/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/library/test/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit code: 101
Traceback (most recent call last):
  File "/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/./x.py", line 11, in <module>
    bootstrap.main()
  File "/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/src/bootstrap/bootstrap.py", line 1009, in main
    bootstrap(help_triggered)
  File "/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/src/bootstrap/bootstrap.py", line 995, in bootstrap
    run(args, env=env, verbose=build.verbose)
  File "/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/src/bootstrap/bootstrap.py", line 143, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/build/bootstrap/debug/bootstrap dist -vv --config=/tmp/portage/dev-lang/rust-1.47.0-r1/work/rustc-1.47.0-src/config.toml -j12

I think profiler (and maybe sanitizers) should be an option pre target, not a global option under build section. For example we can enable profiler for x86_64-unknown-linux-gnu and disable it for wasm32-unknown-unknown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions