RoboStack / robostack.github.io

180 stars 20 forks source link

Compile can't find c++ library #39

Closed desstiony closed 8 months ago

desstiony commented 8 months ago

I use ros noetic version,My package requires the udev library, which I installed using apt install but compiling in mamaba says it can't be found. fatal error: libudev.h: No such file or directory

(ros_env) ➜  catkin_ws whereis udev 
udev: /usr/lib/udev /etc/udev /usr/share/man/man7/udev.7.gz
Tobias-Fischer commented 8 months ago

Hi @desstiony - many thanks for reporting this! If you want to build packages within your conda environment, you will need to install the dependencies via conda as well. You can find many relevant mappings in https://github.com/RoboStack/ros-humble/blob/main/robostack.yaml - in your case, please mamba install libudev libusb and try again :).

You will also need to tell cmake to properly look for libudev if that is not yet the case. For libudev specifically, try

find_package(PkgConfig REQUIRED)
pkg_check_modules(udev REQUIRED libudev)
target_include_directories(YOURPACKGE ${udev_INCLUDE_DIRS})
target_link_libraries(YOURPACKAGE ${udev_LINK_LIBRARIES})

Feel free to reopen if it didn't help.

desstiony commented 8 months ago

It saved me, thank you very much. I tried mamba install libudev-dev before, but it didn't work until I saw the link at https://github.com/RoboStack/ros-humble/blob/main/robostack.yaml. It's incredibly helpful, though it seems a bit elusive in the guide!