bl_iot_sdk: Builds in customer_app fail on MacOS
Any idea why this happens? I have no clue, where to find the error…
/Users/sychram/Repositories/bl_iot_sdk-ubuntu/bl_iot_sdk/toolchain/riscv/Darwin/bin/../lib/gcc/riscv64-unknown-elf/8.3.0/../../../../riscv64-unknown-elf/bin/ld: /Users/sychram/Repositories/bl_iot_sdk-ubuntu/bl_iot_sdk/toolchain/riscv/Darwin/bin/../lib/gcc/riscv64-unknown-elf/8.3.0/../../../../riscv64-unknown-elf/lib/rv64imafdc/lp64d/crt0.o: in function `.L0 ':
(.text+0x2e): undefined reference to `main'
Then at the crt.o file:
bl_iot_sdk/toolchain/riscv/Darwin/riscv64-unknown-elf/lib/rv64imafdc/lp64d$ nm -C ./crt0.o
0000000000000008 t .L0
0000000000000010 t .L0
0000000000000024 t .L0
0000000000000000 t .L11
U __global_pointer$
U __libc_fini_array
U __libc_init_array
U _edata
U _end
0000000000000000 T _start
U atexit
U exit
U main
U memset
Also in objdump those symbols seem to be undefined indeed.
$ objdump -t ./crt0.o
./crt0.o: file format ELF64-riscv
SYMBOL TABLE:
0000000000000000 l d .text 00000000 .text
0000000000000000 l d .data 00000000 .data
0000000000000000 l d .bss 00000000 .bss
0000000000000000 .text 00000000 .L11
0000000000000008 .text 00000000 .L0
0000000000000010 .text 00000000 .L0
0000000000000024 .text 00000000 .L0
0000000000000000 l d .riscv.attributes 00000000 .riscv.attributes
0000000000000000 g F .text 00000052 _start
0000000000000000 *UND* 00000000 __global_pointer$
0000000000000000 *UND* 00000000 _edata
0000000000000000 *UND* 00000000 _end
0000000000000000 *UND* 00000000 memset
0000000000000000 *UND* 00000000 __libc_fini_array
0000000000000000 *UND* 00000000 atexit
0000000000000000 *UND* 00000000 __libc_init_array
0000000000000000 *UND* 00000000 main
0000000000000000 *UND* 00000000 exit
When trying to run the same command in ubuntu-20 docker container, this does not fail.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 19 (2 by maintainers)
You’re welcome. This was gnarly to stick with to the end.
This is very much a reason to never set things like CC, LDFLAGS, CFLAGS, and such in a .login or similar place. Even CPU=BL602 (or whatever it is) doesn’t leak into my global build environment; it stays in little scripts that build the local project.
I have way too many projects (and compilers and cpus and …) to inflict such pain on myself. 😃
Glad you found the source of the issue on that machine. Happy hacking.
The issue was actually caused by existing environment variable
LDFLAGS
.Issue was solved using: