Compilation error conflict with zephyr and gccarmnoneeabi toolchain?

Hello, Can’t solve this part. It seems framework-zephyr libs is conflicting with gccarmnoneeabi toolchain. Tried reinstalling and installing platformio but doesn’t work. My project compiled succesfully before after how many months this happens (didn’t edit anything with my code) .
TIA

/home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.bfd: /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o): in function __retarget_lock_init': /home/ghil/.platformio/packages/framework-zephyr/lib/libc/newlib/libc-hooks.c:353: multiple definition of __retarget_lock_init’; /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_init+0x0): first defined here
/home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.bfd: /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o): in function __retarget_lock_init_recursive': /home/ghil/.platformio/packages/framework-zephyr/lib/libc/newlib/libc-hooks.c:369: multiple definition of __retarget_lock_init_recursive’; /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_init_recursive+0x0): first defined here
/home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.bfd: /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o): in function __retarget_lock_close': /home/ghil/.platformio/packages/framework-zephyr/lib/libc/newlib/libc-hooks.c:388: multiple definition of __retarget_lock_close’; /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_close+0x0): first defined here
/home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.bfd: /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o): in function __retarget_lock_close_recursive': libc-hooks.c:(.text.__retarget_lock_close_recursive+0x0): multiple definition of __retarget_lock_close_recursive’; /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_close_recursive+0x0): first defined here
/home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.bfd: /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o): in function k_sem_take': /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/include/generated/syscalls/kernel.h:913: multiple definition of __retarget_lock_acquire’; /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_acquire+0x0): first defined here
/home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.bfd: /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o): in function k_mutex_lock': /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/include/generated/syscalls/kernel.h:801: multiple definition of __retarget_lock_acquire_recursive’; /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_acquire_recursive+0x0): first defined here
/home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.bfd: /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o): in function __retarget_lock_try_acquire': /home/ghil/.platformio/packages/framework-zephyr/lib/libc/newlib/libc-hooks.c:421: multiple definition of __retarget_lock_try_acquire’; /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_try_acquire+0x0): first defined here
/home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.bfd: /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o): in function __retarget_lock_try_acquire_recursive': /home/ghil/.platformio/packages/framework-zephyr/lib/libc/newlib/libc-hooks.c:428: multiple definition of __retarget_lock_try_acquire_recursive’; /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_try_acquire_recursive+0x0): first defined here
/home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.bfd: /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o): in function k_sem_give': /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/include/generated/syscalls/kernel.h:930: multiple definition of __retarget_lock_release’; /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_release+0x0): first defined here
/home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.bfd: /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o): in function k_mutex_unlock': /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/include/generated/syscalls/kernel.h:817: multiple definition of __retarget_lock_release_recursive’; /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_release_recursive+0x0): first defined here
/home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.bfd: warning: size of symbol __lock___arc4random_mutex' changed from 1 in /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o) to 24 in /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o) /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.bfd: warning: size of symbol __lock___dd_hash_mutex’ changed from 1 in /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o) to 24 in /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o)
/home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.bfd: warning: size of symbol __lock___tz_mutex' changed from 1 in /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o) to 24 in /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o) /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.bfd: warning: size of symbol __lock___at_quick_exit_mutex’ changed from 1 in /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o) to 24 in /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o)
/home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.bfd: warning: size of symbol __lock___env_recursive_mutex' changed from 1 in /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o) to 20 in /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o) /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.bfd: warning: size of symbol __lock___malloc_recursive_mutex’ changed from 1 in /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o) to 20 in /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o)
/home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.bfd: warning: size of symbol __lock___atexit_recursive_mutex' changed from 1 in /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o) to 20 in /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o) /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.bfd: warning: size of symbol __lock___sfp_recursive_mutex’ changed from 1 in /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o) to 20 in /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o)
/home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.bfd: warning: size of symbol `__lock___sinit_recursive_mutex’ changed from 1 in /home/ghil/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a(lib_a-lock.o) to 20 in /home/ghil/Documents/PlatformIO/Projects/imtp/.pio/build/vbluno52/zephyr/lib/libc/newlib/liblib__libc__newlib.a(libc-hooks.c.o)
collect2: error: ld returned 1 exit status
*** [.pio/build/vbluno52/zephyr/firmware-pre.elf] Error 1

I’ve seen this happen when the zephyr/prj.conf specifies two C libraries to be included (libc and libc_nano). What’s the content of your zephyr/prj.conf?

Wow thank you very much, that solves the problem. I wonder why it works before or some internal upgrades happened. Btw for curiosity what if I retain the libc and discard the libc_nano instead, how can I do that?

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_SMP=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_DEVICE_NAME=“xxxxxxxx”
CONFIG_ADC=y
CONFIG_ADC_ASYNC=y
#CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
#CONFIG_NEWLIB_LIBC=y

I think per https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_NEWLIB_LIBC_NANO.html?highlight=libc_nano you just give it CONFIG_NEWLIB_LIBC and never any of the CONFIG_NEWLIB_LIBC_NANO options.

All working again. When I removed the LIBC, serial debug prints don’t work anymore and the device won’t advertise anymore. What I did is I returned the commented out LIBC and added this option. All working again. Thank you again for the help.

CONFIG_NEWLIB_LIBC_NANO=n