[Prev][Next][Index]

Re: BUILDING A SHARED LIBRARY



Hi,

Meir wrote:
 
> I'm trying to create a shared library on a regular Linux system (1.2.3)
> and when I type this:  
> 
> gcc -shared -o libstam.so libstam.o
> 
> I get this:
> 
> 
> /usr/lib/crt0.o(.text+0x1): undefined reference to
> `__load_shared_libraries'
> /usr/lib/crt0.o(.text+0x12): undefined reference to `___brk_addr'
> /usr/lib/crt0.o(.text+0x1b): undefined reference to `__environ'
> /usr/lib/crt0.o(.text+0x22): undefined reference to `__fpu_control'
> /usr/lib/crt0.o(.text+0x28): undefined reference to `__setfpucw'
> /usr/lib/crt0.o(.text+0x30): undefined reference to `__libc_init'
> /usr/lib/crt0.o(.text+0x35): undefined reference to `main'
> /usr/lib/crt0.o(.text+0x3b): undefined reference to `exit'
> libstam.o(.text+0x2a): undefined reference to `getpid'
> libstam.o(.text+0x35): undefined reference to `printf'
> libstam.o(.text+0x74): undefined reference to `fork'
> libstam.o(.text+0x8b): undefined reference to `execl'
> libstam.o(.text+0x90): undefined reference to `getpid'
> libstam.o(.text+0x96): undefined reference to `getppid'
> libstam.o(.text+0xa1): undefined reference to `printf'
> 
> 
> What's wrong ?
> 

What installation do you have? If it's not ELF, then the chances of success in producing shared libraries are rather slim - it's a long process described in one of the HOWTO's.

If you do have ELF, then it should be quite simple. Read the ELF-HOWTO to get the exact instructions about producing shared libraries.

Gilad