Building on Windows - Old Version

From NEOSYS Dev Wiki

1 Software to install

Boost library binaries installer can be obtained from http://code.google.com/p/exodusdb/downloads or boost.org.

  1. PostgresSQL 8.3
  2. TortoiseSVN 1.6.10 (but any version should do)
  3. Boost C++ libraries 1.38.0
  4. MSVC2005 or MSVS C++ Express Edition 2005 or 2008
  5. Windows Platform SDK (only if using Express 2005).

or

  1. PostgresSQL 9.0
  2. TortoiseSVN 1.6
  3. Boost C++ libraries 1.43.0
  4. MSVC 2010 Express

2 Installation Locations

If not installing on C: drive, keep everything on the same drive (and with the exception of the exodus source/build folder) in the standard directory tree otherwise you will have to modify the project settings to point to the right include and lib folders.

D:\Program Files\boost\boost_1_38_0
D:\Program Files\PostgreSQL\8.3
D:\exodusdb

D:\exodusdb could be in your desktop (D:\Documents and settings\steve\Desktop\exodusdb) but harder to operate some console command building commands if put there

Installing Postgres

Installing Tortoise Subversion

Installing Boost

Installing Visual Studio Express C++

3 Getting Project Exodus onto your Computer:

Using the command console

  1. Get a command console
  2. c:
  3. cd \
  4. EITHER: FOR COMMITTER: "svn checkout https://exodusdb.googlecode.com/svn/trunk/ exodusdb"
  5. OR: FOR NONE-COMITTER: "svn checkout https://exodusdb.googlecode.com/svn/trunk/ exodusdb --username YOURCOMMITTERACCOUNT@gmail.com"

Using Windows

Use https and you will be asked for your google account only if and when you commit anything.

  1. Go to your C: (or other drive) root folder desktop, and create a new folder.
  2. Right click on the folder, and click TortoiseSVN, checkout.
  3. In the URL field put https://exodusdb.googlecode.com/svn/trunk and click Ok.
  4. Another window will pop up, and start listing the files you are importing onto your pc.
  5. Click Ok, once loading is finished.

For help on how to use: http://devwiki.neosys.com/index.php/Installing_and_Using_Tortoise_Subversion

4 Building Exodus - All

  1. Open the exodus_all.sln file in the new folder that you created.
  2. In the solution view, right click "Solution exodus_all" and select "Build"

5 Possible Problems During Building

5.1 error: postgres.h not found

Your include folders are not pointing to the postgresql include folder.

5.2 error: "errcode redefinition ... " in elog.h

Error	1	error C2365: 'errcode' : redefinition; previous definition was 'typedef'	d:\program files\postgresql\8.3\include\server\utils\elog.h	105

then double click the error to open the offending file and comment out the offending line as follows:

//extern int	errcode(int sqlerrcode);

5.3 error: Cannot open include file: 'libintl.h'

Compiling...
pgexodus.c
c:\program files\postgresql\8.3\include\server\c.h(96) : fatal error C1083: Cannot open include file: 'libintl.h': No such file or directory

just make an empty file called libintl.h as follows: (substitute the postgres version that you are using (see postgres.vsprops)

\Program Files\PostgreSQL\8.3\include\server\port\win32\libintl.h

5.4 cannot open file libboost...

LINK : fatal error LNK1104: cannot open file 'libboost_date_time-vc90-mt-gd-1_38.lib'
LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_38.lib'
LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc90-mt-gd-1_38.lib'
LINK : fatal error LNK1104: cannot open file 'libboost_filesystem-vc90-mt-gd-1_38.lib'
LINK : fatal error LNK1104: cannot open file 'libboost_system-vc90-mt-gd-1_38.lib'

Make sure that you have installed the right boost libraries for your version of Visual Studio.

1.43 works with all VS versions

up to 1.42 only works with up to VS2008

  • Compiler: Visual C++ 9.0 (Visual Studio 2008) or
  • Variants: Multithread and Multithread Debug
  • Components: (1)Date and Time (2)Filesystem (3)Regex (4)System (5)Thread

5.5 Declaring the dll in Postgres

After copying the pgexodus.dll to the postgres library folder you can run configexodus to configure postgres automatically, or perform the following procedure.

You must login as a postgres superuser to do the following since the C language is not trusted.

In pgadmin or some other tool, select the "POSTGRES" database

Run the following as an sql command to create the necessary special functions that exodus requires to perform dictionary extractions for sort/select etc.

For more info, see Dynamic loading at http://www.postgresql.org/docs/current/static/xfunc-c.html


-- 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;

6 Granting Exodus access to Postgres

Use pgadmin to create a user role with whichever role privileges you wish and a database.

Any roles that you do not grant exodus will have to be performed using pgadmin or other postgres management tools.

CREATE ROLE exodus LOGIN
 PASSWORD 'somesillysecret'
 CREATEDB CREATEROLE;
CREATE DATABASE exodus
 WITH ENCODING='UTF8'
      OWNER=exodus;

7 Running Exodus

  1. In the solution explorer view, right click "exodus_cli"
  2. Set as startup project.
  3. Run Exodus CLI from the menu ... Debug, Start Debugging.

8 Possible Problems During Execution

8.1 libpq.dll

Errormessage.JPG

  1. Check whether libpq.dll is in C:\Program Files\PostgreSQL\8.3\lib\????, if not there then change project properties to reflect version on location in where you installed postgreSQL.
  2. Right click on My computer, properties, advanced, environment variables, system variables, scroll down and find Path, double click it. variable value, go to the end of the path and type a semi-colon, then copy and paste the following path after the semi-colon:
    C:\Program Files\PostgreSQL\8.3\lib\ms and close Visual Studio C++ Express Edition, and then open again.

PCconfig.JPG

8.2 ssleay32.dll

There are dozens of versions of this open source secure sockets library which are widely used by many vendors some of whom very wrongly install them in the windows\system32 folder which has precedence after the local folder but before the path is searched. postgres requires them and will use the wrong version.

The simplest solution is often to delete them.

del c:\Windows\system32\ssleay32.dll del c:\Windows\system32\libeay32.dll

If you cannot delete them then try rebooting. If that doesnt work then find out which program has them open using some dll search facility like sysinternals procexplorer.

Another solution is simply to upgrade them to the latest version of the files that you can find on your computer or on the web or from the postgres bin folder. See properties not the file date.

INITIAL VERSION BY GREG BUSH 19/10/2007

9 Helpful Websites

  1. For help on Microsoft Visual Studio C++ Express Edition go to http://msdn2.microsoft.com/en-gb/express/aa700755.aspx
  2. For help on Boost go to http://www.boost.org
  3. For help on PostgeSQL go to http://www.postgresql.org/
  4. For help on WinRAR go to http://www.win-rar.com/winrarsupport.html
  5. For help on TortoiseSVN go to http://tortoisesvn.tigris.org/
  6. For how to use tortoiseSVN go to Installing_and_Using_Tortoise_Subversion