-
Notifications
You must be signed in to change notification settings - Fork 2k
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
C2Rust failes on native on Arch #20451
Comments
Haven't seen this yet; AFAIK @maribu is the RIOT developer who has the most experience with distros that use musl libc. It may also be that this is an issue with the include paths and how they are adjusted between GCC and LLVM. Please try both these:
|
I have already tried setting TOOLCHAIN=llvm, however this hasn't changed anything.
And then compile c2rust using the version from the git repo. As for my setup, I'm pretty sure I have all versions of clang and llvm from 14 to 17 installed. Not sure why the compilation process isn't able to find any of them. |
Likely true, but Arch is using glibc. Sounds more like the bug you fixed some time ago with the order of items in compile_commands.json being assumed to be in a particular order. |
Speaking of compile_commands.json, it could have something to do with this. |
I will look into the above once I'm back and figure out if it is causing the issue. |
Ok so I have tried running with BUILD_IN_DOCKER=1 however there seems to be an issue with the latest version of riot-wrappers requiring a newer version of rustc (1.75) than the one present in the docker image. Do you know how to deal with this issue? |
docker pull riotdocker
should fix that detail easily.
|
Thank you for suggesting this, I did that, however it didn't seem to affect the actual image used for docker build:
I have pulled this image as 'riotdocker' wasn't found: I will also try this one |
Ok, pulling the last image did the trick. Now I was able to compile the rust-hello-word example and it did execute correctly. I tried using the same setup for my main project, but got the issue where the rust doesn't have the proper toolchain installed:
It is interesting that this one is targeted as I have that one installed locally. I assume it isn't present in docker. I will investigate that. Edit: Ok so it turns out that I had a toolchain override present in the directory which was messing things up. Now it seems like the toolchain is set up correctly. The problem I'm having now is that one of the packages that my project depends on lives outside of the RIOT tree and the build in docker has some trouble copying it over:
Does build in docker support out-of-tree packages? |
to update. You can use a different container via |
Sorry, still didn't have time to look into this in full, just dumping anything I have on short notes:
Indeed; I just sent the remark from mobile without looking up the details.
That should be fixed already because the latest riot-sys has been uploaded to crates.io. RIOT uses riot-sys/-wrappers with a patch.crates-io to go directly to git. Tracked in #20452 for not letting this happen again. |
Thank you @chrysn for opening the other issue, I will look into this and provide additional context where applicable.
I just attached it here in case you have seen it before. I did some digging and found that this missing eh_personality problem shouldn't be there if Cargo.toml specifies in profile.release A possible workaround that I found online was to define this function manually like so:
The problem is that it requires nightly rust to allow for using language features. Do you know how I can override the toolchain used by the build-in-docker process? I tried using a custom toolchain.toml file, however it then complains that it doesn't have the target installed:
Is there a way of adding new targets to the rust toolchain that is present in the docker image? Edit:
The thing is that I'm not sure why this errors as after some reading I found that if you use panic="abort" then the rust_eh_personality should never be called. |
From the RIOT side, my setup works now. Thank you @chrysn and @maribu for helping me out. For anyone reading this issue in the future: ProblemRIOT examples of rust programs (rust-hello-world, rust-gcoap) fail to build because of link-time error in c2rust on Arch Linux. SolutionUse the BUILD_IN_DOCKER=1 TOOLCHAIN=llvm environment variables when compiling the program
|
Hello, |
The underlying problem is that the LLVM needs some gcc headers. GCC knows to look in the compiler-specific directories, but LLVM does not. |
make BOARD=native64 all
I am on an Ubuntu 20.04 LTS platform. (wont move to 22 due to gnome3 garbage) |
got me to the same place as native64 did (ztimer errors) things for me on Ubuntu20, once I realized that I was building in 32-bit mode. |
That looks like an Maybe we should consider a maintainable option to better error messages on modules/features not selected but used. |
(Issue moved over from forum, see https://forum.riot-os.org/t/compiling-rust-example-programs-for-native-rust2c-error/4127 for original entry by @SzymonKubica)
Description
Hello,
I’m working on a project which ports over a rust-based eBPF VM to run on RIOT. So far I’ve been testing it out on the nucleo-f439zi stm32 board and everything was working fine. I have installed c2rust as suggested from the github repo (not directly from cargo).
The problem is that when I try to compile my project for native, c2rust fails with the following error:
The same issue is present when I try to compile any of the rust example programs. I suspect it has something to do with my OS as I’m using arch linux and when installing c2rust I needed to explicitly specify the llvm installation dir.
Has anyone seen a similar issue before? Thank you
The text was updated successfully, but these errors were encountered: