While compiling the DJI Onboard SDK
on a Fedora GNU/Linux
we got the following error:
[ 41%] Building CXX object osdk-core/CMakeFiles/djiosdk-core.dir/platform/linux/src/linux_serial_device.cpp.o In file included from Onboard-SDK/osdk-core/platform/linux/src/linux_serial_device.cpp:33:0: Onboard-SDK/osdk-core/platform/linux/inc/linux_serial_device.hpp:97:3: error: ‘fd_set’ does not name a type; did you mean ‘tzset’? fd_set m_serial_fd_set; ^~~~~~ tzset In file included from /usr/include/sys/types.h:197:0, from /usr/include/stdlib.h:279, from /usr/include/c++/7/cstdlib:75, from /usr/include/c++/7/bits/stl_algo.h:59, from /usr/include/c++/7/algorithm:62, from Onboard-SDK/osdk-core/platform/linux/src/linux_serial_device.cpp:34: Onboard-SDK/osdk-core/platform/linux/src/linux_serial_device.cpp: In member function ‘int DJI::OSDK::LinuxSerialDevice::_serialStart(const char*, int)’: Onboard-SDK/osdk-core/platform/linux/src/linux_serial_device.cpp:330:14: error: ‘m_serial_fd_set’ was not declared in this scope FD_ZERO(&m_serial_fd_set); ^ Onboard-SDK/osdk-core/platform/linux/src/linux_serial_device.cpp:330:14: note: suggested alternative: ‘m_serial_fd’ Onboard-SDK/osdk-core/platform/linux/src/linux_serial_device.cpp:331:26: error: ‘m_serial_fd_set’ was not declared in this scope FD_SET(m_serial_fd, &m_serial_fd_set); ^ Onboard-SDK/osdk-core/platform/linux/src/linux_serial_device.cpp:331:26: note: suggested alternative: ‘m_serial_fd’ make[2]: *** [osdk-core/CMakeFiles/djiosdk-core.dir/build.make:735: osdk-core/CMakeFiles/djiosdk-core.dir/platform/linux/src/linux_serial_device.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:86: osdk-core/CMakeFiles/djiosdk-core.dir/all] Error 2 make: *** [Makefile:130: all] Error 2
To resolve this, we added to the file Onboard-SDK/osdk-core/platform/linux/inc/linux_serial_device.hpp
the following include directive right after line 37 (which contained #define LINUXSERIALDEVICE_H
):
#include <sys/select.h>
Then, we issued make
again which terminated successfully.
Source: https://github.com/dji-sdk/Onboard-SDK
Compilation Commands:
git clone https://github.com/dji-sdk/Onboard-SDK; cd Onboard-SDK; mkdir build; cd build; cmake ..; #Modify the file Onboard-SDK/osdk-core/platform/linux/inc/linux_serial_device.hpp and add #include <sys/select.h> at the top make all; # Something # Make profit
This post is also available in: Αγγλικα