-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Error explanation suggests using #![no_std] when already in use #28352
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
Comments
Is there any news on this issue? I'm trying to build a bare metal application and run exactly into this issue. |
@abusse I haven't heard of anyone else mention it. For reference, @klieth 's example today gives me:
No suggestion of |
Thank you @steveklabnik for the very fast answer and shame on me for not replying for such a long time, but I got stuck with a very urgent project the next day until recently. My issue does not regard the error message, but the error itself. I get the same result as you when compiling @klieth 's example. However, when I do not define the panic function I get stuck at the linking error as @klieth described. So my issue is, how do I get my final binary when I a) cannot define a panic function while b) the linker expects it to be there? |
Okay, so, I don't think this is a bug, then. You have to define these lang items; https://doc.rust-lang.org/stable/book/no-stdlib.html has some examples, though they are out of date. #33677 has been open for this; I'm just going to do it right now. I would encourage you, if you're still having trouble, to open a thread on users.rust-lang.org about this, with the exact code and what you're doing. Thanks! |
Again, thank you for the fast answer. Are you absolutely sure it is not a bug? Even though, I am trying to define these language items the compiler/language is simply not allowing me to define I'm pretty new to Rust, so I will trust you when you say you are absolutely sure that it is the intended behaviour of the compiler to reject my definition of |
Yes, you should not be defining a "panic function." panic isn't even a function in Rust; it's a macro. The exact code would be extremely helpful here. |
Sorry that I can give you the minimal example just now, it took me some time to strip down the code and still maintain the problem as the original code contains a lot of complicated wrapping to C code. Take this gist as example: As you can see in line 19 there is a symbol Furthermore, there is another similar issue that is most likely the same or at least related, but I was not able to maintain it in the simple example. In my complete more complicated code I also have a symbol after compiling called |
Please open a thread on users for this. |
I think I figured out what the issue is. Just for the record in case someone else comes about this issue: I assumed that |
I've been running into a linker error
undefined reference to 'panicking::panic::h98aad983367da335F7E'
while trying to build with#![no_std]
. While trying to debug, I ended up with some code that looked like this:https://gist.github.com/anonymous/88c01ee6ee33e4bad656
When you try to compile, it fails saying that "panic" is a duplicate definition. This makes sense because it's defined in
libcore
, but the error explanation suggests that this is possible, and the correct way to to do it is to use#![no_std]
, which I'm already doing.Seems like either a problem with the library or with the error explanation?
The text was updated successfully, but these errors were encountered: