Library linking problem
Eric Norum
norume at aps.anl.gov
Tue Nov 23 22:44:38 UTC 2004
Etienne Fortin wrote:
> I made a library and am trying to link it with my RTEMS application.
> Strangely enough, GCC is not able to find the symbol he's looking for.
> Here's the process:
>
>
> Command line:
>
> m68k-rtems-gcc --pipe -B/usr/rtems/install/m68k-rtems/m5282lite/lib/
> -specs bsp_specs -qrt
> ems -g -Wall -O4 -fomit-frame-pointer -g -m5200 -Werror
> -L/usr/rtems/c3d-1.0
> /ulib/build/install/m68k/lib -o o-optimize/c3dproto.exe
> o-optimize/wrapup.o -lulib
> ../entry/o-optimize/*.o ../init/o-optimize/*.o
> ../menus/o-optimize/*.o ../peripherals/
> o-optimize/*.o
>
>
> Errors:
> ../entry/o-optimize/main.o: In function `main':
> ../entry/o-optimize/main.o(.text+0x10): undefined reference to
> `UcfgInitialize'
> ../peripherals/o-optimize/AD9888.o: In function
> `AD9888_InitializeTarget':
> ../peripherals/o-optimize/AD9888.o(.text+0x30): undefined reference to
> `UcfgAddTarget'
> ../peripherals/o-optimize/ICS1523.o: In function
> `ICS1523_InitializeTarget':
> ../peripherals/o-optimize/ICS1523.o(.text+0x30): undefined reference to
> `UcfgAddTarget'
> ../peripherals/o-optimize/ICS307.o: In function
> `ICS307_InitializeTarget':
> ../peripherals/o-optimize/ICS307.o(.text+0x4a): undefined reference to
> `UcfgAddTarget'
> ../peripherals/o-optimize/TFP410.o: In function
> `TFP410_InitializeTarget':
> ../peripherals/o-optimize/TFP410.o(.text+0x40): undefined reference to
> `UcfgAddTarget'
> ../peripherals/o-optimize/THS8200.o: In function
> `THS8200_InitializeTarget':
> ../peripherals/o-optimize/THS8200.o(.text+0x40): undefined reference to
> `UcfgAddTarget'
>
>
> Content of libulib.a in /usr/rtems/c3d-1.0/ulib/build/install/m68k/lib:
> ucfg.o: file format elf32-m68k
>
> SYMBOL TABLE:
> 00000000 l df *ABS* 00000000 ucfg.c
> 00000000 l d .text 00000000
> 00000000 l d .data 00000000
> 00000000 l d .bss 00000000
> 00000000 l d .debug_abbrev 00000000
> 00000000 l d .debug_info 00000000
> 00000000 l d .debug_line 00000000
> 00000000 l d .debug_frame 00000000
> 00000000 l d .debug_pubnames 0000000
> 00000000 l d .debug_aranges 00000000
> 00000000 l d .debug_str 00000000
> 00000000 l d .comment 00000000
> 00000000 g F .text 0000006e UcfgInitialize
> 00000000 *UND* 00000000 malloc
> 0000006e g F .text 000000da UcfgAddTarget
> 00000148 g F .text 0000005a UcfgCheckTarge
> 00000000 *UND* 00000000 strlen
> 00000000 *UND* 00000000 strcpy
> 00000000 *UND* 00000000 strcmp
> 000001a2 g F .text 00000054 UcfgConfigure
> 00000000 *UND* 00000000 ucfgin
> 00000000 *UND* 00000000 ucfgout
> 00000000 *UND* 00000000 ucfgparse
> 00000000 *UND* 00000000 free
> 000001f6 g F .text 0000004e UcfgDestroy
>
>
>
> Keep in mind that GCC doesn't complains that ulib doesn't exist. So, it
> DOES find it. So how comes it can't link with the UcfgAddTarget
> symbol???
>
>
> Etienne Fortin
> Sensio
>
>
>
>
Because libraries are searched exactly once at the point the appear on the
command line. You need to put your library *after* the object files which
need it.
--
Eric Norum norume at aps.anl.gov
Advanced Photon Source Phone: (630) 252-4793
Argonne National Laboratory
More information about the users
mailing list