Manual Building with g++

From NEOSYS Dev Wiki
Jump to navigationJump to search

To give some insight into the automatic procedure.

Building

get into the source code

cd ~/exodus/trunk/exodus/exodus/exodus

Copy the headers to a standard include path

#include files
sudo cp exo*.h /usr/include
sudo cp mv*.h /usr/include

Compile (Ignore three warnings in /boost/thread/tss.hpp included from mvdbpostgres.cpp)

g++ -fPIC -c *.cpp
gcc -fPIC -c *.c

Link and output the library file

g++ -shared -o libexodus.so.1.0 *.o -lc -lpq -lboost_filesystem-gcc41-mt -lboost_regex-gcc41-mt\
 -lboost_thread-gcc41-mt -Wl,-soname,libexodus.so.1

Installing

This will place the libraries so that you can compile from anywhere on the system

#copy to a standard library folder
sudo cp libexodus.so.1.0 /usr/lib
#register the library file with the linux library cache
sudo ldconfig -v
#create the pointer to version 1
sudo ln -sf /usr/lib/libexodus.so.1 /usr/lib/libexodus.so

Checking the Build

http://www.ibm.com/developerworks/library/l-shobj/

ldd libexodus.so.1.0|grep "not found"
ldd -u libexodus.so.1.0

Testing libexodus

g++ test.cpp -lexodus
./a.out
ldd -u a.out