-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
rustc aborts when there is a compilation failure on FreeBSD and OpenBSD #43575
Comments
I have the same problem with OpenBSD if I switch from Under this configuration ( A simple way to reproduce the error is to run
The error is correctly reported ("no input filename given"), but just after rustc die due to internal panic error. I am suspecting a problem between rust and libc++ regarding unwinding. It could be a rustc problem as a libc++/libc++abi problem. Please note that all unitary tests on panicking/unwinding passes. Running via gdb, with unwind debugging:
@Mark-Simulacrum could you update the tags please ? |
I confirm that building with |
Using a rustc binary compiled with
the main difference is where libunwind stop to unwind the stack trace. in bogus one, libunwind found in right one, libunwind found an anonymous function just after, and continue unwinding with |
I finally found that i686-unknown-linux-musl, which use also libunwind from LLVM, uses a workaround for the same issue: it uses This way, all programs compiled with rustc will be compiled with functional unwinding. For me, it is still a workaround, but it seems to work well. The problem seems that some information (need usually by libunwind) is missing for anonymous function (unwinding-tables information ?), and with explicit framepointer libunwind is able to compensate this lake of information. |
I confirm that setting I talked to Ed Maste and Dimitry Andric about the bug in LLVM bugtracker you mentionned and they don't think this is the same problem. Ed told me about Clang's |
Before the patch, the default behavior of the compiler was to omit frame pointers. However, even though it looks fine for the code produced by the compiler, the compiler itself was broken. When there was a compilation error, rustc panics to report that error. While handling that panic, it tries to unwind the stack but fails to do so, which results in an abort(3). Here is an example: $ rustc hello.rs error: invalid reference to argument `0` (no arguments given) --> hello.rs:2:5 | 2 | println!("Hello {}") | ^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro outside of the current crate error: aborting due to previous error fatal runtime error: failed to initiate panic, error 5 Abort trap (core dumped) The problem also exists on other systems such as OpenBSD and i686-unknown-linux-musl. "omit frame pointers" was already disabled for i686-unknown-linux-musl: https://github.com/rust-lang/rust/blob/88a28ff6028cf197ed6b4185d8cd4887f05e3e07/src/librustc_back/target/i686_unknown_linux_musl.rs#L22 The patch does the same for *-unknown-freebsd. See the upstream bug for more informations: rust-lang/rust#43575 git-svn-id: svn+ssh://svn.freebsd.org/ports/head@455198 35697150-7ecd-e111-bb59-0022644237b5
Before the patch, the default behavior of the compiler was to omit frame pointers. However, even though it looks fine for the code produced by the compiler, the compiler itself was broken. When there was a compilation error, rustc panics to report that error. While handling that panic, it tries to unwind the stack but fails to do so, which results in an abort(3). Here is an example: $ rustc hello.rs error: invalid reference to argument `0` (no arguments given) --> hello.rs:2:5 | 2 | println!("Hello {}") | ^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro outside of the current crate error: aborting due to previous error fatal runtime error: failed to initiate panic, error 5 Abort trap (core dumped) The problem also exists on other systems such as OpenBSD and i686-unknown-linux-musl. "omit frame pointers" was already disabled for i686-unknown-linux-musl: https://github.com/rust-lang/rust/blob/88a28ff6028cf197ed6b4185d8cd4887f05e3e07/src/librustc_back/target/i686_unknown_linux_musl.rs#L22 The patch does the same for *-unknown-freebsd. See the upstream bug for more informations: rust-lang/rust#43575
It seems like this workaround no longer works on FreeBSD but I'm not sure. |
Actually it does work, will submit a PR for it. |
Same problem as OpenBSD, tracking bug rust-lang#43575.
…, r=eddyb Workaround abort(2) on compilation error on FreeBSD. Same problem as OpenBSD, tracking bug rust-lang#43575. @semarie @dumbbell
Same problem as OpenBSD, tracking bug rust-lang#43575.
Same problem as OpenBSD, tracking bug rust-lang#43575. Backport from rust-lang#48494
Is this issue resolved now? I see:
And no fatal runtime error or abort trap. FreeBSD 13ish, rust-nightly 1.49. If it's resolved, let's close it! Thanks. |
The bugzilla issue referenced in the code that works around this problem (https://bugs.llvm.org/show_bug.cgi?id=30879) has been fixed. Could anyone test with the workaround reverted? |
…petrochenkov freebsd remove compiler workaround. related issue rust-lang#43575
When there is a compilation failure, the Rust compiler aborts with the following output:
I used the following invalid source file:
Here is the backtrace:
As you can see in the paths, this is with Rust 1.19.0. The same happens with previous versions, so this isn't a regression (or not a recent one).
In the example, Rust was compiled with Clang 4.0.0, but the bundled LLVM was used.
When I compile and run a program which panics, the panic looks to be handled correctly:
I don't know how to debug this further. I tried with
debuginfo = true
anddebuginfo-lines = true
inconfig.toml
, but then the problem vanishes. I'm willing to help but I would like some pointers to where to look :-)The text was updated successfully, but these errors were encountered: