Pgexodus handbuilding instructions
From NEOSYS Dev Wiki
Jump to navigationJump to search
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 *.c *.cpp -I`pg_config --includedir` -I`pg_config --includedir-server` g++ -shared -o pgexodus.so *.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.
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'
Also check the following
ldd -u pgexodus.so
Should give something like:
./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
Copy the library to the postgres library folder
sudo cp pgexodus.so `pg_config --pkglibdir`
and restart postgres if this isnt the first time you are installing pgexodus
sudo /etc/init.d/postgresql restart or sudo /etc/init.d/postgresql-8.3 restart