Open durka opened 3 years ago
I am trying to build the OSDK on Ubuntu 20.04. I don't need advanced sensing and I can't install ffmpeg, so I made the following changes:
diff --git a/CMakeLists.txt b/CMakeLists.txt index c4f0f040..5f1538cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,9 +54,6 @@ endif() set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/libs) -set(ADVANCED_SENSING 1) -set(WAYPT2_CORE 1) - if (ADVANCED_SENSING) add_definitions(-DADVANCED_SENSING) endif() diff --git a/osdk-core/CMakeLists.txt b/osdk-core/CMakeLists.txt index 2ae21b13..98a26ede 100755 --- a/osdk-core/CMakeLists.txt +++ b/osdk-core/CMakeLists.txt @@ -129,20 +129,6 @@ add_library(${PROJECT_NAME} STATIC ${OSDK_LIB_SRCS}) -add_subdirectory(advanced-sensing) - - -set(ADVANCED_SENSING_SOURCE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/advanced-sensing) -set(ADVANCED_SENSING_HEADERS_DIR - ${ADVANCED_SENSING_SOURCE_ROOT}/api/inc - ${ADVANCED_SENSING_SOURCE_ROOT}/platform/inc - ${ADVANCED_SENSING_SOURCE_ROOT}/protocol/inc - ${ADVANCED_SENSING_SOURCE_ROOT}/camera_stream/src - ${ADVANCED_SENSING_SOURCE_ROOT}/ori-osdk-core/protocol/inc - ${ADVANCED_SENSING_SOURCE_ROOT}/ori-osdk-core/hal/inc - ${ADVANCED_SENSING_SOURCE_ROOT}/ori-osdk-core/platform/linux/inc - ) - ## Libraries to propagate as dependencies to third-party code depending on osdk-core ## Append to this variable when you want a dependency to get propagated SET(OSDK_INTERFACE_LIBS pthread) # pthread is assumed available on linux @@ -158,6 +144,20 @@ SET(MODULE_INSTALL_INTERFACE "") ## Advanced Sensing if(ADVANCED_SENSING) + add_subdirectory(advanced-sensing) + + + set(ADVANCED_SENSING_SOURCE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/advanced-sensing) + set(ADVANCED_SENSING_HEADERS_DIR + ${ADVANCED_SENSING_SOURCE_ROOT}/api/inc + ${ADVANCED_SENSING_SOURCE_ROOT}/platform/inc + ${ADVANCED_SENSING_SOURCE_ROOT}/protocol/inc + ${ADVANCED_SENSING_SOURCE_ROOT}/camera_stream/src + ${ADVANCED_SENSING_SOURCE_ROOT}/ori-osdk-core/protocol/inc + ${ADVANCED_SENSING_SOURCE_ROOT}/ori-osdk-core/hal/inc + ${ADVANCED_SENSING_SOURCE_ROOT}/ori-osdk-core/platform/linux/inc + ) + diff --git a/sample/platform/linux/CMakeLists.txt b/sample/platform/linux/CMakeLists.txt index 629df7ce..0838bde5 100644 --- a/sample/platform/linux/CMakeLists.txt +++ b/sample/platform/linux/CMakeLists.txt @@ -92,20 +92,20 @@ include_directories(${ADVANCED_SENSING_HEADERS_DIR}) message((${ADVANCED_SENSING_HEADERS_DIR})) find_package(LibUSB REQUIRED) -find_package(FFMPEG REQUIRED) +find_package(FFMPEG) #find_package(Waypt2Core REQUIRED) if(FFMPEG_FOUND) message( STATUS "Found FFmpeg ${FFMPEG_VERSION} installed in the system.") message( STATUS " - Includes: ${FFMPEG_INCLUDE_DIRS}") message( STATUS " - Libraries: ${FFMPEG_LIBRARIES}") + include_directories(${FFMPEG_INCLUDE_DIR}) else() message("Cannot Find FFMPEG") endif(FFMPEG_FOUND) include_directories(${LIBUSB_1_INCLUDE_DIRS}) -include_directories(${FFMPEG_INCLUDE_DIR}) #include_directories(${WAYPT2_CORE_INCLUDE_DIRS}) #link libraries @@ -113,6 +113,7 @@ include_directories(${FFMPEG_INCLUDE_DIR}) #link_libraries(${OSDK_CORE_LIB}/lib/libdjiosdk-core.a) if(ADVANCED_SENSING) + add_subdirectory(advanced-sensing) link_libraries(advanced-sensing) link_libraries(djiosdk-core) link_libraries(${LIBUSB_1_LIBRARIES}) @@ -151,7 +152,6 @@ add_subdirectory(logging) add_subdirectory(time-sync) add_subdirectory(payload-3rd-party) add_subdirectory(payloads) -add_subdirectory(advanced-sensing) add_subdirectory(hms) add_subdirectory(battery) add_subdirectory(mop)
Now I am building with this script:
rm -rf build mkdir build cd build cmake .. -DADVANCED_SENSING=OFF -DCMAKE_BUILD_TYPE=Debug make
This fails with hundreds of "undefined reference" errors:
[ 33%] Linking CXX executable ../../../../bin/djiosdk-flightcontrol-sample CMakeFiles/djiosdk-flightcontrol-sample.dir/flight_control_sample.cpp.o: In function `monitoredTakeoff(DJI::OSDK::Vehicle*, int)': /home/exyn/workspaces/2/git/dji_sdk_upstream/sample/platform/linux/flight-control/flight_control_sample.cpp:50: undefined reference to `DJI::OSDK::Vehicle::isM100()' /home/exyn/workspaces/2/git/dji_sdk_upstream/sample/platform/linux/flight-control/flight_control_sample.cpp:50: undefined reference to `DJI::OSDK::Vehicle::isLegacyM600()' /home/exyn/workspaces/2/git/dji_sdk_upstream/sample/platform/linux/flight-control/flight_control_sample.cpp:54: undefined reference to `DJI::OSDK::DataSubscription::verify(int)' /home/exyn/workspaces/2/git/dji_sdk_upstream/sample/platform/linux/flight-control/flight_control_sample.cpp:55: undefined reference to `DJI::OSDK::ACK::getError(DJI::OSDK::ACK::ErrorCode) ' /home/exyn/workspaces/2/git/dji_sdk_upstream/sample/platform/linux/flight-control/flight_control_sample.cpp:55: undefined reference to `DJI::OSDK::ACK::SUCCESS' /home/exyn/workspaces/2/git/dji_sdk_upstream/sample/platform/linux/flight-control/flight_control_sample.cpp:57: undefined reference to `DJI::OSDK::ACK::getErrorCodeMessage(DJI::OSDK::ACK: :ErrorCode, char const*)' /home/exyn/workspaces/2/git/dji_sdk_upstream/sample/platform/linux/flight-control/flight_control_sample.cpp:70: undefined reference to `DJI::OSDK::DataSubscription::initPackageFromTopicLi st(int, int, DJI::OSDK::Telemetry::TopicName*, bool, unsigned short)' /home/exyn/workspaces/2/git/dji_sdk_upstream/sample/platform/linux/flight-control/flight_control_sample.cpp:75: undefined reference to `DJI::OSDK::DataSubscription::startPackage(int, int) ' /home/exyn/workspaces/2/git/dji_sdk_upstream/sample/platform/linux/flight-control/flight_control_sample.cpp:76: undefined reference to `DJI::OSDK::ACK::getError(DJI::OSDK::ACK::ErrorCode) ' /home/exyn/workspaces/2/git/dji_sdk_upstream/sample/platform/linux/flight-control/flight_control_sample.cpp:76: undefined reference to `DJI::OSDK::ACK::SUCCESS' /home/exyn/workspaces/2/git/dji_sdk_upstream/sample/platform/linux/flight-control/flight_control_sample.cpp:78: undefined reference to `DJI::OSDK::ACK::getErrorCodeMessage(DJI::OSDK::ACK: :ErrorCode, char const*)' /home/exyn/workspaces/2/git/dji_sdk_upstream/sample/platform/linux/flight-control/flight_control_sample.cpp:80: undefined reference to `DJI::OSDK::DataSubscription::removePackage(int, int )' /home/exyn/workspaces/2/git/dji_sdk_upstream/sample/platform/linux/flight-control/flight_control_sample.cpp:86: undefined reference to `DJI::OSDK::Control::takeoff(int)' ...
What am I doing wrong?
Since no help for this issue appears to be forthcoming, I recommend checking out the latest working tag 4.0.1 if you want to use the samples.
4.0.1
I am trying to build the OSDK on Ubuntu 20.04. I don't need advanced sensing and I can't install ffmpeg, so I made the following changes:
Now I am building with this script:
This fails with hundreds of "undefined reference" errors:
What am I doing wrong?