Livox-SDK / livox_ros2_driver

Livox device driver under Ros2, support Lidar Mid-40, Mid-70, Tele-15, Horizon, Avia.
Other
77 stars 84 forks source link

Having trouble building colcon workspace #9

Open joshHUNB opened 3 years ago

joshHUNB commented 3 years ago

Hello I have been trying unsuccessfully to get the Livox ROS2 driver to work on my machine. I am running ubuntu 18.04 with ROS2 Dashing.

These are the commands I am running to install Livox-SDK and the ROS2 Driver. The colcon build command fails and I am not sure why.

git clone https://github.com/Livox-SDK/Livox-SDK.git
cd Livox-SDK
cd build && cmake ..
make 
sudo make install 
source /opt/ros/dashing/setup.bash
sudo apt install python3-colcon-common-extensions
cd
mkdir -p ws_livox/src
git clone https://github.com/Livox-SDK/livox_ros2_driver.git ws_livox/src
cd ws_livox
colcon build

This is the terminal output I get after running colcon build in ws_livox

Starting >>> livox_interfaces
Starting >>> livox_sdk_vendor
Finished <<< livox_sdk_vendor [1.10s]                                                              
Finished <<< livox_interfaces [4.93s]                       
Starting >>> livox_ros2_driver
--- stderr: livox_ros2_driver                              
** WARNING ** io features related to ensenso will be disabled
** WARNING ** io features related to davidSDK will be disabled
** WARNING ** io features related to dssdk will be disabled
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
** WARNING ** io features related to libusb-1.0 will be disabled
** WARNING ** visualization features related to ensenso will be disabled
** WARNING ** visualization features related to davidSDK will be disabled
** WARNING ** visualization features related to dssdk will be disabled
** WARNING ** visualization features related to rssdk will be disabled
/usr/include/apr-1.0
apr-1
/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: /usr/local/lib/liblivox_sdk_static.a(livox_sdk.cpp.o): relocation R_X86_64_PC32 against symbol `_ZN3fmt2v58internal12basic_bufferIcE6resizeEm' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [liblivox_ros2_driver.so] Error 1
make[1]: *** [CMakeFiles/livox_ros2_driver.dir/all] Error 2
make: *** [all] Error 2
---
Failed   <<< livox_ros2_driver [4.56s, exited with code 2]

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

Any help would be appreciated

Livox-SDK commented 3 years ago

sorry, joshHUNB, Build it on ROS2 foxy please! Someone migrated it to the foxy now.

myxiaojun commented 3 years ago

@Livox-SDK same problem... so the livox_ros2_driver based on ros2 foxy now? but README said running Livox ROS2 driver under ubuntu18.04, ROS2 (dashing, ubuntu18.04)... Foxy is based on ubuntu 20.04.

joshHUNB commented 3 years ago

I have tried building it on Foxy but haven't had much success. Do you have any new install instructions?

For example I build foxy workspace from source, then I go to the ws_livox it asks for perception_pcl to be added, so I put that in ws_livox/src (I tried in Foxy but it didn't like that), but then perception fails.

Could not find a package configuration file provided by "catkin" with any of the following names:

catkinConfig.cmake
catkin-config.cmake

... Failed <<< pcl_conversions [1.43s, exited with code 1]

Moving to Foxy may be a problem for my project as well since we mostly operate in 18.04 ubuntu. But I have managed to get Foxy working

Livox-SDK commented 3 years ago

No need to install Livox-SDK in advance! you can delete the "/usr/local/lib/liblivox_sdk_static.a" now, and build it again!

jarekkt commented 2 years ago

Note - see the other issue - you have different compilation options in SDK and driver, so only local build of SDK ( within driver) will work. It will never properly link to standalone SDK build.

AsiDiaz commented 2 years ago

@Livox-SDK Building it without Livox-SDK I get this errors when I try to run the driver:

`ros2 launch livox_lidar_rviz_launch.py

[INFO] [launch]: All log files can be found below /home/asier/.ros/log/2022-01-14-11-05-14-866050-asier-5087 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [livox_ros2_driver_node-1]: process started with pid [5090] [INFO] [rviz2-2]: process started with pid [5092] [livox_ros2_driver_node-1] [INFO] [1642154715.398756964] [livox_lidar_publisher]: Livox Ros Driver Version: 0.0.1 [livox_ros2_driver_node-1] /home/asier/ws_livox/install/livox_ros2_driver/lib/livox_ros2_driver/livox_ros2_driver_node: symbol lookup error: /home/asier/ws_livox/install/livox_ros2_driver/lib/liblivox_ros2_driver.so: undefined symbol: GetLivoxSdkVersion [ERROR] [livox_ros2_driver_node-1]: process has died [pid 5090, exit code 127, cmd '/home/asier/ws_livox/install/livox_ros2_driver/lib/livox_ros2_driver/livox_ros2_driver_node --ros-args -r __node:=livox_lidar_publisher --params-file /tmp/launch_params_uzgbqlp7 --params-file /tmp/launch_params_4hko0s01 --params-file /tmp/launch_params_l6txhpwf --params-file /tmp/launch_params_jpgjag7f --params-file /tmp/launch_params_fxisb1xm --params-file /tmp/launch_params_8vpj3gdp --params-file /tmp/launch_params_mva09fnb --params-file /tmp/launch_params_dt2abqe1 --params-file /tmp/launch_params_31irzg3k']. `

I build it on Ubuntu 20.04 with Foxy.

jarekkt commented 2 years ago

Look for this in one of CMakeLists.txt

set(livox_sdk_REV "v2.3.0") .... GIT_REPOSITORY https://github.com/Livox-SDK/Livox-SDK.git

You need precisely same version....

jarekkt commented 2 years ago

And you need SDK to bu build

AsiDiaz commented 2 years ago

@jarekkt Yes, I finally managed to build it, thank you so much.

rty813 commented 2 years ago

I solved it by add -fPIC to Livox-SDK/sdk_core/CMakeLists.txt image And, rebuild it.