Skip to content
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 1.32 segfaults with llvm 7.0.1 while building fd-find and lto=true enabled #57801

Closed
Mic92 opened this issue Jan 21, 2019 · 4 comments
Closed

Comments

@Mic92
Copy link
Contributor

Mic92 commented Jan 21, 2019

While binaries by provided by mozilla are compiled against its bundled llvm, distributions such as archlinux, fedora and NixOS link rust against the upstream llvm version.

Also the rust project itself don't has this version yet, it might be still useful to track this issue here as it will eventually also affect the project if they ever upgrade llvm.

Steps to reproduce:

$ cargo --version
cargo 1.32.0
$ rustc --version
rustc 1.32.0
$ cargo install fd-find
....
   Compiling clap v2.32.0
   Compiling parking_lot v0.7.1
   Compiling ctrlc v3.1.1
   Compiling crossbeam-channel v0.3.6
   Compiling fd-find v7.2.0
   Compiling globset v0.4.2
   Compiling ignore v0.4.6
error: failed to compile `fd-find v7.2.0`, intermediate artifacts can be found at `/tmp/cargo-installCT8S32`

Caused by:
  Could not compile `fd-find`.

Caused by:
  process didn't exit successfully: `rustc --crate-name fd /root/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/fd-find-7.2.0/src/main.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=3 -C lto -C codegen-units=1 -C metadata=a3a6a7cb919634a5 -C extra-filename=-a3a6a7cb919634a5 --out-dir /tmp/cargo-installCT8S32/release/deps -L dependency=/tmp/cargo-installCT8S32/release/deps --extern ansi_term=/tmp/cargo-installCT8S32/release/deps/libansi_term-da0b45e138ff353b.rlib --extern atty=/tmp/cargo-installCT8S32/release/deps/libatty-d255fe7ee8d55655.rlib --extern clap=/tmp/cargo-installCT8S32/release/deps/libclap-f83ca700ee891f8b.rlib --extern ctrlc=/tmp/cargo-installCT8S32/release/deps/libctrlc-03b9fe7f29c143b5.rlib --extern humantime=/tmp/cargo-installCT8S32/release/deps/libhumantime-67b9f25c854b0215.rlib --extern ignore=/tmp/cargo-installCT8S32/release/deps/libignore-1259b5bca495d9c6.rlib --extern lazy_static=/tmp/cargo-installCT8S32/release/deps/liblazy_static-7deee2bf7505e8c9.rlib --extern libc=/tmp/cargo-installCT8S32/release/deps/liblibc-e3278554887eedae.rlib --extern num_cpus=/tmp/cargo-installCT8S32/release/deps/libnum_cpus-f24ed7872633de1c.rlib --extern regex=/tmp/cargo-installCT8S32/release/deps/libregex-dcae60647554bb97.rlib --extern regex_syntax=/tmp/cargo-installCT8S32/release/deps/libregex_syntax-16497b92e03853d9.rlib --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference)

This happens both on archlinux (#61490) and on NixOS (#54323). Both distributions uses llvm 7.0.1 instead of the llvm version that is provided by rust. The problem goes away when using the vendored llvm source.

This is backtrace of the coredump: https://gist.github.com/e337646429c41d93a089aaa45b8d2375
as generated by gdb rustc core -batch -ex bt.
The error suggest that it might be related to generating debugging symbols.

cc @foutrelis

UPDATE: the error also seems to go away, when I disable lto optimization.

@Mic92
Copy link
Contributor Author

Mic92 commented Jan 21, 2019

also cc @sharkdp

@Mic92
Copy link
Contributor Author

Mic92 commented Jan 21, 2019

fd also seems to use lto: https://github.com/sharkdp/fd/blob/master/Cargo.toml#L60

@Mic92 Mic92 changed the title Rustc 2.32 segfaults with llvm 7.0.1 while building fd-find Rustc 2.32 segfaults with llvm 7.0.1 while building fd-find and lto=true enabled Jan 21, 2019
@Mic92
Copy link
Contributor Author

Mic92 commented Jan 21, 2019

I was also able to reproduce this bug, when compiling my own project cntr with lto optimization enabled.

@Mic92 Mic92 changed the title Rustc 2.32 segfaults with llvm 7.0.1 while building fd-find and lto=true enabled Rustc 1.32 segfaults with llvm 7.0.1 while building fd-find and lto=true enabled Jan 21, 2019
@mati865
Copy link
Contributor

mati865 commented Jan 21, 2019

Duplicate of #57762

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants