问题
I’ve followed the setup instructions for movesense for windows [1] and run the below cmake command, which seem to work okay. However, when I run the ninja command it fails on step 9/9 complaining that the LTO version doesn’t match the configuration. Any advice?
$ cmake -G Ninja -DMOVESENSE_CORE_LIBRARY=../MovesenseCoreLib/ -DCMAKE_TOOLCHAIN_FILE=../MovesenseCoreLib/toolchain/gcc-nrf52.cmake ../samples/blinky_app/
Error:
[9/9] Linking CXX executable Movesense FAILED: Movesense cmd.exe /C "cd . && C:\PROGRA~2\GNUTOO~1\92019-~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~1\92019-~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
The only part of the installation im not sure went well is the installation of "Visual Studio Redistributable 2015" it said i had a newer version and I wasn't sure how to verify that this step was made properly.
I've now also tried the same thing using the "Vagrant solution" and the error i get on the final step when i type ninja dfupkg is this:
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/
回答1:
Seems that you are trying to compile the code with wrong version of the compiler (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
, you should install the 2017q4 version of the compiler toolchain.
Vagrant is not up to date (there is probably wrong compiler version), so I recommend not to use it or you need to modify it with yourself heavily.
来源:https://stackoverflow.com/questions/59991247/generated-with-lto-version-6-0-instead-of-the-expected-8-1