Skip to content
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

fix: mark Eigen library as SYSTEM #349

Merged
merged 2 commits into from
Jun 17, 2022
Merged

Conversation

xmfcx
Copy link

@xmfcx xmfcx commented May 24, 2022

Allows it to build with ros2 humble on arm64 systems.

Makes compiler treat the Eigen as a system library, as it should.

Without the fix, we encounter following issues:

autowarefoundation/autoware#2448

Follow up from: tier4#2 (review)

@xmfcx
Copy link
Author

xmfcx commented May 24, 2022

@wep21 could you review it?

@kenji-miyake
Copy link

kenji-miyake commented May 24, 2022

Same error in grid_map_cv.

--- stderr: grid_map_cv
In file included from /usr/include/eigen3/Eigen/Core:214,
                 from /autoware/install/grid_map_core/include/grid_map_core/TypeDefs.hpp:13,
                 from /autoware/install/grid_map_core/include/grid_map_core/grid_map_core.hpp:12,
                 from /autoware/src/universe/vendor/grid_map/grid_map_cv/include/grid_map_cv/GridMapCvProcessing.hpp:12,
                 from /autoware/src/universe/vendor/grid_map/grid_map_cv/src/GridMapCvProcessing.cpp:9:
/usr/include/eigen3/Eigen/src/Core/arch/NEON/PacketMath.h: In function ‘Packet Eigen::internal::pload(const typename Eigen::internal::unpacket_traits<T>::type*) [with Packet = Eigen::internal::eigen_packet_wrapper<int, 2>; typename Eigen::internal::unpacket_traits<T>::type = signed char]’:
/usr/include/eigen3/Eigen/src/Core/arch/NEON/PacketMath.h:1671:9: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘Eigen::internal::Packet4c’ {aka ‘struct Eigen::internal::eigen_packet_wrapper<int, 2>’} from an array of ‘const int8_t’ {aka ‘const signed char’} [-Werror=class-memaccess]
 1671 |   memcpy(&res, from, sizeof(Packet4c));
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So we have to export the settings of system include. (But I'm not sure how to do that.)

@xmfcx
Copy link
Author

xmfcx commented May 24, 2022

I can apply it to the others too. I will do it in a few hours.

@kenji-miyake
Copy link

Thanks, but I guess the problem isn't so simple.
grid_map_cv doesn't directly depend on Eigen. It's propagated through grid_map_core.

@kenji-miyake
Copy link

kenji-miyake commented May 24, 2022

@kenji-miyake
Copy link

Same error for grid_map_ros.

--- stderr: grid_map_ros
In file included from /usr/include/eigen3/Eigen/Core:214,
                 from /autoware/install/grid_map_core/include/grid_map_core/TypeDefs.hpp:13,
                 from /autoware/install/grid_map_core/include/grid_map_core/grid_map_core.hpp:12,
                 from /autoware/install/grid_map_cv/include/grid_map_cv/grid_map_cv.hpp:12,
                 from /autoware/src/universe/vendor/grid_map/grid_map_ros/src/GridMapRosConverter.cpp:21:
/usr/include/eigen3/Eigen/src/Core/arch/NEON/PacketMath.h: In function ‘Packet Eigen::internal::pload(const typename Eigen::internal::unpacket_traits<T>::type*) [with Packet = Eigen::internal::eigen_packet_wrapper<int, 2>; typename Eigen::internal::unpacket_traits<T>::type = signed char]’:
/usr/include/eigen3/Eigen/src/Core/arch/NEON/PacketMath.h:1671:9: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘Eigen::internal::Packet4c’ {aka ‘struct Eigen::internal::eigen_packet_wrapper<int, 2>’} from an array of ‘const int8_t’ {aka ‘const signed char’} [-Werror=class-memaccess]
 1671 |   memcpy(&res, from, sizeof(Packet4c));

@kenji-miyake
Copy link

Also in grid_map_loader.

--- stderr: grid_map_loader
In file included from /usr/include/eigen3/Eigen/Core:214,
                 from /autoware/install/grid_map_core/include/grid_map_core/TypeDefs.hpp:13,
                 from /autoware/install/grid_map_core/include/grid_map_core/grid_map_core.hpp:12,
                 from /autoware/install/grid_map_ros/include/grid_map_ros/grid_map_ros.hpp:12,
                 from /autoware/src/universe/vendor/grid_map/grid_map_loader/include/grid_map_loader/GridMapLoader.hpp:17,
                 from /autoware/src/universe/vendor/grid_map/grid_map_loader/src/GridMapLoader.cpp:10:
/usr/include/eigen3/Eigen/src/Core/arch/NEON/PacketMath.h: In function ‘Packet Eigen::internal::pload(const typename Eigen::internal::unpacket_traits<T>::type*) [with Packet = Eigen::internal::eigen_packet_wrapper<int, 2>; typename Eigen::internal::unpacket_traits<T>::type = signed char]’:
/usr/include/eigen3/Eigen/src/Core/arch/NEON/PacketMath.h:1671:9: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘Eigen::internal::Packet4c’ {aka ‘struct Eigen::internal::eigen_packet_wrapper<int, 2>’} from an array of ‘const int8_t’ {aka ‘const signed char’} [-Werror=class-memaccess]
 1671 |   memcpy(&res, from, sizeof(Packet4c));
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@kenji-miyake
Copy link

@xmfcx Could you cherry-pick tier4@91febb2?

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
@xmfcx
Copy link
Author

xmfcx commented May 26, 2022

I have tested this and it builds.
colcon build --symlink-install --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=1 --packages-up-to grid_map

I have tried to add SYSTEM keyword to only places where include_directories(${EIGEN3_INCLUDE_DIR} happened but that wasn't enough like @kenji-miyake said. Adding them to ament_target_dependencies solved the issue.

@xmfcx
Copy link
Author

xmfcx commented Jun 6, 2022

@maximilianwulf could you review/merge this please?

@maximilianwulf maximilianwulf merged commit 9751dcb into ANYbotics:ros2 Jun 17, 2022
@maximilianwulf
Copy link
Collaborator

Yes, sorry support is on a super low burner.

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.

4 participants