我有以下问题。我尝试运行交叉编译,但是由于非常奇怪的错误,某些目标失败了:
cd /home/pawel/Development/src/hal/build/tests && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/focuscontrollerraw_test.dir/link.txt --verbose=1
/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux/bin/arm-linux-gnueabihf-g++ --sysroot=/mnt/quantum-ubuntu -std=c++11 -Wall -pedantic -Wextra CMakeFiles/focuscontrollerraw_test.dir/focuscontrollerraw_test.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/focuscontrollerraw.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/manager.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/focuscontroller.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/hardwareexception.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/i2c.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/illuminator.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/illuminatorcontroller.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/rgbilluminator.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/tiva.cpp.o CMakeFiles/focuscontrollerraw_test.dir/focuscontrollerraw_test_automoc.cpp.o -o focuscontrollerraw_test -lm -lpthread -lglib-2.0 /mnt/quantum-ubuntu/usr/lib/arm-linux-gnueabihf/libQt5Gui.so.5.2.1 -lCppUTest -lCppUTestExt /mnt/quantum-ubuntu/usr/lib/arm-linux-gnueabihf/libQt5Core.so.5.2.1
/mnt/quantum-ubuntu/usr/lib/libEGL.so.1: undefined reference to `gcoOS_SwapBuffersGeneric_Async'
/mnt/quantum-ubuntu/usr/lib/libEGL.so.1: undefined reference to `gcoOS_DrawSurface'
/mnt/quantum-ubuntu/usr/lib/libEGL.so.1: undefined reference to `gcoOS_ResizeWindow'
collect2: error: ld returned 1 exit status
使用quemu的相同编辑就像魅力一样非常慢:
cd /root/hal/build/tests && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/focuscontrollerraw_test.dir/link.txt --verbose=1
/usr/bin/c++ -std=c++11 -Wall -pedantic -Wextra CMakeFiles/focuscontrollerraw_test.dir/focuscontrollerraw_test.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/focuscontrollerraw.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/i2c.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/illuminator.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/manager.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/rgbilluminator.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/tiva.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/focuscontroller.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/hardwareexception.cpp.o CMakeFiles/focuscontrollerraw_test.dir/__/src/illuminatorcontroller.cpp.o CMakeFiles/focuscontrollerraw_test.dir/focuscontrollerraw_test_automoc.cpp.o -o focuscontrollerraw_test -lm -lpthread -lglib-2.0 /usr/lib/arm-linux-gnueabihf/libQt5Gui.so.5.2.1 -lCppUTest -lCppUTestExt /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5.2.1
在我的工具链文件下面:
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_SYSROOT /mnt/quantum-ubuntu)
set(tools /opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux/bin/arm-linux-gnueabihf)
set(CMAKE_C_COMPILER ${tools}-gcc)
set(CMAKE_CXX_COMPILER ${tools}-g++)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
和CMakeList.txt:
project(hal)
cmake_minimum_required(VERSION 3.5)
cmake_policy(SET CMP0015 NEW)
###########################
# COMPILATION DEFINITIONS #
###########################
add_definitions(-Wall)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra")
if(NOT CMAKE_TOOLCHAIN_FILE)
if(NOT CMAKE_PREFIX_PATH)
set(QT5_DIR /opt/Qt5.3.2/5.3)
set(CMAKE_PREFIX_PATH ${QT5_DIR}/gcc_64/lib/cmake)
message(STATUS "Set CMAKE_PREFIX_PATH to default path defined in CMakeLists = ${CMAKE_PREFIX_PATH}")
endif()
endif()
#####################################
# INCLUDE USED MACROS AND FUNCTIONS #
#####################################
file(GLOB CmakeModules CMake/modules/*.cmake)
foreach(Module ${CmakeModules})
include(${Module})
endforeach(Module)
###########################
# ADD PROJECT DEFINITIONS #
###########################
set(CppUTest CppUTest CppUTestExt)
include_directories(${CMAKE_SYSROOT}/usr/local/include)
set(SrcDir ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(MainTestsDir ${CMAKE_CURRENT_SOURCE_DIR}/tests)
set(MocksDir ${CMAKE_CURRENT_SOURCE_DIR}/mocks)
set(HalMocksDir ${CMAKE_CURRENT_SOURCE_DIR}/hal_mocks)
file(GLOB_RECURSE SrcFiles src/*.cpp)
file(GLOB_RECURSE MocksFiles mocks/*.cpp)
file(GLOB_RECURSE HalMocksFiles hal_mocks/*.c hal_mocks/*.cpp)
file(GLOB_RECURSE HeadersFiles include/*.h)
file(GLOB_RECURSE ExceptionsFiles ../exception/*.h ../exception/*.cpp)
include_directories(include ../exception)
##################
# CONFIGURE LIBS #
##################
set(Libs m pthread glib-2.0)
# Configure Qt5
set(CMAKE_AUTOMOC ON)
set(Qt5Modules Core Gui)
configure_qt5("${Qt5Modules}")
# Remove below line if not use QT MOC
set(CMAKE_AUTOMOC ON)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB_PKG glib-2.0)
include_directories(${GLIB_PKG_INCLUDE_DIRS})
######################
# TARGET DEFINITIONS #
######################
# Add fake targets to make visible all project's files in Qt Creator
add_custom_target(headers SOURCES ${HeadersFiles})
add_custom_target(sources SOURCES ${SrcFiles})
add_custom_target(mocks SOURCES ${MocksFiles})
add_custom_target(hal_mocks SOURCES ${HalMocksFiles})
# TEST DEFINITIONS
enable_testing()
set(TestTargets)
add_subdirectory(tests)
add_custom_target(check_deps DEPENDS ${TestTargets})
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -VV DEPENDS check_deps)
# So target
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" )
add_library(hal SHARED ${SrcFiles})
target_link_libraries(hal ${Libs} )
#########################
# CONFIGURE INSTALLTION #
#########################
set(QUANTUM_INSTALL_DIR /opt/quantum)
# SET RPATH CONFIG
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${QUANTUM_INSTALL_DIR}/lib")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
任何想法我做错了什么?