执行dji_sdk_demo_linux报错register osal handler error
Completed在树莓派(armv6l)32位linux操作系统的开发板上,运行dji_sdk_demo_linux,报错register osal handler error。
-
使用最新版PSDK-master,make时报错:
/usr/bin/ld: CMakeFiles/dji_sdk_demo_linux.dir/__/__/__/module_sample/camera_manager/test_camera_manager.c.o: in function `DjiTest_CameraManagerRunSample':
test_camera_manager.c:(.text+0x3a20): undefined reference to `DjiCameraManager_ResetCameraSettings'
collect2: error: ld returned 1 exit status -
请使用以下链接中的PSDK示例代码进行测试: https://pan-sec.djicorp.com/s/BAPSZfobtgWkJd7 dji123 -
## "uname -m" to auto distinguish Manifold2-G or Manifold2-Cexecute_process(COMMAND uname -mOUTPUT_VARIABLE DEVICE_SYSTEM_ID)if (DEVICE_SYSTEM_ID MATCHES x86_64)set(TOOLCHAIN_NAME x86_64-linux-gnu-gcc)add_definitions(-DPLATFORM_ARCH_x86_64=1)elseif (DEVICE_SYSTEM_ID MATCHES aarch64)set(TOOLCHAIN_NAME aarch64-linux-gnu-gcc)add_definitions(-DPLATFORM_ARCH_aarch64=1)##树莓派命令行 unmade -m armv6lelseif (DEVICE_SYSTEM_ID MATCHES armv6l)set(TOOLCHAIN_NAME arm-linux-gnueabihf-gcc)## add_definitions(-DPLATFORM_ARCH_x86_64=1)else ()message(FATAL_ERROR "FATAL: Please confirm your platform.")endif ()
-
根目录下的cmakelist.txt
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)set(CMAKE_ASM_COMPILER arm-none-eabi-gcc)set(CMAKE_AR arm-none-eabi-ar)set(CMAKE_OBJCOPY arm-none-eabi-objcopy)set(CMAKE_OBJDUMP arm-none-eabi-objdump)set(SIZE arm-none-eabi-size)set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)endif ()project(entry)# Disable in-source builds to prevent source tree corruption.if (" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")message(FATAL_ERROR "FATAL: In-source builds are not allowed.You should create a separate directory for build files.")endif ()if (USE_SYSTEM_ARCH MATCHES LINUX)add_definitions(-DSYSTEM_ARCH_LINUX)add_subdirectory(samples/sample_c/platform/linux/manifold2)# add_subdirectory(samples/sample_c++/platform/linux/manifold2)execute_process(COMMAND uname -m OUTPUT_VARIABLE DEVICE_SYSTEM_ID)if (DEVICE_SYSTEM_ID MATCHES x86_64)set(LIBRARY_PATH psdk_lib/lib/x86_64-linux-gnu-gcc)elseif (DEVICE_SYSTEM_ID MATCHES aarch64)set(LIBRARY_PATH psdk_lib/lib/aarch64-linux-gnu-gcc)elseif (DEVICE_SYSTEM_ID MATCHES armv6l)set(LIBRARY_PATH psdk_lib/lib/arm-linux-gnueabihf-gcc)else ()message(FATAL_ERROR "FATAL: Please confirm your platform.")endif ()install(FILES ${LIBRARY_PATH}/libpayloadsdk.aDESTINATION "${CMAKE_INSTALL_PREFIX}/lib")install(DIRECTORY psdk_lib/includeDESTINATION "${CMAKE_INSTALL_PREFIX}")elseif (USE_SYSTEM_ARCH MATCHES RTOS)add_definitions(-DSYSTEM_ARCH_RTOS)add_subdirectory(samples/sample_c/platform/rtos_freertos/stm32f4_discovery/project/armgcc)endif ()add_custom_target(${PROJECT_NAME} ALL) -
内cmakelist.txt文件
cmake_minimum_required(VERSION 3.5)
project(dji_sdk_demo_linux C)set(CMAKE_C_FLAGS "-pthread -std=gnu99")
set(CMAKE_CXX_FLAGS "-std=c++11 -pthread")
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
set(CMAKE_C_COMPILER "gcc")
set(CMAKE_CXX_COMPILER "g++")
add_definitions(-D_GNU_SOURCE)if (NOT USE_SYSTEM_ARCH)
add_definitions(-DSYSTEM_ARCH_LINUX)
endif ()if (BUILD_TEST_CASES_ON MATCHES TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
endif ()set(PACKAGE_NAME payloadsdk)
## "uname -m" to auto distinguish Manifold2-G or Manifold2-C
execute_process(COMMAND uname -m
OUTPUT_VARIABLE DEVICE_SYSTEM_ID)if (DEVICE_SYSTEM_ID MATCHES x86_64)
set(TOOLCHAIN_NAME x86_64-linux-gnu-gcc)
add_definitions(-DPLATFORM_ARCH_x86_64=1)
elseif (DEVICE_SYSTEM_ID MATCHES aarch64)
set(TOOLCHAIN_NAME aarch64-linux-gnu-gcc)
add_definitions(-DPLATFORM_ARCH_aarch64=1)
elseif (DEVICE_SYSTEM_ID MATCHES armv6l)
set(TOOLCHAIN_NAME arm-linux-gnueabihf-gcc)
add_definitions(-DPLATFORM_ARCH_armv6l=1)
else ()
message(FATAL_ERROR "FATAL: Please confirm your platform.")
endif ()file(GLOB_RECURSE MODULE_COMMON_SRC ../common/*.c)
file(GLOB_RECURSE MODULE_HAL_SRC hal/*.c)
file(GLOB_RECURSE MODULE_APP_SRC application/*.c)
file(GLOB_RECURSE MODULE_SAMPLE_SRC ../../../module_sample/*.c)include_directories(../../../module_sample)
include_directories(../common)
include_directories(../manifold2/application)include_directories(../../../../../psdk_lib/include)
link_directories(../../../../../psdk_lib/lib/${TOOLCHAIN_NAME})
link_libraries(${CMAKE_CURRENT_LIST_DIR}/../../../../../psdk_lib/lib/${TOOLCHAIN_NAME}/lib${PACKAGE_NAME}.a)if (NOT EXECUTABLE_OUTPUT_PATH)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
endif ()add_executable(${PROJECT_NAME}
${MODULE_APP_SRC}
${MODULE_SAMPLE_SRC}
${MODULE_COMMON_SRC}
${MODULE_HAL_SRC})set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../common/3rdparty)
find_package(OPUS REQUIRED)
if (OPUS_FOUND)
message(STATUS "Found OPUS installed in the system")
message(STATUS " - Includes: ${OPUS_INCLUDE_DIR}")
message(STATUS " - Libraries: ${OPUS_LIBRARY}")add_definitions(-DOPUS_INSTALLED)
target_link_libraries(${PROJECT_NAME} /usr/local/lib/libopus.a)
else ()
message(STATUS "Cannot Find OPUS")
endif (OPUS_FOUND)find_package(LIBUSB REQUIRED)
if (LIBUSB_FOUND)
message(STATUS "Found LIBUSB installed in the system")
message(STATUS " - Includes: ${LIBUSB_INCLUDE_DIR}")
message(STATUS " - Libraries: ${LIBUSB_LIBRARY}")add_definitions(-DLIBUSB_INSTALLED)
target_link_libraries(${PROJECT_NAME} usb-1.0)
else ()
message(STATUS "Cannot Find LIBUSB")
endif (LIBUSB_FOUND)target_link_libraries(${PROJECT_NAME} m)
add_custom_command(TARGET ${PROJECT_NAME}
PRE_LINK COMMAND cmake ..
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) -
第一,暂时无发提供截图。执行cmake ..命令,报错Please confirm your platform。
第二,更改cmakelist.txt文件后,cmake未报错,具体改动如下所示:
## "uname -m" to auto distinguish Manifold2-G or Manifold2-C
execute_process(COMMAND uname -m
OUTPUT_VARIABLE DEVICE_SYSTEM_ID)
if (DEVICE_SYSTEM_ID MATCHES x86_64)
set(TOOLCHAIN_NAME x86_64-linux-gnu-gcc)
add_definitions(-DPLATFORM_ARCH_x86_64=1)
elseif (DEVICE_SYSTEM_ID MATCHES aarch64)
set(TOOLCHAIN_NAME aarch64-linux-gnu-gcc)
add_definitions(-DPLATFORM_ARCH_aarch64=1)
##树莓派命令行 unmade -m armv6l
elseif (DEVICE_SYSTEM_ID MATCHES armv6l)
set(TOOLCHAIN_NAME arm-linux-gnueabihf-gcc)
## add_definitions(-DPLATFORM_ARCH_x86_64=1)
else ()
message(FATAL_ERROR "FATAL: Please confirm your platform.")
endif ()
-
## "uname -m" to auto distinguish Manifold2-G or Manifold2-C
#execute_process(COMMAND uname -m
OUTPUT_VARIABLE DEVICE_SYSTEM_ID)
#if (DEVICE_SYSTEM_ID MATCHES x86_64)
#set(TOOLCHAIN_NAME x86_64-linux-gnu-gcc)
#add_definitions(-DPLATFORM_ARCH_x86_64=1)
#elseif (DEVICE_SYSTEM_ID MATCHES aarch64)
#set(TOOLCHAIN_NAME aarch64-linux-gnu-gcc)
#add_definitions(-DPLATFORM_ARCH_aarch64=1)
##树莓派命令行 unmade -m armv6l use arm-linux-gnueabihf-gcc
set(TOOLCHAIN_NAME arm-linux-gnueabihf-gcc)
##add_definitions(-DPLATFORM_ARCH_x86_64=1)
#else ()
#message(FATAL_ERROR "FATAL: Please confirm your platform.")
#endif ()
第一,请问是修改成如上代码吗?第二,不明确add_definitions(-DPLATFORM_ARCH_x86_64=1)语句该如何更改。
Please sign in to leave a comment.
Comments
31 comments