Fix portability landmines in the std::pmr conversion / build - #18
Open
pete-tempo wants to merge 1 commit into
Open
Fix portability landmines in the std::pmr conversion / build#18pete-tempo wants to merge 1 commit into
pete-tempo wants to merge 1 commit into
Conversation
These do not affect the current clang+libc++ build but would break a libstdc++ build, a standalone package build, or are latent copy-paste bugs: 1. Fast-CDR.patch (Cdr.h, Cdr.cpp): the std::pmr serialize/deserialize sequence overloads were gated on `_LIBCPP_STD_VER >= 17`, a libc++-internal macro that is undefined (0) on libstdc++, which would drop the overloads while the templated std::pmr::vector<bool>/string-sequence callers still reference them. Changed to the portable `__cplusplus >= 201703L` (the `defined(_MSC_VER) ||` prefix still covers MSVC's lagging __cplusplus). 2. common_interfaces.patch (point_cloud2_iterator.hpp): a concrete `std::vector<...>::const_iterator` over a now-pmr `fields` vector compiles on libc++ (__wrap_iter) but not on libstdc++ (allocator-parameterized iterator). Use `auto`. 3. geometry2.patch (tf2), vision_opencv.patch (cv_bridge, image_geometry): these packages now include pmr message headers (which need <memory_resource>, C++17) but had no explicit CMAKE_CXX_STANDARD, so they only built because a global standard leaked in -- a standalone build would fail. Set CMAKE_CXX_STANDARD 20 to match their already-bumped siblings (tf2_ros, the image_transport packages). 4. build_rclcpp_mac.sh: -DPYTHON_INCLUDE_DIR pointed at the Python3/Linux include dir in the Mac build (copy-paste); now Python3/Mac. Not changed: -Wl,--allow-shlib-undefined in linux.toolchain.cmake. Removing it would catch missing symbols at link time, but ROS resolves rmw/typesupport symbols at runtime via dlopen, so it is plausibly load-bearing; dropping it needs a full link test, not a mechanical edit. Each patch was regenerated from source and verified to apply cleanly to a pristine submodule checkout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These do not affect the current clang+libc++ build but would break a libstdc++ build, a standalone package build, or are latent copy-paste bugs:
Fast-CDR.patch (Cdr.h, Cdr.cpp): the std::pmr serialize/deserialize sequence overloads were gated on
_LIBCPP_STD_VER >= 17, a libc++-internal macro that is undefined (0) on libstdc++, which would drop the overloads while the templated std::pmr::vector/string-sequence callers still reference them. Changed to the portable__cplusplus >= 201703L(thedefined(_MSC_VER) ||prefix still covers MSVC's lagging __cplusplus).common_interfaces.patch (point_cloud2_iterator.hpp): a concrete
std::vector<...>::const_iteratorover a now-pmrfieldsvector compiles on libc++ (__wrap_iter) but not on libstdc++ (allocator-parameterized iterator). Useauto.geometry2.patch (tf2), vision_opencv.patch (cv_bridge, image_geometry): these packages now include pmr message headers (which need <memory_resource>, C++17) but had no explicit CMAKE_CXX_STANDARD, so they only built because a global standard leaked in -- a standalone build would fail. Set CMAKE_CXX_STANDARD 20 to match their already-bumped siblings (tf2_ros, the image_transport packages).
build_rclcpp_mac.sh: -DPYTHON_INCLUDE_DIR pointed at the Python3/Linux include dir in the Mac build (copy-paste); now Python3/Mac.
Not changed: -Wl,--allow-shlib-undefined in linux.toolchain.cmake. Removing it would catch missing symbols at link time, but ROS resolves rmw/typesupport symbols at runtime via dlopen, so it is plausibly load-bearing; dropping it needs a full link test, not a mechanical edit.
Each patch was regenerated from source and verified to apply cleanly to a pristine submodule checkout.