Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LTO causes internal compiler error #65

Closed
freespace opened this issue Aug 30, 2017 · 1 comment
Closed

LTO causes internal compiler error #65

freespace opened this issue Aug 30, 2017 · 1 comment

Comments

@freespace
Copy link

freespace commented Aug 30, 2017

Occasionally avr-gcc will crash when compiling:

Linking .pioenvs/uno/firmware.elf
/home/steve/.platformio/packages/framework-arduinoavr/cores/arduino/main.cpp: In function 'main':
/home/steve/.platformio/packages/framework-arduinoavr/cores/arduino/main.cpp:51:1: internal compiler error: Segmentation fault
}
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: avr-g++ returned 1 exit status
/home/steve/.platformio/packages/toolchain-atmelavr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld: lto-wrapper failed
collect2: error: ld returned 1 exit status
*** [.pioenvs/uno/firmware.elf] Error 1

This seems related to link time optimisation: sudar/Arduino-Makefile#486

I can verify that adding the following to my environment resolves the issue:

build_unflags = -flto

However on code where this workaround is not required, LTO does reduces binary size.

I am not sure what the correct fix is as this seems to be an issue from the bowels of the compiler. However this ticket should help future users when googling the symptoms.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@ivankravets
Copy link
Member

Please pio update to the latest version. The toolchains were updated before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants