http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46104
Summary: Linker error "cannot find -liberty"
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: c
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Host: Ubuntu 10.04 LT
Target: ARM LPC32xx
This error was received trying to compile sourced for the ARM EABI firmware
from Embedded Artists using the gnu toolchain of CodeSourcery G++ Lite for ARM
EABI.
The toolchain compile correctly the sources, generate libraries and create
object files, but at link time linker reports the following error:
/home/tech/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/bin/ld:
cannot find -liberty
The specific linker command from the toolchain commands sequence is the
following:
arm-none-eabi-gcc timer_example.o ../common/crt0_gnu.o -static
-Wl,--start-group
/home/tech/CodeSourcery/software/csps/lpc32xx/lib/liblpc32xxgnu.a
/home/tech/CodeSourcery/software/csps/lpc32xx/bsps/ea3250/lib/libea3250gnu.a
/home/tech/CodeSourcery/software/lpc/lib/liblpcarm926ej-sgnu.a -lgcc -lc -lg
-lm -liberty -lstdc++ -lsupc++ -Wl,--end-group -Xlinker -Map -Xlinker \
timer.map -Xlinker -T ../linker/ldscript_ram_gnu.ld \
-o timer.elf
After investigations and tests, the problem concerns libiberty library, that is
installed in the toolchain of CodeSourcery only as static library and not
shared.
Trying to find the library in the host, the result is the following:
$ find / -name *libiberty* -print
/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/arm-none-linux-gnueabi/sysroot/lib/libiberty.a
/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/arm-none-linux-gnueabi/sysroot/vfp/lib/libiberty.a
/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/arm-none-linux-gnueabi/lib/libiberty.a
/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/arm-none-linux-gnueabi/lib/vfp/libiberty.a
/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/libiberty.a