Manual Building with g++: Difference between revisions

From NEOSYS Dev Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
To give some insight into the automatic procedure.
To give some insight into the automatic procedure.


First copy the headers to a standard include path
=== Building ===
 
get into the source code
 
cd ~/exodus/trunk/exodus/exodus/exodus
 
Copy the headers to a standard include path


  #include files
  #include files
Line 7: Line 13:
  sudo cp mv*.h /usr/include
  sudo cp mv*.h /usr/include


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


#get into the source code
cd ~/exodus/trunk/exodus/mv/src
#compile all cpp
  g++ -fPIC -c *.cpp
  g++ -fPIC -c *.cpp
#compile all c
  gcc -fPIC -c *.c
  gcc -fPIC -c *.c
#link and output the library file
 
Link and output the library file
 
  g++ -shared -o libexodus.so.1.0 *.o -lc -lpq -lboost_filesystem-gcc41-mt -lboost_regex-gcc41-mt\
  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
   -lboost_thread-gcc41-mt -Wl,-soname,libexodus.so.1


=== Installing libexodus ===
=== Installing ===


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


  #copy to a standard library folder
  #copy to a standard library folder
Line 30: Line 34:
  sudo ln -sf /usr/lib/libexodus.so.1 /usr/lib/libexodus.so
  sudo ln -sf /usr/lib/libexodus.so.1 /usr/lib/libexodus.so


=== Debugging ===
=== Checking the Build ===


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

Revision as of 09:20, 26 June 2009

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