1

我面临与此处相同的问题:使用 LTO 版本 6.0 而不是预期的 8.1 生成

我尝试使用 docker 入门中的信息构建新的 2.0 传感器固件。启动后:

ninja pkgs

编译失败并显示库“libmovesense-coreD.a”是使用 LTO 版本 6 构建的,但预期是版本 8.1。

我还在 Ubuntu 19.10 上手动安装了 cmake 3.18.1 和 arm 工具链 2017_q4,但由于 LTO 包装器故障导致它在步骤 8/12 停止。

(...下面的一些行...)

我只是从 Movesense 主页复制了 cmake 命令并添加了 sample_app 的目录。这是我从 docker-container 中的 movesense/myBuild/ 开始的代码:

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

为了提供一些信息,这是 cmake 的结果:

CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is GNU 9.2.1
-- The CXX compiler identification is GNU 9.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is GNU
-- Found assembler: /opt/gcc-arm-none-eabi/bin/arm-none-eabi-gcc
CMake Warning at /movesense/MovesenseCoreLib/MovesenseFromStaticLib.cmake:19 (message):
  Defaulting build type to 'Debug'
Call Stack (most recent call first):
  CMakeLists.txt:13 (include)


-- PATH_TOOL_PYTHON will use python from shell PATH
nrfutil version >=4 detected. adding --no-backup option
-- Configuring done
-- Generating done
-- Build files have been written to: /movesense/myBuild

我不关心“ABI info - failed”警告,因为最后一行说构建文件已被写入。也许这有点愚蠢。

在这里,“ninja pkgs”命令的完整输出(我删除了上面的那个):

[1/12] Generating generated/app-resources/resources.c.h, generated/app-resources/resources.h, generated/app-resources/resources.cpp, app-resources.wbo
WBRES run with parameters:
    --includeDir
    /movesense/myBuild/../MovesenseCoreLib//resources/whiteboard/builtinTypes
    --includeDir
    /movesense/myBuild/../MovesenseCoreLib//resources/movesense-api
    --includeDir
    /movesense/myBuild/../MovesenseCoreLib//resources/movesense-api/comm
    --includeDir
    /movesense/myBuild/../MovesenseCoreLib//resources/movesense-api/component
    --includeDir
    /movesense/myBuild/../MovesenseCoreLib//resources/movesense-api/meas
    --includeDir
    /movesense/myBuild/../MovesenseCoreLib//resources/movesense-api/mem
    --includeDir
    /movesense/myBuild/../MovesenseCoreLib//resources/movesense-api/misc
    --includeDir
    /movesense/myBuild/../MovesenseCoreLib//resources/movesense-api/system
    --includeDir
    /movesense/myBuild/../MovesenseCoreLib//resources/movesense-api/ui
    --cheaderFile
    /movesense/myBuild/generated/app-resources/resources.c.h
    --headerFile
    /movesense/myBuild/generated/app-resources/resources.h
    --sourceFile
    /movesense/myBuild/generated/app-resources/resources.cpp
    --libFile
    /movesense/myBuild/app-resources.wbo
    --cppDepends
    ../wb-resources/resources.h
    /movesense/samples/plain_app/app_root.yaml

[2/12] Generating app-metadata/metadata.cpp
WBRES run with parameters:
    --metadataSourceFile
    /movesense/myBuild/app-metadata/metadata.cpp
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/comm_1wire.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/comm_ble.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/comm_ble_gattsvc.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/component_ds24l65.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/component_eeprom.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/component_led.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/component_lsm6ds3.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/component_max3000x.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/component_nrf52.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/dev_system.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/device_system_debug.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/device_system_shutdown.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/device_systemevent.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/meas_acc.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/meas_ecg.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/meas_gyro.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/meas_hr.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/meas_imu.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/meas_magn.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/meas_temp.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/mem_datalogger.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/mem_logbook.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/misc_calibration.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/misc_gear.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/misc_manufacturing.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/movesense_info.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/movesense_time.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/movesense_types.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/system_debug.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/system_energy.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/system_memory.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/system_mode.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/system_settings.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/system_states.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/ui_ind.wbo
    /movesense/myBuild/../MovesenseCoreLib//resources/GCCARM/Debug/wb-resources.wbo
    /movesense/myBuild/app-resources.wbo

Metadata:
  Strings: 622 (6929B)
  Execution contexts: 2 (24B)
  Security tags: 6 (12B)
  Properties: 276 (1656B)
  Property list entries: 451 (902B)
  Sequential enum list entries: 107 (214B)
  Non-sequential enum list entries: 29 (232B)
  Data types: 374 (2244B)
  Data type list entries: 76 (152B)
  Parameters: 101 (606B)
  Parameter list entries: 185 (370B)
  Responses: 135 (540B)
  Response list entries: 420 (840B)
  Operations: 182 (2184B)
  Operation lists: 137 (1644B)
  Resource tree nodes: 200 (2800B)
  Resource tree node list entries: 76 (152B)
[3/12] Generating SBEM serialization code
Skipped argument since not a valid yaml glob:  /movesense/myBuild/../MovesenseCoreLib//generated/GCCARM/Debug
processing following yaml-files:
Processing total  21  .yaml-files
Found  44  resources and  63  datatype definitions.
Scanning  42  WB-resources
Creating SBEM-Groups
Generating C++ code.  20  groups,  46  items
skipping unsupported resource:  /Net
[8/12] Linking CXX executable Movesense
FAILED: Movesense 
: && /opt/gcc-arm-none-eabi/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 -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 -L/movesense/MovesenseCoreLib/app-build/compiler/../platform/nRF5x/linker/gcc -fuse-linker-plugin -flto   -T/movesense/MovesenseCoreLib/app-build/compiler/../platform/nRF5x/linker/gcc/appflash.ld CMakeFiles/Movesense.dir/App.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  /movesense/MovesenseCoreLib/lib/GCCARM/libmovesense-coreD.a  -lm  -lstdc++ && :
lto1: fatal error: bytecode stream in file '/movesense/MovesenseCoreLib/lib/GCCARM/libmovesense-coreD.a' generated with LTO version 6.0 instead of the expected 8.1
compilation terminated.
lto-wrapper: fatal error: /opt/gcc-arm-none-eabi/bin/arm-none-eabi-gcc returned 1 exit status
compilation terminated.
/opt/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

我只尝试在我的电脑上手动安装和构建 cmake 和 arm-toolchain,导致 docker-build 失败。

谢谢您的帮助!

Ps 在 2.0 固件预览版的“工具设置”部分中,指向您的 Bitbucket 存储库的链接错误(第二个浅灰色框)。

4

1 回答 1

0

看起来您拥有使用 GCC 6.0(可能是 1.9.4 即当前主版本)而不是 2.0 预发行版构建的 MovesenseCoreLib。我的猜测是您还没有签出 2.0 分支。

尝试运行

git checkout release/2.0-preview

在 movesense-device-lib 文件夹上。

于 2020-09-22T06:30:31.463 回答