rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
94.73k stars 12.21k forks source link

Undefined reference to _Unwind_Resume while building rust #77394

Closed kamleshbhalui closed 1 year ago

kamleshbhalui commented 3 years ago

This is my config.toml https://gist.github.com/kamleshbhalui/fcf70a8f4167565f7e73e90d13d468fa#file-config-toml

with latest rust clone(01-10-2020)

kk@bft:~/kkumar/tcrust/rust$ ./x.py build
Updating only changed submodules
Submodules updated in 0.02 seconds
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
warning: there have been changes to x.py since you last updated.
help: consider looking at the changes in `src/bootstrap/CHANGELOG.md`
note: to silence this warning, update `config.toml` to use `changelog-seen = 2` instead
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
warning: clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
warning: clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
warning: clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Warning: Using a potentially stale build of LLVM; This may not behave well.
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling rustc-main v0.0.0 (/home/kk/kkumar/tcrust/rust/compiler/rustc)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps/rustc_main-94cb1cb8926e03c7.rustc_main.6tvyscmt-cgu.0.rcgu.o" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps/rustc_main-94cb1cb8926e03c7.rustc_main.6tvyscmt-cgu.1.rcgu.o" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps/rustc_main-94cb1cb8926e03c7.rustc_main.6tvyscmt-cgu.2.rcgu.o" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps/rustc_main-94cb1cb8926e03c7.rustc_main.6tvyscmt-cgu.3.rcgu.o" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps/rustc_main-94cb1cb8926e03c7.rustc_main.6tvyscmt-cgu.4.rcgu.o" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps/rustc_main-94cb1cb8926e03c7.rustc_main.6tvyscmt-cgu.5.rcgu.o" "-o" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps/rustc_main-94cb1cb8926e03c7" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/debug/deps" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/build/psm-4c0f9e3482013a15/out" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/build/rustc_llvm-b9795b1e6297eaa6/out" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/llvm/build/lib" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps" "-lrustc_driver-0ae0081ba804a81b" "-Wl,--start-group" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lstd-a63d869bbe5faab4" "-Wl,--end-group" "-Wl,-Bstatic" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-95f25047f5ee0888.rlib" "-Wl,-Bdynamic" "-lLLVM-11-rust-dev" "-lstdc++" "-lutil" "-ldl" "-lutil" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-ldl" "-lutil" "-Wl,-rpath,$ORIGIN/../lib" "-fuse-ld=lld"
  = note: ld.lld: error: undefined symbol: _Unwind_Resume
          >>> referenced by backtrace.rs:133 (/home/kk/kkumar/tcrust/rust/library/std/src/sys_common/backtrace.rs:133)
          >>>               /home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps/rustc_main-94cb1cb8926e03c7.rustc_main.6tvyscmt-cgu.1.rcgu.o:(std::sys_common::backtrace::__rust_begin_short_backtrace::h5aff1a3e81510b04)
          >>> referenced by function.rs:227 (/home/kk/kkumar/tcrust/rust/library/core/src/ops/function.rs:227)
          >>>               /home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps/rustc_main-94cb1cb8926e03c7.rustc_main.6tvyscmt-cgu.2.rcgu.o:(core::ops::function::FnOnce::call_once::he071d4a4bec6654b)
          collect2: error: ld returned 1 exit status

error: aborting due to previous error

error: could not compile `rustc-main`.

To learn more, run the command again with --verbose.
command did not execute successfully: "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "8" "--features" " llvm" "--manifest-path" "/home/kk/kkumar/tcrust/rust/compiler/rustc/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit code: 101
failed to run: /home/kk/kkumar/tcrust/rust/build/bootstrap/debug/bootstrap build
Build completed unsuccessfully in 0:00:01
jyn514 commented 3 years ago
# Whether or not to optimize the compiler and standard library.
# WARNING: Building with optimize = false is NOT SUPPORTED. Due to bootstrapping,
# building without optimizations takes much longer than optimizing. Further, some platforms
# fail to build without this optimization (c.f. #65352).
optimize = false

Try setting this to optimize = true; like the comment says, the reverse isn't supported.

kamleshbhalui commented 3 years ago

@jyn514 I will try enabling optimization but Error says this ld.lld: error: undefined symbol: _Unwind_Resume it looks like build system unable to pick libunwind?

kamleshbhalui commented 3 years ago

@jyn514 enabling optimization does not resolve this. rror: linking with cc failed: exit code: 1 | = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_main-3446de28edb6057f.rustc_main.7bi47v63-cgu.0.rcgu.o" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_main-3446de28edb6057f.rustc_main.7bi47v63-cgu.1.rcgu.o" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_main-3446de28edb6057f.rustc_main.7bi47v63-cgu.2.rcgu.o" "-o" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_main-3446de28edb6057f" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/psm-be6e39de58eb97a5/out" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/rustc_llvm-f0dd5221ee9b93aa/out" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/llvm/build/lib" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps" "-lrustc_driver-5b90eefb08e3d62c" "-Wl,--start-group" "-L" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lstd-e05788ae03266863" "-Wl,--end-group" "-Wl,-Bstatic" "/home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-008b50954fae7ba2.rlib" "-Wl,-Bdynamic" "-lLLVM-11-rust-dev" "-lstdc++" "-lutil" "-ldl" "-lutil" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-ldl" "-lutil" "-Wl,-rpath,$ORIGIN/../lib" "-fuse-ld=lld" = note: ld.lld: error: /home/kk/kkumar/tcrust/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_driver-5b90eefb08e3d62c.so: undefined reference to _Unwind_Resume collect2: error: ld returned 1 exit status

error: aborting due to previous error

error: could not compile rustc-main.

mati865 commented 3 years ago

Duplicate of https://github.com/rust-lang/rust/issues/76020

John-Nagle commented 2 years ago

Reproduce in stable Rust by:

git clone https://github.com/BVE-Reborn/rend3.git 
cd rend3
cargo build --target i686-pc-windows-gnu

Environment: Ubuntu 20.04 LTS x64, rustc 1.59.0 (9d1b2106e 2022-02-23)

jyn514 commented 1 year ago

Closing as a duplicate of https://github.com/rust-lang/rust/issues/76020.