-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
rust: refactor build system #20686
rust: refactor build system #20686
Conversation
These tarball cannot be reused, so simply drop them. Also move cargo config to a file instead of using echo command. Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
They are for the target build which is not supported yet, drop them. Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
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.
Looks great! Thank you!
Awesome! Thanks. I'm currently giving it a testbuild on my machine. Besides those changes, what's the status of the plan to reuse the llvm openwrt toolchain? AFAIK, it is already shipped with the SDK. So build time would reduce even more. |
this version is fetching the pre-built llvm from the rust-lang ci. |
There're some issues with llvm-bpf:
|
Please add options/possibilities to self-built llvm, instead of pre-built one. Still compiling for x86_64, will edit this message about the result. |
The default configuration of llvm-bpf does not work for rust, I don't wanna add a broken option. |
Based on yoctoproject rust Makefile, must-root is only valid for musl libc, while on glibc it's doesn't need it :
So I proposing the following for OpenWrt Makefile :
Also regarding CONFIG_PKG_CC_STACKPROTECTOR_REGULAR & CONFIG_PKG_CC_STACKPROTECTOR_STRONG in glibc, the "-lssp_nonshared" seems cannot be found. What do you think of the following for rust-values.mk :
|
|
Other finding, If I am enabled ccache, the HOSTCC will return as ccache then the Build/Compile/Cargo will failed, changing back CC=cc inside Build/Compile/Cargo will return successful rust app compilation. |
Thanks for the test, it should be |
Looks good to me.
Looks like it's enabled already? |
Seems like an improvement, I haven't tested yet; but looking at Makefile, it would seem that this fixes previous version's won't build if host and target are same arch. (x86_64 and x86_64 for example/most often). I'll test later, but it looks like none of problems to build on a must host has not been fixed, so glibc hosts without changes only. |
Perhaps the force -lssp_nonshared linkage need to be enclosed as :
Then left for glibc with nothing addition?.
For me when building for x86_64 on x86_64 the solution for current OpenWrt rust Makefile is :
Removing the "--exclude rust-*-$(RUSTC_TARGET_ARCH).tar.xz " & removing Force linking of the SSP library. |
I just removed Host/PackageDist, seems useless at least for now |
Added new RustBinPackage, RustBinHostBuild wrapper. Added new RUST_PKG_FEATURES flag. Moved CARGO_HOME to STAGING_DIR_HOSTPKG. Overrode default Build/Compile and Host/Compile to Cargo build. Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
While at it, move maturin out of rust directory. Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
Fixed a build error: > unresolved import `time::macros` Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
llvm-bpf is not ready for generic usage, so use prebuilt llvm toolchain provided by the rust project to speedup build (~1hour faster). Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
Don't set musl-specific options/ldflags when using glibc. Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
That didn't work for me.. I locally changed it to
That worked. I was looking that this refactored version fixes that issue. |
I still doubt rust will exist in openwrt |
May I ask why? |
I'd say this guy just threw garbage everywhere, check his github activity |
@1715173329 no need, I'll take your word on it. |
@1715173329 I think you can merge? ;) |
Sure, I will merge this tonight if there's no objection :-) |
@1715173329 |
Maintainer: @lu-zero
Compile tested: ipq807x/generic
Run tested: redmi-ax6
Description:
refactor the rust build system (added in #19863 )