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

Include error of generated header "ydlidar_config.h" in "DriverInterface.h" #58

Open
hannesduske opened this issue Dec 11, 2024 · 1 comment

Comments

@hannesduske
Copy link

hannesduske commented Dec 11, 2024

There is an include error of the generated header ydlidar_config.h in the file core/common/DriverInterface.h. The #include "ydlidar_config.h" statement that causes the error got introduced with commit 6bdbe78.
The build fails with the following error:

fatal error: ydlidar_config.h: No such file or directory
   10 | #include "ydlidar_config.h"
      |          ^~~~~~~~~~~~~~~~~~

The generated header ydlidar_config.h is located in the build directory which is not set as include directory of the library. See CMakeLists.txt lines 116 to 124:

115 #############################################################################################
116 #shared library
117 if(BUILD_SHARED_LIBS)
118 ydlidar_add_library(${PROJECT_NAME} SHARED ${SDK_SOURCES} ${SDK_HEADERS} ${GENERATED_HEADERS})
119 else()
120 ydlidar_add_library(${PROJECT_NAME} STATIC ${SDK_SOURCES} ${SDK_HEADERS} ${GENERATED_HEADERS})
121 endif()
122 
123 target_link_libraries(${PROJECT_NAME} ${SDK_LIBS})
124 target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) # build directory not set as include directory of the lib

Suggested fix:

124 target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}) # build directory now set as include directory of the lib

Tested on Ubuntu 24.04.1 LTS with amd64 and Ubuntu 20.04.6 LTS with arm64.

--  _________________________ PLATFORM _____________________________
--  Host                        : Linux6.8.0-45-genericx86_64
--  Is the system big endian?   :  No 
--  Word size (32/64 bit)       : 64
--  CMake version               : 3.28.3
--  CMake generator             : Unix Makefiles
--  CMake build tool            : /usr/bin/gmake
--  Compiler                    : GNU
--  Configuration               : Release
-- C++ flags (Release):      -std=c++11 -O3 -DNDEBUG
--  _________________________ PLATFORM _____________________________
--  Host                        : Linux6.8.0-1015-raspiaarch64
--  Is the system big endian?   :  No 
--  Word size (32/64 bit)       : 64
--  CMake version               : 3.16.3
--  CMake generator             : Unix Makefiles
--  CMake build tool            : /usr/bin/make
--  Compiler                    : GNU
--  Configuration               : Release
-- C++ flags (Release):      -std=c++11 -O3 -DNDEBUG
@tezelcelebi
Copy link

thanks for the fix. it worked for me on Ubuntu 24 Noble - ROS 2 Jazzy

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

No branches or pull requests

2 participants