Skip to content

Windows Path Support#1

Merged
esteve merged 2 commits intomainfrom
windows_support
Apr 12, 2026
Merged

Windows Path Support#1
esteve merged 2 commits intomainfrom
windows_support

Conversation

@maspe36
Copy link
Copy Markdown
Collaborator

@maspe36 maspe36 commented Apr 11, 2026

This PR should fix the windows build failure for rclrs in ros2-rust/ros2_rust#556

--- stderr: rclrs
error: unknown character escape: `p`
 --> C:\workspace\build\rclrs\debug\build\ros-env-9ae9ad711b590cc7\out/interfaces.rs:5:13
  |
5 |  include!("\pixi_ws\ros2-windows\share\action_msgs\rust\src\msg.rs"); pub mod rmw { use crate::builtin_interfaces;
  |             ^ unknown character escape
  |
  = help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
  |
5 |  include!(r"\pixi_ws\ros2-windows\share\action_msgs\rust\src\msg.rs"); pub mod rmw { use crate::builtin_interfaces;
  |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We were not handling paths for windows correctly. Now we get the absolute path to the generated .rs files and include those. This should handle all platform differences (similar to canonicalize()), except std::path::absolute does not resolve symlinks.
https://doc.rust-lang.org/stable/std/path/fn.absolute.html


I am testing this PR with this draft PR in rclrs. Ideally this repo should have CI as well, but this requires more effort and shouldn't be rushed solely for this change.
ros2-rust/ros2_rust#623

@maspe36 maspe36 requested a review from esteve April 11, 2026 18:44
@esteve esteve merged commit e563b19 into main Apr 12, 2026
@esteve esteve deleted the windows_support branch April 12, 2026 13:00
@esteve
Copy link
Copy Markdown

esteve commented Apr 12, 2026

@maspe36 thanks! I'll rebase ros2-rust/ros2_rust#556 once I merge this and then review it.

@maspe36
Copy link
Copy Markdown
Collaborator Author

maspe36 commented Apr 12, 2026

Verified windows builds work with this change!
https://github.com/ros2-rust/ros2_rust/actions/runs/24309522618/job/70976627263?pr=623

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