Linker error when compiling ARM demo project

2.5k Views Asked by At

I installed the GNU ARM Embedded Toolchain gcc-arm-none-eabi

When I run make on one of the demo projects from https://github.com/ChibiOS/ChibiOS-RT

I get this linker error

main.c: In function 'Thread1':
main.c:36:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
main.c: In function 'Thread2':
main.c:53:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
Linking build/ch.elf
main.c: In function 'main':
main.c:58:5: internal compiler error: Segmentation fault
 int main(void) {
     ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: arm-none-eabi-gcc returned 1 exit status
/usr/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld: lto-wrapper failed
collect2: error: ld returned 1 exit status
make: *** [build/ch.elf] Error 1
1

There are 1 best solutions below

0
On

GCC 4.8 does not support LTO and ggdb enabled together. Just disable one or another.

Try to configure your Makefile:

USE_LTO = no

or

USE_OPT = -O2 -fomit-frame-pointer -falign-functions=16

without -ggdb flag