-
Notifications
You must be signed in to change notification settings - Fork 13k
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 - signal: 11, SIGSEGV: invalid memory reference when compiling a crate #113612
Comments
I can't reproduce this locally in a new crate with |
Here is the
Crate
As I mentioned, this I cannot reproduce this on rust tarball sources outside our Yocto build environment. I trimmed this environment with |
If we can't reproduce it then we can't really help with anything. The backtrace looks like a stackoverflow somewhere, maybe you can debug from that. |
The crate |
That's just the minimum supported version, it should not have any problems. |
that makes it sound like your build environment is causing the crash. i'd inspect things like CC, LD_LIBRARY_PATH, CFLAGS environment variables to see if there's anything that could be affecting the build. getting a backtrace of the segfault using gdb might also be useful. |
In general, Rust aims to be completely "forward compatible". Future rustcs should compile the same code, though they may emit differing results (so runtime values of programs, if they depend on certain details, are subject to change, in some cases). So there are crates with an effective I should note that we have a very hard time doing anything sensible in the case of resource exhaustion, however... there is somewhat of a catch-22 here where you have to be able to finish running the compiler before that stability promise comes into effect, and we don't promise exact resource usage of the compiler. We try to make it work to run ordinary builds on 32-bit though. |
I tried building the p384 crate in a variety of configurations and the most peak memory I can get is about 300 MB. So it seems very unlikely to me that just compiling p384 can reproduce the problematic situation. Even if I were willing to work with Yocto, how would I reproduce this? You mentioned that this doesn't reproduce "outside our Yocto build environment" well okay, suppose I'm signing up for a real journey here: How would I reproduce your Yocto build environment and run whatever build you're running that causes this crash? |
@saethlin Add below lines in shell script and run, the issue will get reproduced. The issue will occur only with 32-bit machines Debug build.
|
My fresh clone from that script doesn't have a It looks like you are trying to build rustc and LLVM from source, on a 32-bit system. And based on |
@saethlin Execute it via a shell script, it will reproduce the issue. If you are cloning manually then the conf file will be in |
I can reproduce a segfault on x86_64. The backtrace in gdb points to this stack frame repeating:
I'd like to try building a reproducer that doesn't first need to compile gcc, LLVM, and rustc. Where is the target file for |
The |
Oh, it died while emitting debuginfo. lol. of course. |
So, from another person using Rust in Yocto
@saethlin @workingjubilee to add more context:
|
@saethlin It seems likely the "build from source, with debuginfo" part is a key element here, unfortunately, as this is exactly the kind of thing you call if you want to blow the stack, given a sufficiently large DWARF structure to emit. |
that's an llvm function, so it seems very unlikely we'd be able to fix this upstream. i think we should close this as wontfix and Sundeep / jaskij can decide whether to report it upstream to llvm or not. |
As far as I can tell, this is successfully building LLVM with |
I'm not running into this issue, I'm only here because I was asked to ;) FWIW, compiling Cargo for the target is somewhat outside of Yocto's design goals anyway. It might be worth pinging @kraj with this, he's done a lot of LLVM and Rust work for Yocto and might have some insight. |
@jaskij I am able to reproduce the issue with 1.68.2 rust and |
I'm seeing something similar with 1.75.0 and the Does this look like the same issue?
|
If you are using the rustc/cargo distributed via rustup, no this is not the same problem. |
I am building
Could it be related? |
Maybe? I cannot reproduce this problem, but I suspect you're using your own rustc/LLVM not the one distributed by rustup. Unfortunately I think your best bet is to file a bug with LLVM; I hope that the problem you're running into just has to do with having a differently-optimized LLVM build than rustup distributes. Our builds apply a lot of optimization that might have the side effect of reducing its stack consumption enough that we can build this crate. And even if someone in Rust did reproduce this issue by building their own LLVM... even from the little bit of information here I don't think it's likely that this situation can be fixed in this repo. |
I'm going to close this issue because there doesn't seem like much we can do from |
LLVM issue for anyone interested: llvm/llvm-project#76920 |
When the
p384
crate compiling we are getting 'signal: 11, SIGSEGV: invalid memory reference' error. This issue is occurring on 32-bit architecture machines when doing DEBUG build.Also, this issue is observed only when building this in Yocto. In rust tarball sources we couldn't reproduce the issue.
Below is the build command and error message.
We've tried to fix the issue and below 2 ways are fixing the linking problem for this crate but it has some side effects on rest of the build.
Is this the issue in p384 when using debug / with these features?
The same issue was raised here and the comments mentions that this could be an issue with
rust
also. Will it be an issue withrust
compiler?The text was updated successfully, but these errors were encountered: