Skip to content

Allow rust from repos, properly install rust-toolchain file #13

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

Merged
merged 2 commits into from
Feb 25, 2025

Conversation

hcmh
Copy link
Contributor

@hcmh hcmh commented Feb 16, 2025

Hey,

thank you for this package! I found one problem with your package:
if BUILDDIR is set, packaging of the headers will fail, since rust-toolchain will not be in the location that the package expects. Adding it to the source array fixes that.

Additionally, I use rustc and rust-src from the repos. I have added two commits which allow that.
I am not quite sure if that error message is already good enough, but I though I'd start with something that explains the most common problems.

Copy link
Owner

@rnestler rnestler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR 🙂

if BUILDDIR is set, packaging of the headers will fail, since rust-toolchain will not be in the location that the package expects. Adding it to the source array fixes that.

I think i can merge that change this without issues, since it's just a bug-fix.

Additionally, I use rustc and rust-src from the repos. I have added two commits which allow that.

See comments.

Also I currently have the issue that I added GitHub CI to this repository in #4 but the AUR doesn't allow a repository to contain subdirectories (for whatever reasons):

remote: error: The following error occurred when parsing commit
remote: error: 5ca80698860af2aa7fdfb44f13779ea0f1c4d353:
remote: error: the repository must not contain subdirectories
remote: error: hook declined to update refs/heads/master

So I guess I need to remove this commit first and force push to be able to publish to the AUR.

PKGBUILD Outdated
@@ -36,6 +35,7 @@ source=(
https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/${_srcname}.tar.{xz,sign}
https://github.com/archlinux/linux/releases/download/$_srctag/linux-$_srctag.patch.zst{,.sig}
config # the main kernel config file
rust-toolchain
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if a hard-coded rust-toolchain does make sense anymore, since from kernel 6.12 on the latest stable version should work.

But for building out-of-tree Rust kernel modules we need to know which rust version was used to build the kernel. So we could just generate the rust-toolchain file form the available rustc compiler during the preparation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would know a lot better about that than me :) I only saw that it failed to build for me, and wanted to fix it. Feel free to change it another way, if that is better

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the branch with the changes how I think it should be. That way it should work for both people using the rustc / rust-src package and rustup.

People using rustc directly will probably need to rebuild the kernel on every upgrade of rust if they want out of tree modules to work.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you test on your system as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works very well, apart from the $src_dir -> $srcdir change I highlighted.
Thank you!

By not explicitly depending on rustup, users can
also install rust and rust-src from the repos.
If rustup is installed, we use to make sure that
rust-src is installed.
@rnestler rnestler merged commit 395daa0 into rnestler:master Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants