-
Notifications
You must be signed in to change notification settings - Fork 135
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
Upgrade to Rust 1.78 #398
Comments
I'm currently working on. Is there a reason why you have set the rust version in cargo.toml for |
That rust version is supposed to be the minimum supported version of rust that rclrs would work with. However, our CI does not use this same version so there is a chance that its actually misleading now. I think with this upgrade to at least Rust 1.78 we'd want to upgrade rclrs to 1.78 in the cargo.toml as well since we would depend on u128 FFI safe functions. |
Something that we should probably think about is what ROS 2 / Ubuntu version we target and what Rust compiler is shipped with it. |
@luca-della-vedova That's a good point. Since Noble is an LTS we should expect that the build farm will be targeting it for quite a while now, and any build farm integration that we hope to accomplish before 26.04 will probably be forced to rely on the version of Rust that shipped with Noble. It seems the only motivation to go as high as 1.78 is this FFI safety for u128, but even with version 1.78, it's not guaranteed to be safe across all targets. Maybe it's worth putting some time into researching whether there's a more sound way to achieve FFI safety. Especially something that can work with version 1.75. |
Yeah, I think tying our minimum Rust version to what is shipped with Noble is reasonable if it helps reduce friction to get into the build farm.
FWIW, |
It turns out the FFI issue is thornier than we originally realized. The real origin of the problem is that This becomes a problem because bindgen does not properly support long double (float128). These uses of long double in the C API are quietly converted into u128 by bindgen, which is immediately a big problem for us, regardless of the u128 alignment issue that triggers the warning that we've been suppressing. Currently our My recommendation would be this:
|
After doing even more research on long double, I've reached the conclusion that bindgen shouldn't support interpreting long doubles from a C API, now or ever, because the binary representation of a long double is ambiguous. Moreover I believe ROS should not support transmitting long doubles for the same reason, and I've opened an issue ticket upstream recommended that they be removed from dynamic type support: ros2/rosidl_dynamic_typesupport#11 If that goes through, the following step would be to update the ROS IDL design doc to explicitly exclude long double from the subset of IDL that ROS supports (it's already not present in the ordinary builtin primitive types). If that all goes according to plan, we'll be able to just remove the |
@mxgrey thank you so much for doing all this research, it'd be great to constraint |
I think we should not increase the minimal version to 1.78 no matter what because it will leave us incompatible with the build farm which will be limited to 1.75 for the next two years or so. In the PR I've increased it to 1.75 to reflect our need to maintain support for 1.75 for our build farm aspirations, but I don't mind reverting it to 1.74 and putting in a comment to remind us not to go past 1.75. |
We are currently on Rust 1.74, and now as of Rust 1.78, the u128 type is now FFI safe. Lets go ahead and upgrade.
Doing this upgrade will help us resolve #320 once and for all. As part of this upgrade, we should also remove the
#![allow(improper_ctypes)]
and#![allow(improper_ctypes_definitions)]
lines from our rcl bindings as we no longer need to ignore these lints.The text was updated successfully, but these errors were encountered: