|
|
(110 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| == Installing dependencies == | | ==== [[Install/Test/Uninstall - Redhat5/Centos5/Fedora15|Redhat/Fedora/Centos]] ==== |
|
| |
|
| Tested on Centos 5.2/Boost 1.38/Postgres 8.3/Gnu Compiler 4.1.2
| | ==== [[Install/Test/Uninstall - Ubuntu 10.04 LTS|Ubuntu/Debian]] ==== |
|
| |
|
| It might work with versions as far back as Boost 1.35 and Postgres 8.1 perhaps with minor tweaks.
| | ==== [[Install/Test/Uninstall - Suse 11.4|Suse]] ==== |
| | |
| === 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
| |
| | |
| Required for unicode support in regex
| |
| | |
| yum install libicu-devel
| |
| | |
| or on Ubuntu
| |
| | |
| apt-get install libicu-dev
| |
| | |
| 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
| |
| | |
| Become superuser to build and install it.
| |
| | |
| su
| |
| | |
| ./configure --help
| |
| ./configure --with-libraries=date_time,filesystem,iostreams,program_options,regex,system,thread
| |
| | |
| Optionally to speed the build of only the library versions required, add additional config to the BJAM_CONFIG line as follows:
| |
| | |
| nano Makefile
| |
| | |
| BJAM_CONFIG= -j4 variant=release link=shared
| |
| | |
| Then build
| |
| | |
| make
| |
| | |
| Then optionally check (warning takes a LONG time)
| |
| | |
| make check
| |
| | |
| Then install
| |
| | |
| make install
| |
| | |
| Skip to the next section if on Ubuntu, this part is unnecessary.
| |
| | |
| Add "/usr/local/lib" to the list of lib directories to ensure that the boost libs can be found.
| |
| | |
| nano /etc/ld.so.conf
| |
| | |
| Ensure the new config is operational.
| |
| | |
| ldconfig
| |
| | |
| Ensure boost includes can be found
| |
| | |
| ln -s /usr/local/include/boost-1_38/boost /usr/local/include/boost
| |
| | |
| Quit superuser
| |
| | |
| exit
| |
| | |
| === Building your own Boost libraries from source ===
| |
| | |
| http://shoddykid.blogspot.com/2008/07/getting-started-with-boost.html
| |
| | |
| === Installing Postgres ===
| |
| | |
| Version 8.3
| |
| | |
| yum install postgresql
| |
| | |
| or
| |
| sudo aptitude install postgresql-8.3
| |
| | |
| === 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
| |
| or for Ubuntu
| |
| nano /etc/postgresql/8.3/main/pg_hba.conf
| |
| and add/edit these lines
| |
| #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
| |
| or for Ubuntu
| |
| sudo /etc/init.d/postgresql restart
| |
| | |
| === Installing g++ compiler ===
| |
| | |
| yum list|grep gcc
| |
| | |
| yum install gcc-c++.i386
| |
| | |
| or for Ubuntu
| |
| sudo aptitude install build-essential
| |
| | |
| === Installing Postgres development libraries ===
| |
| | |
| Look for all available postgres packages and if they are installed
| |
| | |
| yum list|grep postgres
| |
|
| |
| yum install postgresql-devel
| |
| | |
| or for Ubuntu
| |
| sudo install postgresql-dev
| |
| | |
| Locate postgres.h for interest
| |
| | |
| updatedb
| |
| locate postgres.h
| |
| (should be in /usr/include/postgresql/ or /usr/include/postgresql/8.3/server/ on Ubuntu)
| |
| | |
| == 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
| |
| | |
| Note that all routines are marked for "C linkage" in order to work with the postgres library "pq". For convenience they are all compiled under C++ since callexodus requires boost which is c++. The .c routines could equally well be compiled with the plain c compiler. The link stage must be done in c++ style in order to link to the c++ runtime library "rt".
| |
| | |
| cd ~/exodus/trunk/exodus/pgexodus/src
| |
| | |
| g++ -fpic -c pgexodus.c extract.c callexodus.cpp naturalorder.cpp pgnaturalorder.cpp -I `pg_config --includedir-server` -I /usr/local/include/boost-1_38
| |
| g++ -shared -o pgexodus.so pgexodus.o extract.o callexodus.o naturalorder.o pgnaturalorder.o -lrt -lpq
| |
| | |
| Check the build as follows:
| |
| | |
| ld pgexodus.so
| |
| | |
| Should give something like the following. These 8 references to the postgres library all seem to be resolved at runtime.
| |
| | |
| <pre>
| |
| pgexodus.so: undefined reference to `Float8GetDatum'
| |
| pgexodus.so: undefined reference to `pg_atoi'
| |
| pgexodus.so: undefined reference to `CurrentMemoryContext'
| |
| pgexodus.so: undefined reference to `pg_detoast_datum'
| |
| pgexodus.so: undefined reference to `pfree'
| |
| pgexodus.so: undefined reference to `elog_start'
| |
| pgexodus.so: undefined reference to `MemoryContextAlloc'
| |
| pgexodus.so: undefined reference to `elog_finish'
| |
| </pre>
| |
| | |
| Also check the following
| |
| | |
| ldd -u pgexodus.so
| |
| | |
| Should give something like:
| |
| | |
| <pre>
| |
| ./pgexodus.so: error: symbol lookup error: undefined symbol: CurrentMemoryContext (continued)
| |
| undefined symbol: CurrentMemoryContext (./pgexodus.so)
| |
| Unused direct dependencies:
| |
| | |
| /lib/librt.so.1
| |
| /usr/lib/libpq.so.5
| |
| /lib/libm.so.6
| |
| /lib/libgcc_s.so.1
| |
| </pre>
| |
| | |
| === Installing pgexodus ===
| |
| | |
| Copy the library to the postgres library folder
| |
| | |
| sudo cp pgexodus.so `pg_config --pkglibdir`
| |
| | |
| Register the c functions in postgres
| |
| | |
| sudo su - postgres
| |
| psql
| |
| \connect exodus
| |
| | |
| {{postgres function installation}}
| |
| | |
| Check the functions loaded properly
| |
| | |
| \df exodus*
| |
| | |
| Quit postgres command prompt and quite postgres user
| |
| | |
| \q
| |
| exit
| |
| | |
| For more information see http://www.postgresql.org/docs/8.1/static/app-psql.html
| |
| | |
| === 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
| |
| | |
| First copy the headers to a standard include path
| |
| | |
| #include files
| |
| sudo cp exo*.h /usr/include
| |
| sudo cp mv*.h /usr/include
| |
| | |
| 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
| |
| #compile all c
| |
| 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 libexodus ===
| |
| | |
| This will place the libraries and include files 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
| |
| | |
| === Debugging ===
| |
| | |
| 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
| |
| | |
| == 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
| |