Rust-for-Linux / linux

Adding support for the Rust language to the Linux kernel.
https://rust-for-linux.com
Other
3.83k stars 399 forks source link

Update minimal bindgen version to 0.65.1 #1074

Closed brummer-simon closed 2 months ago

brummer-simon commented 2 months ago

Hi Rust-For-Linux Team,

I am aware that the rust branch has not seen much activity lately because all development efforts go into contributing to the mainline kernel. I still use the "rust" branch for some experimentation and I've noticed that it does not build anymore because the required bindgen version is not available anymore on crates.io. Due to a major version bump, all newer versions cause the build system to break. This PR contains updates the version in the "rust" branch to something that works.

I am happy with my fork of the repo but I thought maybe somebody else might be interested in a fixed version of the experimental code. So feel free to merge it if you like.

Cheers Simon

ojeda commented 2 months ago

Thanks Simon.

the required bindgen version is not available anymore on crates.io.

What do you mean? The version is still in crates.io and installing it seems to work. Perhaps you are trying to install bindgen-cli instead of bindgen for older versions?

brummer-simon commented 2 months ago

That might be the Issue. I was not aware that older tool version is available as bindgen instead of bindgen-cli. I just noticed that fetching the expected bindgen version failed and assumed that it might have gone lost. Question is: Should I discard the PR or has its still some value? I am pretty sure that not everybody is aware of it.

ojeda commented 2 months ago

I agree that change in bindgen created quite some confusion -- I think they did it to reduce dependencies on library-only use cases.

In any case, the documentation (i.e. ours: the Quick Start guide in Documentation/rust) mentions the right command to use for the version you have checked out, see the update at commit 08ab786556ff ("rust: bindgen: upgrade to 0.65.1"). We could cherry-pick that commit into the rust branch, of course, but the branch was archived a while ago, so it is not maintained anymore and thus it is mostly meant to be used only for reference, e.g. to lift some code there for upstreaming (which will typically need updating since there have been many changes since then, new APIs, etc.).

Having said that, what parts of rust are you finding useful? It would be nice to know and possibly consider them for one of the topic branches: recently we started to create those (for topics that their maintainers are interested in upstreaming), see https://rust-for-linux.com/branches#topic-branches.

brummer-simon commented 2 months ago

Well at my company I a member of special interest group around rust usage in our projects and due to the media echo of the rust support in the Linux kernel some colleagues were interested in the topic. So i decided to write a simple character device because it is a classic in the C World as an introduction into kernel development.

And I did that on the rust branch because there is a chrdev abstraction. So I used it to show what "the future might bring" to get people interested. While not having a good Idea for a character device, I think it would be great to have the facilities in place to implement classic examples like the scull driver. This would make an entry in the scary world of kernel development much nicer for interested people.

brummer-simon commented 2 months ago

Since a commit exists that can be cherry-picked, I close the PR.

ojeda commented 2 months ago

Well at my company I a member of special interest group around rust usage in our projects and due to the media echo of the rust support in the Linux kernel some colleagues were interested in the topic. So i decided to write a simple character device because it is a classic in the C World as an introduction into kernel development.

Sounds great, thanks for letting me know.

And I did that on the rust branch because there is a chrdev abstraction. So I used it to show what "the future might bring" to get people interested. While not having a good Idea for a character device, I think it would be great to have the facilities in place to implement classic examples like the scull driver. This would make an entry in the scary world of kernel development much nicer for interested people.

Indeed. In fact, it could be interesting to have a topic/staging branch for that, including the scull-like driver too. While the kernel only accepts code with a concrete user, if someone has done the rebasing work and can commit to maintain it etc., perhaps a case could be made for a scull-like driver as a Rust reference driver or perhaps as another sample.

@wedsonaf had a scull-like one implemented, even done in steps etc., for a LF Mentorship Session.