Closed cblesing closed 8 months ago
I have answered it to my self. I forgot to set the ROS_VERSION ENV to 0. But now I got another error:
[ 13%] Building CXX object _deps/sick_scan_xd-build/CMakeFiles/sick_scan_xd_lib.dir/driver/src/sick_generic_laser.cpp.o In file included from /home/vagrant/.cpm-source-cache/sick_scan_xd/9da84fc9d165813149d60f87a1b1a46864af7282/include/sick_scan/ldmrs/sick_ldmrs_node.h:12, from /home/vagrant/.cpm-source-cache/sick_scan_xd/9da84fc9d165813149d60f87a1b1a46864af7282/driver/src/sick_generic_laser.cpp:70: /home/vagrant/.cpm-source-cache/sick_scan_xd/9da84fc9d165813149d60f87a1b1a46864af7282/include/sick_scan/ldmrs/sick_ldmrs_driver.hpp:58:10: fatal error: sick_ldmrs/manager.hpp: No such file or directory 58 | #include <sick_ldmrs/manager.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. gmake[2]: *** [_deps/sick_scan_xd-build/CMakeFiles/sick_scan_xd_lib.dir/build.make:216: _deps/sick_scan_xd-build/CMakeFiles/sick_scan_xd_lib.dir/driver/src/sick_generic_laser.cpp.o] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:1400: _deps/sick_scan_xd-build/CMakeFiles/sick_scan_xd_lib.dir/all] Error 2 gmake: *** [Makefile:136: all] Error 2
How exactly is it possible to disable the LDMRS? I have set this:
option(BUILD_WITH_LDMRS_SUPPORT "Build ${PROJECT_NAME} with LDMRS support (ON, libsick_ldmrs from https://github.com/SICKAG/libsick_ldmrs required) or without LDMRS support (OFF)" OFF) if(WIN32) set(BUILD_WITH_LDMRS_SUPPORT OFF CACHE BOOL "Build ${PROJECT_NAME} with LDMRS support (ON, libsick_ldmrs from https://github.com/SICKAG/libsick_ldmrs required) or without LDMRS support (OFF)" FORCE) elseif(LDMRS EQUAL 0) set(BUILD_WITH_LDMRS_SUPPORT OFF CACHE BOOL "Build ${PROJECT_NAME} with LDMRS support (ON, libsick_ldmrs from https://github.com/SICKAG/libsick_ldmrs required) or without LDMRS support (OFF)" FORCE) else() set(BUILD_WITH_LDMRS_SUPPORT ON CACHE BOOL "Build ${PROJECT_NAME} with LDMRS support (ON, libsick_ldmrs from https://github.com/SICKAG/libsick_ldmrs required) or without LDMRS support (OFF)" FORCE) endif()
Thanks for your feedback. Use cmake flags -DLDMRS=0 -DSCANSEGMENT_XD=0
to build sick_scan_xd without LDMRS and scansegment_xd support, which are not required for LMS 1xxx lidars. See https://github.com/SICKAG/sick_scan_xd/blob/master/INSTALL-GENERIC.md#build-on-linux-generic-without-ros for further options. Please remove all temporary build and cmake files from the build folder to ensure a complete rebuild.
Thanks for the quick reply. That worked perfectly fine. But is it possible to use the sick_scan_xd without installing it manualy via make install? When I use the CPMAddPackage (we manage any other dependency with it) I ran into the error mentioned here https://github.com/SICKAG/sick_scan_xd/issues/223#issuecomment-1770726130
For some reason in that case the compiler wants to have the sick_ldmrs/manager.hpp even if I have set BUILD_WITH_LDMRS_SUPPORT and BUILD_WITH_SCANSEGMENT_XD_SUPPORT = OFF in the CPMAddPackage options section.
Any idea?
It is possible to use sick_scan_xd without installation. Just make sure that the library can be found, i.e. environment variables PATH
and LD_LIBRARY_PATH
contain the sick_scan_xd build folder.
sick_generic_laser.cpp includes ldmrs-header, if LDMRS_SUPPORT is defined and not equal 0. It looks like LDMRS_SUPPORT is still defined within the CPM environment; maybe the CPM cache folder (/home/vagrant/.cpm-source-cache
) needs to be cleared or removed to ensure a complete rebuild.
(@cblesing and I are working on the same project and are thus facing the same issues, so this can be considered a followup to his comments.)
Using the lib via CPM / a CMake subproject instead of installing it in the system doesn't quite work here, yet. Setting the options to 0
(not any other value like OFF
) works and properly seems to turn off LDMRS for the build:
CPMAddPackage(
NAME sick_scan_xd
URL ${ARTIFACT_REPO_URL}/sick_scan_xd-3.1.0.tar.gz
VERSION 3.1.0
OPTIONS
"CMAKE_ENABLE_EMULATOR 0"
"ROS_VERSION 0"
"LDMRS 0"
"SCANSEGMENT_XD 0"
)
There is still a problem with includes, though. We link the (static) library to our application like this:
target_link_libraries(exe_myapp
sick_scan_xd_lib
)
The lib itself is then built successfully as a dependency. But it seems include directories are missing when our own application is compiled:
In file included from /home/vagrant/src/myapp/src/app.myapp/MyApp.cpp:1:
/home/vagrant/src/myapp/src/app.myapp/MyApp.h:15:10: fatal error: sick_scan_xd/sick_scan_api.h: No such file or directory
15 | #include <sick_scan_xd/sick_scan_api.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
After having a look at sick_scan_xd's CMakeList.txt
, I suspect this is because INTERFACE_INCLUDE_DIRECTORIES
is not set for the lib via e.g. target_include_directories(${PROJECT_NAME}_lib PUBLIC <DIRECTORIES>)
(see CMake manual). I am not a CMake expert, though, and could be wrong there.
If that's the case, it would be great if someone could add the required statements to sick_scan_xd's CMakeList.txt
. If it should work nevertheless: How do we properly add required include directories when integrating sick_scan_xd via CPM / as a CMake subproject?
Thanks for following up. We recommend to build a shared library as described in https://github.com/SICKAG/sick_scan_xd/blob/master/doc/sick_scan_api/sick_scan_api.md#build-the-shared-library-on-linux.
CPM is currently not supported. Please feel free to append a target_include_directories
command in your local CMakeLists.txt file and commit a pull request if the issue can be solved this way.
Hi,
i have to use the sick_scan_xd library on a native ubuntu c++ project to read out a LSM 1xxx. When I try to compile the library I get a strange error:
`[ 7%] Building CXX object _deps/sick_scan_xd-build/CMakeFiles/sick_scan_xd_lib.dir/driver/src/abstract_parser.cpp.o