1. 撸一个 toolchain.cmake
set( CMAKE_SYSTEM_NAME Linux ) set( CMAKE_SYSTEM_PROCESSOR arm ) set( CMAKE_C_COMPILER arm-linux-gnueabihf-gcc ) set( CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++ ) set( CMAKE_INSTALL_PREFIX /home/albireo/lib_arm/sophus)
2. cmake
source /media/albireo/backup/opt/Xilinx/SDK/2017.1/settings64.sh cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DCMAKE_INSTALL_PREFIX=/home/albireo/lib_arm/sophus ..
3. make
报错
cc1plus: error: include location "/usr/include/eigen3" is unsafe for cross-compilation [-Werror=poison-system-directories] ... /home/albireo/lib/ARM/Sophus/sophus/so2.cpp:32:26: error: lvalue required as left operand of assignment unit_complex_.real() = 1.; ^~ /home/albireo/lib/ARM/Sophus/sophus/so2.cpp:33:26: error: lvalue required as left operand of assignment unit_complex_.imag() = 0.; ... cc1plus: all warnings being treated as errors
4. 神马?warnings being treated as errors?
修改CMakeLists.txt
16行:
ADD_DEFINITIONS("-Wall -Werror -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unknown-pragmas ")
去掉-Werror
5. 修改so2.cpp
SO2::SO2() { unit_complex_= std::complex<double>(1,0); // unit_complex_.real() = 1.; // unit_complex_.imag() = 0.; }
如上修改
伊克斯kiu死米?喵喵喵???这什么鬼语法???为啥之前编译能通过的我很好骑
6. make, make install