[ale] perl 5.003 and gdbm

Steven A. DuChene sduchene at mindspring.com
Sat Aug 3 22:36:34 EDT 1996

Philip wrote:
> 	I just tried to run perl 5.003 and got an error message 
> indicating that it couldn't find libgdbm.so.1.  So, I got the gdbm 
> package (gdbm-1.7.3.tar.gz) from prep.ai.mit.edu and installed it.  
> However, it only created libgdbm.a.  Does anyone know what I did wrong or 
> how I get libgdbm.so.1 generated?

Eric replied:
> Hmm.  I have the same distribution and there is no target to compile a
> shared library.

> If you are using ELF libraries, then  you can make a shared library
> pretty easily.  Add this target after libgdbm.a in the Makefile in that
> directory (I had to do a make clean first)

> libgdbm.so: $(OBJS) gdbm.h
>         rm -f libgdbm.so
>         gcc -shared -o libgdbm.so $(OBJS)

Hmm...not sure the above will work since the $(OBJ) files will not have
been compiled with a "-fPIC" flag where PIC stands for Position Independent
Code. The gdbm package I have has a make file while creates a "shared"
directory which it stores the PIC object files into and keeps the regular
object files for the archive library in the top level source directory.

To quote from the Linux ELF HOWTO:

> 3.2 Building libraries

> To build libfoo.so as a shared library, the basic steps look like this:

>           $ gcc -fPIC -c *.c
>           $ gcc -shared -Wl,-soname,libfoo.so.1 -o libfoo.so.1.0 *.o
>           $ ln -s libfoo.so.1.0 libfoo.so.1
>           $ ln -s libfoo.so.1 libfoo.so
>           $ export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH

If you like I could send out the Linux version of the Makefile.in (used
by GNU configure to create the actual Makefile for your system) I have for
libgdbm since I don't remember if I modified it to create the ELF shared
version or if I got it that way.
Steven A. DuChene   Linux Weenie!  http://www.mindspring.com/~sduchene

The church is near but the road is icy; the bar is far away but I will
walk carefully.
                -- Russian Proverb

More information about the Ale mailing list