semarie / build-rust

Script helper for building rustc and cargo from source on OpenBSD (without rustup)
59 stars 15 forks source link

LLVM >= 14.0 is required to build nightly #21

Closed zacknewman closed 1 year ago

zacknewman commented 1 year ago

I realize that building nightly is only supported on -current; however I believe the error I get on -stable would be relevant on -current too since LLVM in -current is 13.0.0p7. I am a little surprised that LLVM hasn't been updated since 16.0.0 was released back in March. I am sure there are reasons for not updating LLVM, but this kind of thing may become more common as LLVM progresses. Regardless, here is the last portion of the build I get:

   Compiling sysroot v0.0.0 (/home/zack/build_rust/build_dir/rustc-beta-src/library/sysroot)
     Running `/home/zack/build_rust/build_dir/build/bootstrap/debug/rustc --crate-name sysroot --edition=2021 library/sysroot/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 --cfg 'feature="backtrace"' --cfg 'feature="compiler-builtins-c"' --cfg 'feature="default"' --cfg 'feature="panic-unwind"' --cfg 'feature="std_detect_dlsym_getauxval"' --cfg 'feature="std_detect_file_io"' -Zunstable-options --check-cfg 'names()' --check-cfg 'values()' -C metadata=8f33ad4e63e5a25d -C extra-filename=-8f33ad4e63e5a25d --out-dir /home/zack/build_rust/build_dir/build/x86_64-unknown-openbsd/stage0-std/x86_64-unknown-openbsd/release/deps --target x86_64-unknown-openbsd -L dependency=/home/zack/build_rust/build_dir/build/x86_64-unknown-openbsd/stage0-std/x86_64-unknown-openbsd/release/deps -L dependency=/home/zack/build_rust/build_dir/build/x86_64-unknown-openbsd/stage0-std/release/deps --extern proc_macro=/home/zack/build_rust/build_dir/build/x86_64-unknown-openbsd/stage0-std/x86_64-unknown-openbsd/release/deps/libproc_macro-7eeb8135002120d3.rmeta --extern std=/home/zack/build_rust/build_dir/build/x86_64-unknown-openbsd/stage0-std/x86_64-unknown-openbsd/release/deps/libstd-90c0cad1b41ecdae.so --extern std=/home/zack/build_rust/build_dir/build/x86_64-unknown-openbsd/stage0-std/x86_64-unknown-openbsd/release/deps/libstd-90c0cad1b41ecdae.rlib --extern test=/home/zack/build_rust/build_dir/build/x86_64-unknown-openbsd/stage0-std/x86_64-unknown-openbsd/release/deps/libtest-4ddf59992c37e7f0.so --extern test=/home/zack/build_rust/build_dir/build/x86_64-unknown-openbsd/stage0-std/x86_64-unknown-openbsd/release/deps/libtest-4ddf59992c37e7f0.rlib --cfg=bootstrap -Csymbol-mangling-version=legacy -Zunstable-options -Zunstable-options '--check-cfg=values(bootstrap)' '--check-cfg=values(stdarch_intel_sde)' '--check-cfg=values(no_fp_fmt_parse)' '--check-cfg=values(no_global_oom_handling)' '--check-cfg=values(no_rc)' '--check-cfg=values(no_sync)' '--check-cfg=values(freebsd12)' '--check-cfg=values(freebsd13)' '--check-cfg=values(backtrace_in_libstd)' '--check-cfg=values(target_env,"libnx")' '--check-cfg=values(target_arch,"asmjs","spirv","nvptx","xtensa")' -Zmacro-backtrace -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Zunstable-options -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/beta/")' -Z binary-dep-depinfo -L native=/usr/lib`
    Finished release [optimized] target(s) in 1m 02s
thread 'main' panicked at '

bad LLVM version: 13.0.0
, need >=14.0

', llvm.rs:532:5
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: bootstrap::llvm::check_llvm_version
             at ./src/bootstrap/llvm.rs:532:5
   3: bootstrap::llvm::prebuilt_llvm_config
             at ./src/bootstrap/llvm.rs:84:13
   4: bootstrap::compile::rustc_cargo_env
             at ./src/bootstrap/compile.rs:940:37
   5: bootstrap::compile::rustc_cargo
             at ./src/bootstrap/compile.rs:882:5
   6: <bootstrap::compile::Rustc as bootstrap::builder::Step>::run
             at ./src/bootstrap/compile.rs:767:9
   7: bootstrap::builder::Builder::ensure
             at ./src/bootstrap/builder.rs:2055:23
   8: <bootstrap::compile::Assemble as bootstrap::builder::Step>::run
             at ./src/bootstrap/compile.rs:1516:9
   9: bootstrap::builder::Builder::ensure
             at ./src/bootstrap/builder.rs:2055:23
  10: bootstrap::builder::Builder::compiler
             at ./src/bootstrap/builder.rs:943:9
  11: <bootstrap::compile::Assemble as bootstrap::builder::Step>::run
             at ./src/bootstrap/compile.rs:1495:30
  12: bootstrap::builder::Builder::ensure
             at ./src/bootstrap/builder.rs:2055:23
  13: bootstrap::builder::Builder::compiler
             at ./src/bootstrap/builder.rs:943:9
  14: <bootstrap::doc::TheBook as bootstrap::builder::Step>::make_run
             at ./src/bootstrap/doc.rs:180:23
  15: bootstrap::builder::StepDescription::maybe_run
             at ./src/bootstrap/builder.rs:278:13
  16: bootstrap::builder::StepDescription::run
             at ./src/bootstrap/builder.rs:315:21
  17: bootstrap::builder::Builder::run_step_descriptions
             at ./src/bootstrap/builder.rs:935:9
  18: bootstrap::builder::Builder::default_doc
             at ./src/bootstrap/builder.rs:920:9
  19: <bootstrap::dist::Docs as bootstrap::builder::Step>::run
             at ./src/bootstrap/dist.rs:76:9
  20: bootstrap::builder::Builder::ensure
             at ./src/bootstrap/builder.rs:2055:23
  21: <bootstrap::dist::Docs as bootstrap::builder::Step>::make_run
             at ./src/bootstrap/dist.rs:70:9
  22: bootstrap::builder::StepDescription::maybe_run
             at ./src/bootstrap/builder.rs:278:13
  23: bootstrap::builder::StepDescription::run
             at ./src/bootstrap/builder.rs:315:21
  24: bootstrap::builder::Builder::run_step_descriptions
             at ./src/bootstrap/builder.rs:935:9
  25: bootstrap::builder::Builder::execute_cli
             at ./src/bootstrap/builder.rs:916:9
  26: bootstrap::Build::build
             at ./src/bootstrap/lib.rs:701:13
  27: bootstrap::main
             at ./src/bootstrap/bin/main.rs:74:5
  28: core::ops::function::FnOnce::call_once
             at /usr/ports/pobj/rust-1.71.1/rustc-1.71.1-src/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Traceback (most recent call last):
  File "/home/zack/build_rust/build_dir/rustc-beta-src/x.py", line 50, in <module>
    bootstrap.main()
  File "/home/zack/build_rust/build_dir/rustc-beta-src/src/bootstrap/bootstrap.py", line 1113, in main
    bootstrap(args)
  File "/home/zack/build_rust/build_dir/rustc-beta-src/src/bootstrap/bootstrap.py", line 1088, in bootstrap
    run(args, env=env, verbose=build.verbose, is_bootstrap=True)
  File "/home/zack/build_rust/build_dir/rustc-beta-src/src/bootstrap/bootstrap.py", line 184, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /home/zack/build_rust/build_dir/build/bootstrap/debug/bootstrap --config /home/zack/build_rust/build_dir/config.toml --build-dir /home/zack/build_rust/build_dir/build dist --jobs=8
Sat Aug  5 21:32:20 MDT 2023: task not finished: see build.log for detail
Sat Aug  5 21:32:20 MDT 2023: task not finished: see build.log for detail
semarie commented 1 year ago

you need to build it with the embedded llvm version (or an external llvm>=14 build). I don't have put it by default in build.sh for now.

it could be configured via ~/.build_rust.conf:

$ echo llvm_config=no >> ${HOME}/.build_rust.conf`

you are strongly adviced to use ccache to avoid painful llvm rebuild.

zacknewman commented 1 year ago

it could be configured via ~/.build_rust.conf:

$ echo llvm_config=no >> ${HOME}/.build_rust.conf`

Nice, that fixed that error.

you are strongly adviced to use ccache to avoid painful llvm rebuild.

Indeed. Fortunately it is on by default.