Linux
Installing dependencies
Tested on Centos 5.2/Boost 1.38/Postgres 8.3/Gnu Compiler 4.1.2
It might work with versions as far back as Boost 1.35 and Postgres 8.1 perhaps with minor tweaks.
Installing Boost
Required for complete build of Boost - but those bits of Boost may not actually be required by Exodus.
yum install python-devel yum install bzip2-devel
Download it
wget http://downloads.sourceforge.net/boost/boost_1_38_0.tar.bz2?use_mirror=garr
Unpack it
tar xvf boost_1_38_0.tar.bz2 cd boost_1_38_0
Actually only the following parts are required but how to a partial build is unknown at the moment.
- Boost DateTime
- Boost FileSystem
- Boost IOstream
- Boost Interprocess
- Boost ProgramOptions
- Boost Regex
- Boost System
- Boost Thread
Become superuser to build and install it.
su
./configure make make install
Quit superuser
exit
Installing Postgres
Version 8.3
yum install postgresql
Setting up Postgres for Exodus
become user postgres and get into postgres command prompt
sudo su - postgres psql
create a user and database for exodus
CREATE ROLE exodus LOGIN PASSWORD 'somesillysecret' CREATEDB CREATEROLE;
CREATE DATABASE exodus WITH ENCODING='UTF8' OWNER=exodus;
#quit postgres command prompt and quite postgres user
\q exit
Allow login from 127.0.0.1 using username/unencrypted password (instead of only logged-in username without password) http://developer.postgresql.org/pgdocs/postgres/auth-pg-hba-conf.html
nano /var/lib/pgsql/data/pg_hba.conf
#host all all 127.0.0.1/32 ident sameuser host all all 127.0.0.1/32 password hostssl all all 0.0.0.0/0 password
service postgresql reload
Installing g++ compiler
yum list|grep gcc
yum install gcc-c++.i386
Installing Postgres development libraries
Look for all available postgres packages and if they are installed
yum list|grep postgres yum install postgresql-devel
Locate postgres.h for interest
updatedb locate postgres.h
Downloading and Building Exodus
Downloading Exodus
Make a folder for exodus
cd ~ mkdir exodus cd exodus
Download the main trunk of Exodus
svn checkout http://svn.neosys.com/svn/trunk
Building pgexodus
pgexodus.so is a shared library addin c function for postgres to perform sort/select/index functions otherwise it is not required.
Currently hand built without even a make file. standard configure/make using autoconf/automake will be available soon http://www.lrde.epita.fr/~adl/dl/autotools.pdf
cd ~/exodus/trunk/exodus/pgexodus/src
g++ -fpic -c pgexodus.c extract.c callexodus.cpp -I `pg_config --includedir-server` -I /usr/local/include/boost-1_38 g++ -shared -o pgexodus.so pgexodus.o extract.o callexodus.o -lrt -lpq
Installing pgexodus
Copy the library to the postgres library folder
sudo cp pgexodus.so `pg_config --libdir`
Register the c functions in postgres
sudo su - postgres psql
-- cut and paste the following SQL to register the functions into postgres --
CREATE OR REPLACE FUNCTION exodus_call(bytea, bytea, bytea, bytea, bytea, int4, int4) RETURNS bytea AS 'pgexodus', 'exodus_call' LANGUAGE C IMMUTABLE;
CREATE OR REPLACE FUNCTION exodus_extract_bytea(bytea, int4, int4, int4) RETURNS bytea AS 'pgexodus', 'exodus_extract_bytea' LANGUAGE C IMMUTABLE;
CREATE OR REPLACE FUNCTION exodus_extract_text(bytea, int4, int4, int4) RETURNS text AS 'pgexodus', 'exodus_extract_text' LANGUAGE C IMMUTABLE;
CREATE OR REPLACE FUNCTION exodus_extract_sort(bytea, int4, int4, int4) RETURNS text AS 'pgexodus', 'exodus_extract_sort' LANGUAGE C IMMUTABLE;
-- Remaining functions are STRICT therefore never get called with NULLS -- also return NULL if passed zero length strings
CREATE OR REPLACE FUNCTION exodus_extract_text2(bytea, int4, int4, int4) RETURNS text AS 'pgexodus', 'exodus_extract_text2' LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION exodus_extract_date(bytea, int4, int4, int4) RETURNS date AS 'pgexodus', 'exodus_extract_date' LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION exodus_extract_time(bytea, int4, int4, int4) RETURNS time AS 'pgexodus', 'exodus_extract_time' LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION exodus_extract_datetime(bytea, int4, int4, int4) RETURNS timestamp AS 'pgexodus', 'exodus_extract_datetime' LANGUAGE C IMMUTABLE STRICT;
Quit postgres command prompt and quite postgres user
\q exit
Building libexodus
libexodus.so is a shared library that allows you to write c++ programs with the style and semantics of pick basic.
Currently hand built without even a make file. standard configure/make using autoconf/automake will be available soon http://www.lrde.epita.fr/~adl/dl/autotools.pdf
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 -I /usr/local/include/boost-1_38 #compile all c gcc -fPIC -c *.c -I../../../boost_1_38_0 #link and output the library file g++ -shared -o libexodus.so.1.0 -lc *.o -Wl,-soname,libexodus.so.1 #register the library file with the linux library cache ldconfig -v -n . #create the pointer to version 1 ln -sf libexodus.so.1 libexodus.so
Debugging
http://www.ibm.com/developerworks/library/l-shobj/
ldd libexodus.so|grep "not found" ldd -u libexodus.so
Testing libexodus
Compile and link the test program that merely connects to the database and stops.
g++ -o test test.cpp -I/usr/local/include/boost-1_38 -L. -L/usr/local/lib -lexodus -lpq -lboost_filesystem-gcc41-mt -lboost_regex-gcc41-mt -lboost_thread-gcc41-mt
Once per session before running libexodus
export LD_LIBRARY_PATH=.:/usr/local/lib:$LD_LIBRARY_PATH
Execute
./test
ldd -u test
Building service
service is an incomplete multithreaded framework to support dynamic loading of library routines and serving a request/response queue.
www provides an optional web interface to the request/response queue. Windows only at the moment due to a single asp files but could be ported to php.
Building service
cd ~/exodus/trunk/service/service
g++ -fPIC -c *.cpp -I/usr/local/include/boost-1_38 -I../../exodus/mv/src g++ -shared -o libservice.so -lc *.o g++ -o service main.cpp -I/usr/local/include/boost-1_38 -L. -L/usr/local/lib -lexodus -lpq -lboost_filesystem-gcc41-mt\ -lboost_regex-gcc41-mt -lboost_thread-gcc41-mt -L../../exodus/mv/src -I../../exodus/mv/src -L./ -lservice
Running service
export LD_LIBRARY_PATH=../../exodus/mv/src:.:/usr/local/lib:$LD_LIBRARY_PATH
./service
Developing libexodus/service
Committing your developments
First get a username and password by running the following unix command and send the output to an exodus subversion administrator eg steve.bush@neosys.com
htpasswd -nm YOURDESIREDUSERNAME
The administrator needs to run the following command as root and enter the encrypted pass (the bit AFTER the :) ignoring the warning about plain text password because it is already encrypted.
htpasswd -p /etc/apache2/dav_svn.passwd YOURDESIREDUSERNAME