【发布时间】:2015-04-04 21:30:01
【问题描述】:
我正在尝试在 Eclipse 中构建 arduino 代码。我能够很好地构建 ArduinoCore。但是在构建应用程序时,我在链接过程中遇到了分段错误。
Building target: TestAVR.elf
Invoking: AVR C++ Linker
avr-gcc –cref -s -Os -o”TestAVR.elf” ./src/main.o -lArduinoCore -lm -Wl,-Map,TestAVR.map,–cref -mrelax -Wl,–gc-sections -L/home/harsh/workspace/avr/ArduinoCore/Release -mmcu=atmega328p
collect2: ld terminated with signal 11 [Segmentation fault], core dumped
make: *** [TestAVR.elf] Error 1
Binutils is the latest version
所有工具似乎都是最新的。是库没有正确构建还是链接器有问题?
【问题讨论】:
-
如果您的链接器段错误。这是链接器中的错误。正确的程序不会出现段错误。
-
我该如何解决这个问题?
-
提交错误报告并希望他们修复它。在此之前,要么更改您的代码以使其不会触发错误,要么使用其他工具。
-
对不起,我遵循了一个教程,其中提到链接器命令为 avr-gcc –cref -s -Os -o”TestAVR.elf” ./src/main.o -lArduinoCore -lm - Wl,-Map,TestAVR.map,–cref -mrelax -Wl,–gc-sections -L/home/harsh/workspace/avr/ArduinoCore/Release -mmcu=atmega328p 我把它改成了avr-g++,它工作正常
-
糟糕,我错过了。链接器应该仍然没有段错误,但我想它不能使用错误的语言是可以原谅的。