命令行直接编译是可以通过的,但是通过CmakeList 编译是 通不过 cmake_minimum_required(VERSION 3.5.1) project(learn_test) # #告诉CMAKE是进行交叉编译 # set(CMAKE_CROSSCOMPILING TRUE) # #设置此时进行编译的系统 # set(CMAKE_SYSTEM_NAME "Linux") # #指定交叉编译器的路径 set(COMPILER_PATH "/opt/sysroot/firefly-arm64-sysroot-18.04/usr") set(CMAKE_CXX_COMPILER "${COMPILER_PATH}/bin/aarch64-linux-gnu-g++") add_executable(learn_test src/test.cpp) gobot@ubuntu:~/learn_test/build$ make Scanning dependencies of target learn_test [ 50%] Building CXX object CMakeFiles/learn_test.dir/src/test.cpp.o /opt/sysroot/firefly-arm64-sysroot-18.04/usr/bin/aarch64-linux-gnu-g++: 1: /opt/sysroot/firefly-arm64-sysroot-18.04/usr/bin/aarch64-linux-gnu-g++: ELF���E@�c@8: not found /opt/sysroot/firefly-arm64-sysroot-18.04/usr/bin/aarch64-linux-gnu-g++: 1: /opt/sysroot/firefly-arm64-sysroot-18.04/usr/bin/aarch64-linux-gnu-g++: Syntax error: word unexpected (expecting ")") CMakeFiles/learn_test.dir/build.make:62: recipe for target 'CMakeFiles/learn_test.dir/src/test.cpp.o' failed make[2]: *** [CMakeFiles/learn_test.dir/src/test.cpp.o] Error 2 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/learn_test.dir/all' failed make[1]: *** [CMakeFiles/learn_test.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2 |
-
416 Bytes, 下载次数: 0, 下载积分: 灯泡 -1 , 经验 -1