不良缺陷;格式为-Defsym名称=值
说明:我已经创建了一个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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
错误的来源是汇编程序编译器工具链定义中。通过键入
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 ofarm-none-eabi-as.exe
.您的
ldflags
有错误:-wl,-gc-sections
-defsym ... __cxa_pure_virtual = 1
应该是更改为-wl, - defsym,__ cxa_pure_virtual = 1
Your
LDFLAGS
have mistakes:-Wl, --gc-sections
-defsym ... __cxa_pure_virtual=1
should be changed to-Wl,--defsym,__cxa_pure_virtual=1