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

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
svenssonjoel
Posts: 10
Joined: Wed Jul 31, 2019 10:38 am
Been thanked: 1 time

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

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

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

Post by Giovanni »

Hi,

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

Giovanni
svenssonjoel
Posts: 10
Joined: Wed Jul 31, 2019 10:38 am
Been thanked: 1 time

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

Post by svenssonjoel »

Great! Thanks.

Have a good day.
Post Reply