-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add Dockerfile for riscv64-unknown-linux-gnu #1416
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @gnzlbg (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Note that this is not tested on CI, that would require adding a build job to .travis.yml. Is that intended ? |
Not intended so much as I just wasn't sure how to add the job to CI. I'll make that change in a bit |
I've restarted this particular build: https://travis-ci.com/rust-lang/libc/jobs/212378258 |
That runs into a sort of circular issue: there isn't a riscv64gc-unknown-linux-gnu target yet because the standard library can't be compiled for 64-bit RISC-V. And the standard library can't be built for it because the libc crate doesn't yet support it. Perhaps there'd be a way to temporarily use the risc64gc-unknown-none-elf target? |
@fintelia to add new target you have to fix and test everything locally using by building Rust with modified dependencies (like patched libc), get dependencies fixes merged, get new target merged and finally add tests everywhere once the target works. |
@mati865 That makes more sense |
@fintelia my recommendation is to add it as a libcore target only first to rust-lang/rust . That requires adding a target specification to rust-lang/rust/src/librustc_target, and not much more. Once that is done, libc is no_std, so it can be built against that. Once you have libcore and libc working, getting support for liballoc shouldn't be hard, you can just shim out to libc::malloc. The largest chunk of work is getting libstd support, depending on how similar this is to other unix targets, might be a breeze or not. |
Good point, I didn't know you can make something as big as |
If the target isn't tier2, nothing is built, and then you have to build it with xargo, which you can use to build libcore only. So... it kind of works by omission 😆 |
Where is the tier listing actually specified in the rustc source? It seems that just adding a target spec file and including it in the supported_targets! macro is enough to cause |
@fintelia you need to set |
☔ The latest upstream changes (presumably #1376) made this pull request unmergeable. Please resolve the merge conflicts. |
This needs rebasing. What was previously in the |
ping |
Sorry for the delay on this. I don't think I'm going to have a chance to go through all of the steps to get this together in the near term so if anyone else is interested feel free to take over |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should also set CFLAGS_riscv64gc_unknown_linux_gnu
to -mabi=lp64d -fPIC
because:
cc
crate add the-mabi=lp64
by default- the compiler default to non-PIC which causes linking error as rustc link a PIE executable by default.
Also the CC
should be CC_riscv64gc_unknown_linux_gnu
not CC_riscv64_unknown_linux_gnu
.
@msizanoen1 please feel free to fork this branch and update it as you see fit and submit a PR. |
Actually getting std to compile for riscv64 is pretty simple: rust-lang/rust@master...msizanoen1:riscv-std |
The dockerfile is added by #1684 and I'm closing this in favor of it, thanks for contributing! |
See #1415