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 issues to allow build with ros humble #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Scout22
Copy link

@Scout22 Scout22 commented Jul 7, 2022

The SDK need also to be fixed and include the following PR Livox-SDK/Livox-SDK#163

@liyifan2002 liyifan2002 mentioned this pull request Aug 1, 2022
Copy link

@Marcus-D-Forte Marcus-D-Forte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did exactly the same changes to be able to compile. Works for Foxy and Galactic as well.

My branch

This was referenced Sep 30, 2022
@adamsj-ros
Copy link

Appears to also need a fix to add an include to the thread_base.h in the SDK.

@shenxw0127 shenxw0127 mentioned this pull request Feb 13, 2023
@AnrewLIU
Copy link

I did exactly the same changes to be able to compile. Works for Foxy and Galactic as well.

My branch
@Marcus-D-Forte
When using your branch with ROS2 Humble and Ubuntu 20.04, it failed with livox_ros2_driver when colcon build.
How to fix this, thanks!

andrew@ros2:~/ws_livox$ colcon build
Starting >>> livox_interfaces
Starting >>> livox_sdk_vendor
Finished <<< livox_sdk_vendor [0.68s]                                
Finished <<< livox_interfaces [4.41s]                     
Starting >>> livox_ros2_driver
--- stderr: livox_ros2_driver                                
** WARNING ** io features related to pcap will be disabled
/usr/bin/ld: /usr/local/lib/liblivox_sdk_static.a(device_discovery.cpp.o): relocation R_X86_64_TPOFF32 against symbol `_ZGVZN6spdlog7details2os9thread_idEvE3tid' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/livox_ros2_driver.dir/build.make:508:liblivox_ros2_driver.so] 错误 1
gmake[1]: *** [CMakeFiles/Makefile2:139:CMakeFiles/livox_ros2_driver.dir/all] 错误 2
gmake: *** [Makefile:146:all] 错误 2
---
Failed   <<< livox_ros2_driver [13.0s, exited with code 2]

Summary: 2 packages finished [17.6s]
  1 package failed: livox_ros2_driver
  1 package had stderr output: livox_ros2_driver

@Genozen
Copy link

Genozen commented Feb 24, 2023

@Marcus-D-Forte Hello, thank you for updating your branch. I was able to clone it but got a build error:

Device: Jetson Xavier NX devkit
Version: Jetpack 5.1

colcon build
Starting >>> livox_interfaces
Starting >>> livox_sdk_vendor                  
Finished <<< livox_sdk_vendor [1.86s]                                                                   
Starting >>> livox_sdk
Finished <<< livox_sdk [1.47s]                                                                      
Finished <<< livox_interfaces [4.50s]                  
Starting >>> livox_ros2_driver
[Processing: livox_ros2_driver]                             
--- stderr: livox_ros2_driver                               
/home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.cpp: In member function ‘uint32_t livox_ros::Lddc::PublishPointcloudData(livox_ros::LidarDataQueue*, uint32_t, uint8_t)’:
/home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.cpp:328:34: error: no matching function for call to ‘toROSMsg(livox_ros::PointCloud&, sensor_msgs::msg::PointCloud2&)’
  328 |     pcl::toROSMsg(cloud,cloud_ros);
      |                                  ^
In file included from /home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.h:33,
                 from /home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.cpp:25:
/usr/include/pcl_conversions/pcl_conversions.h:487:8: note: candidate: ‘void pcl::toROSMsg(const PointCloud2&, sensor_msgs::Image&)’
  487 |   void toROSMsg(const sensor_msgs::PointCloud2 &cloud, sensor_msgs::Image &image)
      |        ^~~~~~~~
/usr/include/pcl_conversions/pcl_conversions.h:487:49: note:   no known conversion for argument 1 from ‘livox_ros::PointCloud’ {aka ‘pcl::PointCloud<pcl::PointXYZI>’} to ‘const PointCloud2&’ {aka ‘const sensor_msgs::PointCloud2_<std::allocator<void> >&’}
  487 |   void toROSMsg(const sensor_msgs::PointCloud2 &cloud, sensor_msgs::Image &image)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/pcl_conversions/pcl_conversions.h:507:3: note: candidate: ‘template<class T> void pcl::toROSMsg(const pcl::PointCloud<PointT>&, sensor_msgs::Image&)’
  507 |   toROSMsg (const pcl::PointCloud<T> &cloud, sensor_msgs::Image& msg)
      |   ^~~~~~~~
/usr/include/pcl_conversions/pcl_conversions.h:507:3: note:   template argument deduction/substitution failed:
/home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.cpp:328:25: note:   cannot convert ‘cloud_ros’ (type ‘sensor_msgs::msg::PointCloud2’ {aka ‘sensor_msgs::msg::PointCloud2_<std::allocator<void> >’}) to type ‘sensor_msgs::Image&’ {aka ‘sensor_msgs::Image_<std::allocator<void> >&’}
  328 |     pcl::toROSMsg(cloud,cloud_ros);
      |                         ^~~~~~~~~
In file included from /home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.h:33,
                 from /home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.cpp:25:
/usr/include/pcl_conversions/pcl_conversions.h:539:8: note: candidate: ‘template<class T> void pcl::toROSMsg(const pcl::PointCloud<PointT>&, sensor_msgs::PointCloud2&)’
  539 |   void toROSMsg(const pcl::PointCloud<T> &pcl_cloud, sensor_msgs::PointCloud2 &cloud)
      |        ^~~~~~~~
/usr/include/pcl_conversions/pcl_conversions.h:539:8: note:   template argument deduction/substitution failed:
/home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.cpp:328:25: note:   cannot convert ‘cloud_ros’ (type ‘sensor_msgs::msg::PointCloud2’ {aka ‘sensor_msgs::msg::PointCloud2_<std::allocator<void> >’}) to type ‘sensor_msgs::PointCloud2&’ {aka ‘sensor_msgs::PointCloud2_<std::allocator<void> >&’}
  328 |     pcl::toROSMsg(cloud,cloud_ros);
      |                         ^~~~~~~~~
make[2]: *** [CMakeFiles/livox_ros2_driver.dir/build.make:160: CMakeFiles/livox_ros2_driver.dir/livox_ros2_driver/lddc.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:301: CMakeFiles/livox_ros2_driver.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
---
Failed   <<< livox_ros2_driver [44.5s, exited with code 2]

Summary: 3 packages finished [49.7s]
  1 package failed: livox_ros2_driver
  1 package had stderr output: livox_ros2_driver

and here is a list of pcl libraries we have:

libdapclient6v5/focal,now 3.20.5-1 arm64 [installed,automatic]
libpcl-apps1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-common1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-conversions-dev/focal,now 0.2.1-6build1 arm64 [installed]
libpcl-dev/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed]
libpcl-features1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-filters1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-io1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-kdtree1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-keypoints1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-ml1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-msgs-dev/focal,now 0.2.0-10 arm64 [installed,automatic]
libpcl-octree1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-outofcore1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-people1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-recognition1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-registration1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-sample-consensus1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-search1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-segmentation1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-stereo1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-surface1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-tracking1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-visualization1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
pcl-tools/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]

Do you have any encounter to this? or mind sharing details of the library versions/environment you built on?

@yuchenlogin
Copy link

i have the same trouble too! please help me qwq!

@xiangheyenai
Copy link

@AnrewLIU I have the same problem. Have you resolved it now?

@zjmsyx
Copy link

zjmsyx commented Jan 18, 2024

I have the same problem.

--- stderr: livox_ros2_driver
** WARNING ** io features related to pcap will be disabled
/usr/bin/ld: /usr/local/lib/liblivox_sdk_static.a(device_discovery.cpp.o): relocation R_X86_64_TPOFF32 against symbol `_ZGVZN6spdlog7details2os9thread_idEvE3tid' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/livox_ros2_driver.dir/build.make:508:liblivox_ros2_driver.so] 错误 1
gmake[1]: *** [CMakeFiles/Makefile2:139:CMakeFiles/livox_ros2_driver.dir/all] 错误 2
gmake: *** [Makefile:146:all] 错误 2

Failed <<< livox_ros2_driver [8.58s, exited with code 2]

@KenN7
Copy link

KenN7 commented Feb 13, 2024

@Marcus-D-Forte Hello, thank you for updating your branch. I was able to clone it but got a build error:

Device: Jetson Xavier NX devkit Version: Jetpack 5.1

colcon build
Starting >>> livox_interfaces
Starting >>> livox_sdk_vendor                  
Finished <<< livox_sdk_vendor [1.86s]                                                                   
Starting >>> livox_sdk
Finished <<< livox_sdk [1.47s]                                                                      
Finished <<< livox_interfaces [4.50s]                  
Starting >>> livox_ros2_driver
[Processing: livox_ros2_driver]                             
--- stderr: livox_ros2_driver                               
/home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.cpp: In member function ‘uint32_t livox_ros::Lddc::PublishPointcloudData(livox_ros::LidarDataQueue*, uint32_t, uint8_t)’:
/home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.cpp:328:34: error: no matching function for call to ‘toROSMsg(livox_ros::PointCloud&, sensor_msgs::msg::PointCloud2&)’
  328 |     pcl::toROSMsg(cloud,cloud_ros);
      |                                  ^
In file included from /home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.h:33,
                 from /home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.cpp:25:
/usr/include/pcl_conversions/pcl_conversions.h:487:8: note: candidate: ‘void pcl::toROSMsg(const PointCloud2&, sensor_msgs::Image&)’
  487 |   void toROSMsg(const sensor_msgs::PointCloud2 &cloud, sensor_msgs::Image &image)
      |        ^~~~~~~~
/usr/include/pcl_conversions/pcl_conversions.h:487:49: note:   no known conversion for argument 1 from ‘livox_ros::PointCloud’ {aka ‘pcl::PointCloud<pcl::PointXYZI>’} to ‘const PointCloud2&’ {aka ‘const sensor_msgs::PointCloud2_<std::allocator<void> >&’}
  487 |   void toROSMsg(const sensor_msgs::PointCloud2 &cloud, sensor_msgs::Image &image)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/pcl_conversions/pcl_conversions.h:507:3: note: candidate: ‘template<class T> void pcl::toROSMsg(const pcl::PointCloud<PointT>&, sensor_msgs::Image&)’
  507 |   toROSMsg (const pcl::PointCloud<T> &cloud, sensor_msgs::Image& msg)
      |   ^~~~~~~~
/usr/include/pcl_conversions/pcl_conversions.h:507:3: note:   template argument deduction/substitution failed:
/home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.cpp:328:25: note:   cannot convert ‘cloud_ros’ (type ‘sensor_msgs::msg::PointCloud2’ {aka ‘sensor_msgs::msg::PointCloud2_<std::allocator<void> >’}) to type ‘sensor_msgs::Image&’ {aka ‘sensor_msgs::Image_<std::allocator<void> >&’}
  328 |     pcl::toROSMsg(cloud,cloud_ros);
      |                         ^~~~~~~~~
In file included from /home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.h:33,
                 from /home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.cpp:25:
/usr/include/pcl_conversions/pcl_conversions.h:539:8: note: candidate: ‘template<class T> void pcl::toROSMsg(const pcl::PointCloud<PointT>&, sensor_msgs::PointCloud2&)’
  539 |   void toROSMsg(const pcl::PointCloud<T> &pcl_cloud, sensor_msgs::PointCloud2 &cloud)
      |        ^~~~~~~~
/usr/include/pcl_conversions/pcl_conversions.h:539:8: note:   template argument deduction/substitution failed:
/home/workspace/src/livox_ros2_driver/livox_ros2_driver/lddc.cpp:328:25: note:   cannot convert ‘cloud_ros’ (type ‘sensor_msgs::msg::PointCloud2’ {aka ‘sensor_msgs::msg::PointCloud2_<std::allocator<void> >’}) to type ‘sensor_msgs::PointCloud2&’ {aka ‘sensor_msgs::PointCloud2_<std::allocator<void> >&’}
  328 |     pcl::toROSMsg(cloud,cloud_ros);
      |                         ^~~~~~~~~
make[2]: *** [CMakeFiles/livox_ros2_driver.dir/build.make:160: CMakeFiles/livox_ros2_driver.dir/livox_ros2_driver/lddc.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:301: CMakeFiles/livox_ros2_driver.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
---
Failed   <<< livox_ros2_driver [44.5s, exited with code 2]

Summary: 3 packages finished [49.7s]
  1 package failed: livox_ros2_driver
  1 package had stderr output: livox_ros2_driver

and here is a list of pcl libraries we have:

libdapclient6v5/focal,now 3.20.5-1 arm64 [installed,automatic]
libpcl-apps1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-common1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-conversions-dev/focal,now 0.2.1-6build1 arm64 [installed]
libpcl-dev/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed]
libpcl-features1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-filters1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-io1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-kdtree1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-keypoints1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-ml1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-msgs-dev/focal,now 0.2.0-10 arm64 [installed,automatic]
libpcl-octree1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-outofcore1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-people1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-recognition1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-registration1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-sample-consensus1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-search1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-segmentation1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-stereo1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-surface1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-tracking1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
libpcl-visualization1.10/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]
pcl-tools/focal,now 1.10.0+dfsg-5ubuntu1 arm64 [installed,automatic]

Do you have any encounter to this? or mind sharing details of the library versions/environment you built on?

Same problem here, did you find a workaround ?

@ashuRMS
Copy link

ashuRMS commented Nov 28, 2024

Thank you @Scout22, Your PR solved my issue.

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.

10 participants