User Tools

Site Tools


en:developer:compiling_greenstone
This version (2016/02/15 01:23) is a draft.
Approvals: 0/1

This is an old revision of the document!


Compiling Greenstone

<TABAREA tabs="Greenstone3,Greenstone2"> <TAB>

Unix

Ubuntu

Note: You need java from the sun website, not from the <tt>sun-java6-jdk</tt> package.

Download a jdk binary installer from the sun website to a location like <tt>~/jdk-6u5-linux-i586.bin</tt>. Then install java:

chmod +x ~/jdk-6u5-linux-i586.bin
cd /usr/local
sudo ~/jdk-6u5-linux-i586.bin
export JAVA_HOME=/usr/local/jdk1.6.0_05
export PATH=$JAVA_HOME/bin:$PATH

Install some required packages

sudo apt-get update
sudo apt-get install build-essential subversion ant autoconf
sudo apt-get upgrade

Checkout and install Greenstone3

svn co http://svn.greenstone.org/greenstone3/trunk greenstone3
cd greenstone3
ant
gedit build.properties
  (edit as needed, changing port number for tomcat, etc)
ant prepare install

</TAB> <TAB>

Unix

The "standard" commands of $ ./configure $ make $ make install should (hopefully) be all that is required.

If you get complaints about not finding gdbm, use the –with-gdbm=/full/path/to/your/gdbm/directory option to configure

You will probably need to use GNU make.

If you get an error about CPPFunction not declared in client.c, edit runtime-src/packages/yaz/yaz-2.1.4/client/client.c, and change

rl_attempted_completion_function = (CPPFunction*)readline_completer;

to

rl_attempted_completion_function = (rl_completion_func_t*)readline_completer;

The Greenstone Librarian Interface (GLI) code is written in Java, and compiling it requires a suitable version of the Java Software Development Kit (version 1.4.0 or newer). To compile this source code, run makegli.sh from the gsdl/gli directory.

A detailed walkthrough for installing from source on Linux is available here.

Ubuntu

You need to set JAVA_HOME to the actual root of the jdk, eg "/usr/lib/jvm/java-6-sun". JAVA_HOME cannot be left empty or be set to /usr.

Install some required packages

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential subversion gettext

Checkout and install Greenstone. Installing to /usr/local in this example.

cd /usr/local
svn co http://svn.greenstone.org/gsdl/trunk gsdl

cd gsdl
./configure
make
make install

Mac OS X

All compilation is currently done through a terminal.

Same basic instructions as for Unix. GDBM is not installed by default, so you will need to install it, then use the –with-gdbm=/full/path/to/your/gdbm/directory option to configure

Windows

We have tested compilation of Greenstone 2 with Visual C++ versions 6.0 and 7.0 (Visual Studio.NET 2003). Our distribution includes a cut-down port of the gdbm library for windows.

You can use either use the automated compile script to compile up Greenstone 2.81rc2 and subsequent releases, or compile manually.

Automated compiling

Automated compiling by using the makegs2.bat script is possible for Greenstone 2 versions after 2.81rc.

  • You will need to have downloaded winbin from Greenstone's repository.
  • Run the makegs2.bat file that's located in your Greenstone 2 installation folder:
makegs2.bat

And it should compile up Greenstone 2 for you.

Compiling manually (for versions 2.83 and after)

You will need Visual C++ of Visual Studio and, if compiling the Apache web server, Microsoft's SDK (in order to have access to windows.h).

  • Download winbin from Greenstone's repository
  • Compile Greenstone from the Windows command prompt. If you're going to compile the Apache web server included with Greenstone, you will first need to run the script "setenv.cmd" that sets the environment for Microsoft's SDK. (In our case, we found this in C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\SetEnv.Cmd.)
  • Regardless of whether the Apache web server is meant to be compiled up or not, the next step is to set up the VC++ environment. (For us, this requires running the vcvars32.bat script, found in the VC++ installation directory (for us this is in C:\Program Files\Microsoft Visual Studio\VC98\bin.)
  • Then run the following, one after the other:
* nmake /f win32.mak
  * nmake /f win32.mak LOCAL_LIBRARY=1

The above will compile up Greenstone followed by what's needed for the local library.

  • If compiling the Apache web server, you will next need to run:
nmake /f win32.mak APACHE_HTTPD=1

And finally, if at any stage you want to compile it with debugging turned on, run the compile command with the flag DEBUG=1.

Compiling manually (for versions 2.81rc and prior)

  • Download winbin from Greenstone's repository
  • Manually unzip the zip files that are located in the directories:
  * gsdl\common-src\packages\windows\crypt
  * gsdl\common-src\packages\windows\expat
  * gsdl\common-src\packages\windows\gdbm
  * gsdl\common-src\indexers\packages\windows\iconv
  • Unzip the tarred zip file (*.tar.gz) located in gsdl\common-src\packages\sqlite.

You can use the included gzip.exe and tar.exe in the gsdl\bin\windows folder to decompress and untar it. First run setup.bat from your Greenstone 2 installation folder:

> cd gsdl
> setup.bat

Now move into the gsdl\common-src\packages\sqlite and unzip the sqlite-amalgamation-3.5.9.tar.gz file, and then untar the resulting file:

> cd common-src\packages\sqlite
> gzip --decompress sqlite-amalgamation-3.5.9.tar.gz
> tar -xf sqlite-amalgamation-3.5.9.tar

And finally delete the intermediate tar file:

> del sqlite-amalgamation-3.5.9.tar
  • We compile Greenstone from the Windows command prompt. First, you must set up the VC++ environment. (For us, this requires running the vcvars32.bat script, found in the VC++ installation directory (for us this is in C:\Program Files\Microsoft Visual Studio\VC98\bin.)
  • Then run the following:
* nmake /f win32.mak
  * nmake /f win32.mak LOCAL_LIBRARY=1
  • For Greenstone 2 versions older than GS2.81-rc2, you will need to edit gsdl\setup.bat and replace the two instances of GSDLHOME with the path to the gsdl directory.

The Greenstone Librarian Interface (GLI) code is written in Java, and compiling it requires a suitable version of the Java Software Development Kit (version 1.4.0 or newer). To compile this source code, run makegli.bat from the gsdl\gli directory.

Advanced Compiling

This page contains detailed notes and platform specific instructions for compiling Greenstone. Simple compilation instructions may be found here.

Platforms

We have tested Greenstone on the following platforms:

  • GNU/Linux:
    • Debian 3.0 (potato) (i386), gcc 2.95.4
    • Debian sid/unstable (i386), gcc 3.2
    • Debian 2.2 (potato) (i386 and ppc rs/6000) (gsdl 2.38)
    • Red Hat 7.3 (i386), gcc 2.96
    • Slackware 8.0.0 (i386), gcc 2.95.3
    • Slackware 7.1.0 (i386) (gsdl 2.38)
  • Solaris 2.8 (sparc), gcc 2.95.2 and gmake.
  • Solaris 2.6 (sparc) using gcc and gmake. (gsdl 2.38)
  • FreeBSD 4.2 (i386) (gsdl 2.38)
  • Cygwin (minor fiddling needed)
  • Darwin / Mac OS X (G4/ppc7400)
  • Microsoft Visual C++ 4.2 and 6.0

If you would like to add other platforms to this list, or inform us of any portability changes required, send mail to the Greenstone mailing list.

Unix Compilation notes

(we include cygwin here). The "standard" commands of $ ./configure $ make all $ make install should (hopefully) be all that is required. Currently, Greenstone does not honour the `–prefix' flag, but the directories are self-contained, so should be able to be moved after installation.

You will probably need to use GNU make.

Version 2.38 of Greenstone compiles with gcc version 3.0 (as well as earlier versions of gcc). Earlier versions of Greenstone will require earlier versions of the compiler – we have successfully used versions egcs-2.91.66 and gcc-2.95.

The Greenstone Librarian Interface (GLI) code is written in Java, and compiling it requires a suitable version of the Java Software Development Kit (version 1.4.0 or newer). To compile this source code, run makegli.sh from the gsdl/gli directory.

:

Note! - version 2.41 of Greenstone (released in December 2003) requires slight modification to compile cleanly with gcc version 3.x. The "Isis" package in greenstone's "packages" directory requires 3 files to be changed. You can download the 3 files from: http://www.greenstone.org/tmp/isis-gdl-fixes.zip which contains:

isis-gdl/CRC32.cpp
isis-gdl/IsisTypes.h
isis-gdl/Master.cpp

:

If you copy these over the 3 files with the same name in gsdl/packages/isis-gdl then it should all compile ok with gcc 3.

The GDBM library and headers are needed - Linux distributions typically come with the library, but may or may not come standard with the header file. Darwin does not come with either. If it is not installed in /usr or /usr/local then you will have to specify where it is by using the configure flag –with-gdbm=/path/to/gdbm/dir. The GDBM library can be downloaded from ftp://ftp.gnu.org/pub/gnu/gdbm/gdbm-1.8.3.tar.gz or a closer mirror.

The following configure flags add extra functionality to Greenstone:

–enable-corba Creates a CORBA server as well as the .cgi server. This is currently still developmental, and compilation hasn't been tested on many platforms. A java CORBA client is available from our subversion repository - svn co http://svn.greenstone.org/other-projects/trunk/java-client –with-micodir Use an existing MICO compiler for the CORBA server instead of compiling our included version. –enable-z3950Enable rudimentary Z39.50 client support in the .cgi server.

Once you have the correct compiler, there's a step by step walkthrough on Source installation.

Platform-Specific Issues

Cygwin

Greenstone does not currently compile under cygwin "out-of-the-box". We had to manually edit some of the Makefiles. More specifically, the packages/mg subtree needed "-ansi" in the CFLAGS, while some parts of the src/mgpp subtree fails with "-ansi", as their version of the standard header files don't include any (eg) POSIX or XPG/OPEN functions that aren't ANSI if -ansi is supplied, even if flags like "_XOPEN_SOURCE" are defined.

Also some of the third-party packages required some manual attention.

Make sure you have the gdbm package installed.

Darwin/Mac OS X

All compilation is currently done through a terminal.

Note that the default filesystem is case-insensitive.

Mac OS X uses a compiler based on gcc version 3, so read the above section on Unix Compilation Notes for changes required to the source code for greenstone version 2.41.

darwin doesn't come with gdbm, so: # Download the gdbm source code from ftp.gnu.org into your home folder, as mentioned previously. # Unpack it using the command "tar -zxf gdbm-1.8.3.tar.gz" (without quotes) # If you used the older gdbm-1.8.0 (instead of 1.8.3), you will need to update some files that can't figure out what the system type is. Eg: "cp /usr/libexec/config.sub /usr/libexec/config.guess gdbm-1.8.3" # Make (and install) the library:

cd gdbm-1.8.3 &amp;&amp; make all install (When we did this, we did not have permission to install in a system directory)

If the "make install" command fails to install libgdbm into the default "/usr/local" folder due to permissions: # Remove the dynamic libraries, so that the Greenstone files are only linked using the "static" gdbm libraries using the following command (without the quotes):

"rm ~/gdbm-1.8.3/.libs/*.dylib" # when you configure Greenstone you should add –with-gdbm=/Users/<username>/gdbm-1.8.3(or wherever you installed it to) to the command. Note that this means that the compile option in the CD-ROM distribution Install script will fail, since it will only look in the default locations (/lib, /usr/lib/ and /usr/local/lib)

Also see the OSX Install Notes page.

Issues

  • Due to "upgrades" of the config.guess and config.sub files, version 2.37 of Greenstone might not recognise Mac OS X during the configure. You can either overwrite these files (as above) from /usr/libexec, or try to fake it by adding –host=powerpc-apple-machten (or similar) to the configure line. This has been resolved in gsdl-2.38.
  • If the make fails when compiling a file called "display.cpp", you need to work around a compiler bug. This only seems to occur when "-O2" is part of the compiler flags, so changing this to "-O1" or removing it from the flags will work. This seems to have been fixed with version 10.1 and later of the developer tools.
  • "There is a known bug in the version of gcc shipped with MacOS X 10.2." Version 2.38 of greenstone fails to build the pdftohtml converter, with the error message

FontFile.h:27: storage size of `_ZTI8FontFile' isn't known FontFile.h:46: storage size of `_ZTI13Type1FontFile' isn't known FontFile.h:67: storage size of `_ZTI14Type1CFontFile' isn't known FontFile.h:144: storage size of `_ZTI16TrueTypeFontFile' isn't known

The work-around is to remove all lines with "#pragma" from the source-code of the pdftohtml package. See the bug report on pdftohtml's site. This will be fixed in Greenstone version 2.39 and later.

GNU/Linux

As mentioned above, version 2.38 of Greenstone compiles with gcc3. If you are using an earlier version of Greenstone, you will need to make sure you are using an older version of gcc, and not gcc2.96 or gcc3. Red Hat >= 7.0 comes with the newer versions of gcc by default.

You will need the gdbm.h header file. If you don't already have it, it is in the libgdbmg1-dev (debian) or gdbm-devel-1.8.0 (rpm) package.

We have had a couple of reports from SuSE users that one of our third-party packages (wget) fails to configure as it uses GNU msgfmt for translation catalogues - this is resolved by installing the gettext package. This seems to be already installed on other distributions.

Alpha architectures: Well, the good news is that it compiles OK (for versions of gsdl >= 2.37 - earlier versions need updated config.sub files), the bad news is that it fails to build collections. One possibility is that mg (the backend code) doesn't like the 64-bit ints.

FreeBSD

Everything should go smoothly… you might need to install lib gdbm if it is not already installed.

Solaris

We no longer have solaris machines running in our department. However, Greenstone built and ran the last time I could log on (about version 2.33?), and we have reports of people getting current versions working, with minor changes.

Greenstone includes a perl module from CPAN, XML::Parser (+Expat), which has caused problems on some machines during the make. This is because perl uses it's own config file to get compiler settings, etc. We think we have worked around this. If you get compilation problems, you can do one of the following: #After doing the toplevel ./configure, edit gsdl/packages/cpan/XML-Parser-2.27/Makefile and XML-Parser-2.27/Expat and change CC = cc to CC = gcc. (Assuming you are using gcc). Or: #You could install the perl XML::Parser module manually, and comment out or remove any mention of the cpan/XML-Parser-2.27 directory from gsdl/packages/Makefile(.in).

You might need to manually install the gdbm library. In which case, add the –with-gdbm=&amp;lt;gdbm-dir&amp;gt; option to the configure command.

You probably need to use gcc:

  $ setenv CC gcc
  $ setenv LD gcc

You probably need to use GNU's make. Try setting the MAKE variable when you run the configure script, such as:

 $ MAKE=gmake ./configure [options]
 or
 $ ./configure [options]
 ...
 $ gmake all

Windows (Visual C++)

The third-party packages (pdftohtml, wvWare, rtftohtml, xlhtml, etc) were compiled using cygwin.</TAB></TABAREA>

en/developer/compiling_greenstone.1455499401.txt.gz · Last modified: 2016/02/15 01:23 by kjdon