Page 1 of 1

undefined ref to _exit even though syscalls.c is added to CSRC

Posted: Tue Jun 15, 2021 7:10 pm
by svenssonjoel
Hello.

I get this error upon linking:

in function `abort':
abort.c:(.text.abort+0xa): undefined reference to `_exit'
/home/storage/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /home/storage/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libg.a(lib_a-signalr.o): in function `_kill_r':
signalr.c:(.text._kill_r+0x12): undefined reference to `_kill'
/home/storage/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /home/storage/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libg.a(lib_a-signalr.o): in function `_getpid_r':
signalr.c:(.text._getpid_r+0x0): undefined reference to `_getpid'
collect2: error: ld returned 1 exit status

And this is even though I have added $(CHIBIOS)/os/various/syscalls.c\ to CSRC and I can see that in the call to gcc, syscalls.o is present.

arm-none-eabi-gcc ./build/obj/crt0_v7m.o ./build/obj/vectors.o ./build/obj/chcoreasm_v7m.o ./build/obj/syscalls.o

What could be the cause of this? Are there some other configurations to tweak here?
If anyone has any idea what could cause this let me know. ChibiOS version 20.3.2.

Thanks, have a great day.

Re: undefined ref to _exit even though syscalls.c is added to CSRC

Posted: Tue Jun 15, 2021 7:25 pm
by Giovanni
Hi,

In that version syscalls.c is not complete, you should update to 20.3.3 or 21.6.0.

Giovanni

Re: undefined ref to _exit even though syscalls.c is added to CSRC

Posted: Tue Jun 15, 2021 8:38 pm
by svenssonjoel
Great! Thanks.

Have a good day.