Pros gcc build error multiple definitions

I was setting up a new linux PC with pros. After installing arm-none-eabi-binutils 2.34-2, arm-none-eabi-gcc 10.2.0-1, arm-none-eabi-newlib 3.3.0-2, and pros-cli I’m getting this error. I know that the project builds fine on an other PC so it’s something with my GCC config.

Cleaning project
Creating cold package with libc,libm,libpros,okapilib [ERRORS]
/usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/lib/thumb/v7+fp/softfp/libc.a(lib_a-lock.o): in function `__retarget_lock_init':
lock.c:(.text.__retarget_lock_init+0x0): multiple definition of `__retarget_lock_init'; ./firmware/libc.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_init+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/lib/thumb/v7+fp/softfp/libc.a(lib_a-lock.o): in function `__retarget_lock_init_recursive':
lock.c:(.text.__retarget_lock_init_recursive+0x0): multiple definition of `__retarget_lock_init_recursive'; ./firmware/libc.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_init_recursive+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/lib/thumb/v7+fp/softfp/libc.a(lib_a-lock.o): in function `__retarget_lock_close':
lock.c:(.text.__retarget_lock_close+0x0): multiple definition of `__retarget_lock_close'; ./firmware/libc.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_close+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/lib/thumb/v7+fp/softfp/libc.a(lib_a-lock.o): in function `__retarget_lock_close_recursive':
make: *** [common.mk:229: bin/cold.package.elf] Error 1
lock.c:(.text.__retarget_lock_close_recursive+0x0): multiple definition of `__retarget_lock_close_recursive'; ./firmware/libc.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_close_recursive+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/lib/thumb/v7+fp/softfp/libc.a(lib_a-lock.o): in function `__retarget_lock_acquire':
Error: Failed to build
lock.c:(.text.__retarget_lock_acquire+0x0): multiple definition of `__retarget_lock_acquire'; ./firmware/libc.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_acquire+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/lib/thumb/v7+fp/softfp/libc.a(lib_a-lock.o): in function `__retarget_lock_acquire_recursive':
lock.c:(.text.__retarget_lock_acquire_recursive+0x0): multiple definition of `__retarget_lock_acquire_recursive'; ./firmware/libc.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_acquire_recursive+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/lib/thumb/v7+fp/softfp/libc.a(lib_a-lock.o): in function `__retarget_lock_try_acquire':
lock.c:(.text.__retarget_lock_try_acquire+0x0): multiple definition of `__retarget_lock_try_acquire'; ./firmware/libc.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_try_acquire+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/lib/thumb/v7+fp/softfp/libc.a(lib_a-lock.o): in function `__retarget_lock_try_acquire_recursive':
lock.c:(.text.__retarget_lock_try_acquire_recursive+0x0): multiple definition of `__retarget_lock_try_acquire_recursive'; ./firmware/libc.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_try_acquire_recursive+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/lib/thumb/v7+fp/softfp/libc.a(lib_a-lock.o): in function `__retarget_lock_release':
lock.c:(.text.__retarget_lock_release+0x0): multiple definition of `__retarget_lock_release'; ./firmware/libc.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_release+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/lib/thumb/v7+fp/softfp/libc.a(lib_a-lock.o): in function `__retarget_lock_release_recursive':
lock.c:(.text.__retarget_lock_release_recursive+0x0): multiple definition of `__retarget_lock_release_recursive'; ./firmware/libc.a(lib_a-lock.o):lock.c:(.text.__retarget_lock_release_recursive+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/lib/thumb/v7+fp/softfp/libc.a(lib_a-reent.o): in function `cleanup_glue':
reent.c:(.text.cleanup_glue+0x0): multiple definition of `cleanup_glue'; ./firmware/libc.a(lib_a-reent.o):reent.c:(.text.cleanup_glue+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/lib/thumb/v7+fp/softfp/libc.a(lib_a-reent.o): in function `_reclaim_reent':
reent.c:(.text._reclaim_reent+0x0): multiple definition of `_reclaim_reent'; ./firmware/libc.a(lib_a-reent.o):reent.c:(.text._reclaim_reent+0x0): first defined here
collect2: error: ld returned 1 exit status

This is a thing with the very newest gcc. The fix went into the latest pros version, so you should get it if you update. If not, the specific fix is here: https://github.com/purduesigbots/pros/pull/233/files

8 Likes

Thanks, I had thought that I updated and I guess I didn’t and forgot.