使用 LTO 版本 6.0 而不是预期的 8.1 生成

Generated with LTO version 6.0 instead of the expected 8.1

我已经按照 windows [1] 和 运行 的 movesense 设置说明执行了下面的 cmake 命令,这似乎工作正常。但是,当我 运行 ninja 命令时,它在第 9/9 步失败,抱怨 LTO 版本与配置不匹配。有什么建议吗?

$ cmake -G Ninja -DMOVESENSE_CORE_LIBRARY=../MovesenseCoreLib/ -DCMAKE_TOOLCHAIN_FILE=../MovesenseCoreLib/toolchain/gcc-nrf52.cmake ../samples/blinky_app/

错误:

[9/9] Linking CXX executable Movesense FAILED: Movesense cmd.exe /C "cd . && C:\PROGRA~2\GNUTOO~1019-~1\bin\AR19DD~1.EXE -W -Wall -Werror -Wfatal-errors -Wshadow -Wpointer-arith -Wcast-qual -Wwrite-strings -Wunreachable-code -Wsign-compare -Wno-aggregate-return -Wno-unused-parameter -Wno-unused-function -Wno-cast-align -Wno-strict-aliasing -Wno-maybe-uninitialized -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fno-common -ffreestanding -fno-builtin -mapcs -gdwarf-3 -std=gnu++11 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fno-unwind-tables -fno-use-cxa-atexit -fno-threadsafe-statics -Wno-lto-type-mismatch -Wno-old-style-declaration -Wno-discarded-qualifiers -Wp,-w -Wno-write-strings -U__INT32_TYPE__ -D__INT32_TYPE__=int -U__UINT32_TYPE__ -D__UINT32_TYPE__="unsigned int" -flto -fno-fat-lto-objects -Os -g -DWB_UNITTEST_BUILD -Wl,--wrap -Wl,_malloc_r -Wl,--wrap -Wl,_calloc_r -Wl,--wrap -Wl,_free_r -Wl,--wrap -Wl,_realloc_r --specs=nano.specs --specs=nosys.specs -Wl,-Map -Wl,target.map -Wl,--gc-sections -Wl,-static -LC:/Users/user/Desktop/Repositories/Clones/movesense-device-lib/MovesenseCoreLib/app-build/compiler/../platform/nRF5x/linker/gcc -fuse-linker-plugin -flto -TC:/Users/user/Desktop/Repositories/Clones/movesense-device-lib/MovesenseCoreLib/app-build/compiler/../platform/nRF5x/linker/gcc/appflash.ld CMakeFiles/Movesense.dir/App.cpp.obj CMakeFiles/Movesense.dir/BlinkyClient.cpp.obj CMakeFiles/Movesense.dir/generated/sbem-code/sbem_definitions.cpp.obj CMakeFiles/Movesense.dir/generated/app-resources/resources.cpp.obj CMakeFiles/Movesense.dir/app-metadata/metadata.cpp.obj -o Movesense C:/Users/user/Desktop/Repositories/Clones/movesense-device-lib/MovesenseCoreLib/lib/GCCARM/libmovesense-coreD.a -lm -lstdc++ && cd ." lto1.exe: fatal error: bytecode stream in file 'C:/Users/user/Desktop/Repositories/Clones/movesense-device-lib/MovesenseCoreLib/lib/GCCARM/libmovesense-coreD.a' generated with LTO version 6.0 instead of the expected 8.1 compilation terminated. lto-wrapper.exe: fatal error: C:\PROGRA~2\GNUTOO~1019-~1\bin\AR19DD~1.EXE returned 1 exit status compilation terminated. c:/progra~2/gnutoo~1/92019-~1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: error: lto-wrapper failed collect2.exe: error: ld returned 1 exit status ninja: build stopped: subcommand failed.

GCC --version 8.2.0
cmake --version 3.16.3
ninja --version 1.10.0
nrfutil --help

我不确定安装的唯一部分是安装 "Visual Studio Redistributable 2015" 它说我有一个更新的版本,我不确定如何验证这一步是否正确。


我现在也使用 "Vagrant solution" 尝试了同样的事情,当我输入 ninja dfupkg 时,我在最后一步遇到的错误是:

FAILED: Movesense : && /usr/bin/arm-none-eabi-gcc -W -Wall -Werror -Wfatal-errors -Wshadow -Wpointer-arith -Wcast-qual -Wwrite-strings -Wunreachable-code -Wsign-compare -Wno-aggregate-return -Wno-unused-parameter -Wno-unused-function -Wno-cast-align -Wno-strict-aliasing -Wno-maybe-uninitialized -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fno-common -ffreestanding -fno-builtin -mapcs -gdwarf-3 -std=gnu++11 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fno-unwind-tables -fno-use-cxa-atexit -fno-threadsafe-statics -Wno-lto-type-mismatch -Wno-old-style-declaration -Wno-discarded-qualifiers -Wp,-w -Wno-write-strings -U__INT32_TYPE__ -D__INT32_TYPE__=int -U__UINT32_TYPE__ -D__UINT32_TYPE__="unsigned int" -flto -fno-fat-lto-objects -Os -O3 -DNDEBUG -Wl,--wrap -Wl,_malloc_r -Wl,--wrap -Wl,_calloc_r -Wl,--wrap -Wl,_free_r -Wl,--wrap -Wl,_realloc_r --specs=nano.specs --specs=nosys.specs -Wl,-Map -Wl,target.map -Wl,--gc-sections -Wl,-static -L/vagrant/movesense-device-lib/MovesenseCoreLib/app-build/compiler/../platform/nRF5x/linker/gcc -fuse-linker-plugin -flto -T/vagrant/movesense-device-lib/MovesenseCoreLib/app-build/compiler/../platform/nRF5x/linker/gcc/appflash.ld CMakeFiles/Movesense.dir/App.cpp.obj CMakeFiles/Movesense.dir/BlinkyClient.cpp.obj CMakeFiles/Movesense.dir/generated/sbem-code/sbem_definitions.cpp.obj CMakeFiles/Movesense.dir/generated/app-resources/resources.cpp.obj CMakeFiles/Movesense.dir/app-metadata/metadata.cpp.obj -o Movesense /vagrant/movesense-device-lib/MovesenseCoreLib/lib/GCCARM/libmovesense-core.a -lm -lstdc++ && : lto1: internal compiler error: bytecode stream: expected tag round_div_expr instead of reference_type Please submit a full bug report, with preprocessed source if appropriate. See https://gcc.gnu.org/bugs/ for instructions. lto-wrapper: fatal error: /usr/bin/arm-none-eabi-gcc returned 1 exit status compilation terminated. /usr/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.

[1] https://bitbucket.org/suunto/movesense-device-lib/src/master/

似乎您正在尝试使用错误版本的编译器 (gcc 9.2.1) 编译代码c:/progra~2/gnutoo~1/92019-~1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe,您应该安装 2017q4 版本的编译器工具链。

Vagrant 不是最新的(可能是编译器版本不对),所以我建议不要使用它,否则你需要自己大量修改它。