Berkeley DB: Building Shared Libraries for the GNU GCC compiler
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btr ee,hash,hashing,transaction,transactions,locking,logging,access method,access me thods,java,C,C++

# Building Shared Libraries for the GNU GCC compiler

If you're using gcc and there's no better shared library example for your architecture, the following shared library build procedure will probably work.

1. Add the -fpic option to the CFLAGS value in the Makefile.

2. Rebuild all of your .o files. This will create a Berkeley DB library that contains .o files with PIC code. To build the shared library, then take the following steps in the library build directory:

       % mkdir tmp
       % cd tmp
       % ar xv ../libdb.a
       % gcc -shared -o libdb.so *.o
       % mv libdb.so ..
       % cd ..
       % rm -rf tmp

Note, you may have to change the gcc line depending on the requirements of your system.

The file libdb.so is your shared library.