我正在交叉编译主机系统为Ubuntu 16.04(使用gcc5
和g++5
,目标为瑞萨R-Car H3ULCB的应用程序。
我正在使用交叉编译环境,该环境是使用yocto build for H3ULCB创建的。我已经创建了用于项目构建的CMake文件。 交叉编译时,为libc链接共享库存在错误。
以下是错误:
/opt/poky/2.1.3/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-ld:
/home/microsar/SIP/CBD1800182-D06/delivery-CBD1800182-D06/builds/cross/amsr-vector-fs-libosabstraction/lib/libosabstraction.a(scheduler.cc.o):
undefined reference to symbol 'sched_get_priority_min@@GLIBC_2.17'
01:35:13 [ ERROR]
/opt/poky/2.1.3/sysroots/aarch64-poky-linux/lib/libc.so.6: error adding symbols: DSO missing from command line
以下是.cmake
文件的内容:
# Poky installation specific
set(POKY_INSTALL_DIR "/opt/poky/2.1.3")
set(POKY_TARGET_BIN_DIR
"${POKY_INSTALL_DIR}/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux")
#set(POKY_POOL_DIR "${PIKEOS_INSTALL_DIR}/aarch64-poky-linux/arm/v8hf")
#set(CUSTOM_POOL_DIR "$ENV{HOME}/build/pikeos_pool")
# Use the PikeOS pool as sysroot
#set(CMAKE_SYSROOT "${CUSTOM_POOL_DIR}")
# Set the install prefix to a reasonable default value.
#set(CMAKE_INSTALL_PREFIX "${CUSTOM_POOL_DIR}/usr" CACHE STRING "Install path prefix, prepended onto install directories.")
# Set the name of the target systems
set(CMAKE_SYSTEM_NAME Linux)
# Set the version of the target system
set(CMAKE_SYSTEM_VERSION 2.1.3)
# Set processor (or hardware) of the target system
set(CMAKE_SYSTEM_PROCESSOR arm)
# sysroot location
set(MYSYSROOT /opt/poky/2.1.3/sysroots/aarch64-poky-linux)
# Set C compiler
set(CMAKE_C_COMPILER ${POKY_TARGET_BIN_DIR}/aarch64-poky-linux-gcc)
# Set C++ compiler
set(CMAKE_CXX_COMPILER ${POKY_TARGET_BIN_DIR}/aarch64-poky-linux-g++)
# compiler
include(CMakeForceCompiler)
cmake_force_c_compiler(/opt/poky/2.1.3/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc
GNU)
cmake_force_cxx_compiler(/opt/poky/2.1.3/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++
GNU)
# compiler/linker flags
add_definitions("--sysroot=${MYSYSROOT}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl
--sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}
--sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE)
# cmake built-in settings to use find_xxx() functions
set(CMAKE_FIND_ROOT_PATH ${MYSYSROOT})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
# Set linker calling command rule
# !!! Order of parameters is important here !!!
# Otherwise you will get plenty of unresolved STL symbols during linking!
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_LINKER> -o <TARGET>
<OBJECTS> <LINK_LIBRARIES> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS>"
CACHE STRING "Linker calling command rule for C++ executables." FORCE
)
set(CMAKE_C_LINK_EXECUTABLE
"<CMAKE_LINKER> -o <TARGET> <OBJECTS> <LINK_LIBRARIES> <CMAKE_C_LINK_FLAGS <LINK_FLAGS>"
CACHE STRING "Linker calling command rule for C executables." FORCE )