I am making a software, which used yaml-cpp to laod parameter. Now, I have to release to Raspberry pie. So i have to cross compiling to arm.
Usually, I have added arm-linux-gnueabi-gcc & arm-linux-gnueabi-g++ for this. And for other software, it could be used naturally. The code I used is showing below:
# 64 bit cross compiling
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR arm)
SET(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc)
SET(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++)
But when I add yaml-cpp, it was not work anymore. The ouput which is shwoing below is revolving.
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: /usr/bin/g++ - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Configuring done
[cmake] You have changed variables that require your cache to be deleted.
[cmake] Configure will be re-run and you may have to reset some variables.
[cmake] The following variables have changed:
[cmake] CMAKE_CXX_COMPILER= /usr/bin/g++
[cmake]
[cmake] -- The C compiler identification is GNU 11.4.0
[cmake] -- The CXX compiler identification is GNU 11.4.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: /usr/bin/cc - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: /usr/bin/g++ - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Configuring done
And it runs normally wihtout 64 bit cross compiling.
The CMakeLists.txt is:
make_minimum_required(VERSION 3.0.0)
project(RTUINS VERSION 0.1.0 LANGUAGES C CXX)
include(CTest)
enable_testing()
# 64 bit cross compiling
# SET(CMAKE_SYSTEM_NAME Linux)
# SET(CMAKE_SYSTEM_PROCESSOR arm)
# SET(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc)
# SET(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
INCLUDE_DIRECTORIES(${LOCAL_LIBRARY_DIRS})
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
file(GLOB CONFIG_RESOURSES "config/*.h" "config/*.cpp")
file(GLOB TIMER_RESOURCES "timer/*.h" "timer/*.cpp")
file(GLOB COMMUNICATION_RESOURCES "communication/*.h" "communication/*.cpp")
file(GLOB GENERAL_RESOURCES "general/*.h" "general/*.cpp")
file(GLOB DATAIO_RESOURSES "dataio/*.h" "dataio/*.cpp")
file(GLOB FILEIO_RESOURSES "fileio/*.h" "fileio/*.cpp")
file(GLOB TOOL_RESOURSES "tool/*.h" "tool/*.cpp" "tool/*.hpp")
file(GLOB ALIGNMENT_RESOURSES "alignment/*.h" "alignment/*.cpp")
file(GLOB CORE_RESOURSES "core/*.h" "core/*.cpp")
add_executable(RTUINS
${CONFIG_RESOURSES}
${TIMER_RESOURCES}
${COMMUNICATION_RESOURCES}
${DATAIO_RESOURSES}
${FILEIO_RESOURSES}
${TOOL_RESOURSES}
${GENERAL_RESOURCES}
${ALIGNMENT_RESOURSES}
${CORE_RESOURSES}
main.cpp)
# Eigen3
include_directories(thirdparty/eigen-3.4.0)
# yaml
add_subdirectory(thirdparty/yaml-cpp-0.8.0)
target_link_libraries(${PROJECT_NAME} yaml-cpp)
The file tree is showing below:
├── alignment
│ ├── alignment.cpp
│ ├── alignment.h
│ ├── alignmentthread.cpp
│ └── alignmentthread.h
├── bin
│ ├── parse
│ ├── read
│ ├── RTUINS
│ └── sandbox
├── build
│ ├── build.ninja
│ ├── CMakeCache.txt
│ ├── CMakeFiles
│ │ ├── 3.22.1
│ │ ├── cmake.check_cache
│ │ ├── CMakeOutput.log
│ │ ├── CMakeTmp
│ │ ├── cmake.verify_globs
│ │ ├── RTUINS.dir
│ │ ├── rules.ninja
│ │ ├── TargetDirectories.txt
│ │ └── VerifyGlobs.cmake
│ ├── cmake_install.cmake
│ ├── compile_commands.json
│ ├── CPackConfig.cmake
│ ├── CPackSourceConfig.cmake
│ ├── CTestTestfile.cmake
│ ├── DartConfiguration.tcl
│ ├── Testing
│ │ ├── 20240324-0803
│ │ ├── TAG
│ │ └── Temporary
│ └── thirdparty
│ └── yaml-cpp-0.8.0
├── CMakeLists.txt
├── communication
│ ├── serial_communication.cpp
│ ├── serial_communication.h
│ ├── serial_driver.cpp
│ └── serial_driver.h
├── config
│ ├── defineconfig.h
│ ├── yamlconfig.cpp
│ └── yamlconfig.h
├── core
│ ├── ekf.cpp
│ ├── ekf.h
│ ├── insmech.cpp
│ ├── insmech.h
│ ├── instypedef.h
│ ├── integrated.cpp
│ ├── integrated.h
│ ├── processthread.cpp
│ ├── processthread.h
│ └── systeminfo.h
├── dataio
│ ├── commandmonitor.cpp
│ ├── commandmonitor.h
│ ├── dataverify.cpp
│ ├── dataverify.h
│ ├── dvlloader.cpp
│ ├── dvlloader.h
│ ├── imuloader.cpp
│ ├── imuloader.h
│ ├── navressender.cpp
│ └── navressender.h
├── doc
│ ├── coreflow.drawio
│ ├── framework.xmind
│ └── systemflow.drawio
├── fileio
│ ├── filebase.h
│ ├── filesaver.cpp
│ ├── filesaver.h
│ ├── navfilethread.cpp
│ ├── navfilethread.h
│ ├── savefilethread.cpp
│ └── savefilethread.h
├── general
│ ├── angle.h
│ ├── earth.h
│ ├── rotation.h
│ └── typedef.h
├── lib
│ └── libyaml-cpp.a
├── main.cpp
├── README.md
├── saveddata
│ ├── dvldata20240321_201713.dat
│ ├── HostComputer.py
│ ├── imudata20240321_201713.dat
│ ├── navdata20240321_201713.dat
│ ├── navdata20240323_205931.dat
│ ├── res1
│ │ ├── dvldata20240321_112553.dat
│ │ ├── imudata20240321_112553.dat
│ │ └── navdata20240321_112553.dat
│ └── showdata.py
├── thirdparty
│ ├── eigen-3.4.0
│ │ ├── bench
│ │ ├── blas
│ │ ├── ci
│ │ ├── cmake
│ │ ├── CMakeLists.txt
│ │ ├── COPYING.APACHE
│ │ ├── COPYING.BSD
│ │ ├── COPYING.GPL
│ │ ├── COPYING.LGPL
│ │ ├── COPYING.MINPACK
│ │ ├── COPYING.MPL2
│ │ ├── COPYING.README
│ │ ├── CTestConfig.cmake
│ │ ├── CTestCustom.cmake.in
│ │ ├── debug
│ │ ├── demos
│ │ ├── doc
│ │ ├── Eigen
│ │ ├── eigen3.pc.in
│ │ ├── failtest
│ │ ├── INSTALL
│ │ ├── lapack
│ │ ├── README.md
│ │ ├── scripts
│ │ ├── signature_of_eigen3_matrix_library
│ │ ├── test
│ │ └── unsupported
│ └── yaml-cpp-0.8.0
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ ├── cmake_uninstall.cmake.in
│ ├── CONTRIBUTING.md
│ ├── docs
│ ├── include
│ ├── install.txt
│ ├── LICENSE
│ ├── README.md
│ ├── SECURITY.md
│ ├── src
│ ├── test
│ ├── util
│ ├── WORKSPACE
│ ├── yaml-cpp-config.cmake.in
│ └── yaml-cpp.pc.in
├── timer
│ ├── timebase.cpp
│ ├── timebase.h
│ ├── timeouthandler.cpp
│ ├── timeouthandler.h
│ ├── timestamp.cpp
│ └── timestamp.h
└── tool
├── ColorParse.cpp
├── ColorParse.h
├── MBUtils.cpp
├── MBUtils.h
└── SafeQueue.hpp
I tried everyting I could. Please help me, thanks.
add corss compiling and yaml-cpp
# 64 bit cross compiling
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR arm)
SET(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc)
SET(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++)
The configure ouput which is shwoing below is revolving.
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: /usr/bin/g++ - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Configuring done
[cmake] You have changed variables that require your cache to be deleted.
[cmake] Configure will be re-run and you may have to reset some variables.
[cmake] The following variables have changed:
[cmake] CMAKE_CXX_COMPILER= /usr/bin/g++
[cmake]
[cmake] -- The C compiler identification is GNU 11.4.0
[cmake] -- The CXX compiler identification is GNU 11.4.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: /usr/bin/cc - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: /usr/bin/g++ - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Configuring done