不良缺陷;格式为-Defsym名称=值

发布于 2025-02-07 22:43:41 字数 622 浏览 2 评论 0原文

说明:我已经创建了一个STM32项目,旨在获取独立于平台的构建和输出文件,例如.hex,.bin和.elf。为此,我在CMake Build System下创建了项目。已经进行了CMAKE配置设置和工具链设置。但是,在构建阶段结束时,我遇到了这个错误。

链接标志:在“ Compiler_flags.cmake”文件下。

...

set(LD_FLAGS "-Wl,-Map=${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.map,--cref -T${LD_SCRIPT} -Wl,--gc-sections -static,--specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -Wl,--defsym,__cxa_pure_virtual=1 -Wl,--start-group -lc -lm -Wl,--end-group")

错误输出:

...
...
...

Assembler messages:
Fatal error: bad defsym; format is --defsym name=value
ninja: build stopped: subcommand failed.

Explanation: I've created an STM32 project and aim to get a platform-independent build and output file like .hex, .bin, and .elf. For this, I created the project under the CMake build system. CMake configuration settings and toolchain settings have been made. However, towards the end of the build phase, I encountered this error.

Linker flags: Under "compiler_flags.cmake" file.

...

set(LD_FLAGS "-Wl,-Map=${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.map,--cref -T${LD_SCRIPT} -Wl,--gc-sections -static,--specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -Wl,--defsym,__cxa_pure_virtual=1 -Wl,--start-group -lc -lm -Wl,--end-group")

Error output:

...
...
...

Assembler messages:
Fatal error: bad defsym; format is --defsym name=value
ninja: build stopped: subcommand failed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

绳情 2025-02-14 22:43:42

错误的来源是汇编程序编译器工具链定义中。通过键入Arm-None-eabi-gcc.exe而不是ARM-NONE-NONE-EABI-AS.EXE来解决该问题。

The source of the error was in the assembler compiler toolchain definition. The problem was solved by typing arm-none-eabi-gcc.exe instead of arm-none-eabi-as.exe.

木有鱼丸 2025-02-14 22:43:41

您的ldflags有错误:

  • -wl,-gc-sections
  • -defsym ... __cxa_pure_virtual = 1应该是更改为-wl, - defsym,__ cxa_pure_virtual = 1

Your LDFLAGS have mistakes:

  • there should be no whitespace in -Wl, --gc-sections
  • -defsym ... __cxa_pure_virtual=1 should be changed to -Wl,--defsym,__cxa_pure_virtual=1
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文