User Tools

Site Tools


en:developer:windows_source_install
This version is outdated by a newer approved version.DiffThis version (2021/09/30 04:04) is a draft.
Approvals: 0/1

This is an old revision of the document!


Source Installation on Windows

Current instructions

<TABAREA tabs="Greenstone3,Greenstone2"> <TAB> Tested on Windows (Vista) 64 bit.

You need:

  • An SVN client installed, which can be downloaded from http://subversion.apache.org/packages.html. The instructions below assume a command-line SVN client.
  • Java JDK 6.x or later. For compiling on Windows 64 bit, need the 64 bit version of JDK. For compiling Greenstone 3.06 and onwards, need JDK 7.x or later.
  • PERL: we used to use ActivePerl for Windows. Now we provide our own modified version of Strawberry Perl that has everything we need so far.
  • Visual Studio 8 or later for compiling C++ code. (We haven't tried it with Microsoft's free Visual Studio Express yet.) For 64-bit Windows, we found that Visual Studio versions 9 and 12 worked to compile GS3 from SVN.
  • If you want to compile GS2 or GS3 with debugging on, you will also need Microsoft SDK

Apache Ant is included in the following instructions, since it too is needed.

The process is to checkout greenstone3 from SVN, then checkout the appropriate subfolder for your OS and bit architecture from http://svn.greenstone.org/local/greenstone3/ into your greenstone3, and name that subfolder local. The local subfolder will also provide you with ant. Then edit the gs3-setup and gs3-devel scripts in local to point to wherever you have JAVA, PERL, (ANT) installed (and, on Windows, the location of your Visual Studio's VC directory). Then run the gs3-devel.bat in your toplevel GS3 folder before trying to run any of the ant compilation commands:

svn co https://svn.greenstone.org/main/trunk/greenstone3 gs3-svn
cd gs3-svn
svn co https://svn.greenstone.org/local/greenstone3/<OS-bitness folder*> local

For the OS-bitness folder, you can at present choose from "darwin-64bit", "linux-32bit", "linux-64bit", "windows-64bit".

Use a text editor to edit local/gs3-setup.bat and local/gs3-devel.bat to contain the paths to Java, Perl, Ant, Visual Studio's VC folder on your system. We found that 32 bit MS VS 9.0 and 12.0 works in our case, if we set gs3-devel.bat to point to C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC so that the script can then issue call vsvarsall.bat amd64 to get it working for 64 bit machines.

Then you're ready to proceed by running the toplevel gs3-devel.bat:

gs3-devel.bat
ant
ant prepare

(The gs3-devel.bat will print a file not found error on Windows, since gs3-devel.bat runs gs3-setup.bat which refers to some files that the ant prepare step has yet to checkout.)

Once the ant prepare step has finished:

[ If you're using Visual Studio 14 (a.k.a. Visual Studio 2015; seems to also work with VS15/VS2017), then before proceeding, backup your windows iconv.zip and rename iconv-winVS14-VS2015-plus.zip as the new iconv.zip, as below. (For details on which libiconv this uses and how it was modified to get it to work with VS14, refer to this.)

pushd gs2build\common-src\indexers\packages\windows\iconv
move iconv.zip iconv_preVS14.zip
move iconv-winVS14-VS2015-plus.zip iconv.zip
rmdir /s /q iconv
popd

]

Open a new terminal, go back to into the SVN Greenstone 3 checkout directory and run the devel script again before running the actual compile command:

gs3-devel.bat
ant install

Note: after compiling with the above steps, your terminal would be left in a state where running GLI would not be able to locate the Greenstone building scripts like import.pl. Therefore, when compilation is finished, open a fresh DOS prompt to run GLI from.

</TAB> <TAB> On 64 bit windows, earlier versions of GS2 on SVN used to have an issue with race conditions (random failing due to asynchronous behaviour) when compiling up apache-httpd as part of GS2. Refer to Compiling the apache-httpd included with GS2 on 64 bit Windows 7. The following instructions were found to generally work with these older versions, but sometimes required recompiling when the first attempt failed.

Fixes to avoid the race conditions were made by introducing 2 scripts adjust-winmak-files.bat and mod_winmak_file.awk after which the following instructions worked all the time.

You need:

  • An SVN client installed, which can be downloaded from http://subversion.apache.org/packages.html. The instructions below assume a command-line SVN client.
  • Java JDK 6.x or later. For compiling on Windows 64 bit, need the 64 bit version of JDK. For compiling Greenstone 3.06 and onwards, need JDK 7.x or later.
  • PERL (ActivePerl for Windows)
  • Visual Studio 8 or later for compiling C++ code. (We haven't tried it with Microsoft's free Visual Studio Express yet.) For 64-bit Windows, we found that Visual Studio versions 9 and 12 worked to compile GS3 from SVN.
  • If you want to compile GS2 with debugging on, you will also need Microsoft SDK
  1. Checkout greenstone2 from SVN:
     svn co http://svn.greenstone.org/main/trunk/greenstone2 gs2-svn
  2. NOTE: If you're using Visual Studio 14 (a.k.a. Visual Studio 2015), then before proceeding, backup your windows iconv.zip and rename iconv-winVS14-VS2015-plus.zip as the new iconv.zip, as below. (For details on which libiconv this uses and how it was modified to get it to work with VS14, refer to this.)
    cd gs2-svn
    pushd common-src\indexers\packages\windows\iconv
    move iconv.zip iconv_preVS14.zip
    move iconv-winVS14-VS2015-plus.zip iconv.zip
    rmdir /s /q iconv
    popd
  3. Checkout the appropriate subfolder for your OS and bit architecture from http://svn.greenstone.org/local/greenstone2/ into your greenstone 2 checkout's toplevel folder. Name the downloaded subfolder local. If you're on Windows 64 bit, then you'd do:
    svn co http://svn.greenstone.org/local/greenstone2/windows-64bit local
  4. On 64 bit Windows, edit local/setup.bat to set the environment variables to where you have got the following installed on your system: SVN, Java SDK 7+, the Greenstone customised Strawberry Perl (download it from here), Visual Studio 9+ (Microsoft SDK is no longer needed even when the debug flag is turned on).
    On 32 bit Windows, rename the local/setup32.bat script to local/setup.bat, then edit it to set the environment variables according to your system.
  5. Run the top level GS2's setup.bat, which will automatically run local/setup.bat too:
    cd <your GS2 svn checked out folder>
    setup.bat
  6. Finally, still from your top level GS2 folder, run
    makegs2x64.bat

    Type "Y" to Extract All, then when the DOS prompt display asks what you want to compile up, type "4" to compile all without debugging, or type "5" to compile everything with debugging on. (Type "6" to clean compiled files before recompilation if you want to recompile from scratch).

In GS2 SVN checkouts from before changeset 31428, compilation on 64 bit Windows could still fail with error messages as described here, which indicates that the race condition has struck. In that case, try deleting the apache-httpd\windows\error folder if it has been generated, or all of the apache-httpd folder and run makegs2x64.bat again, choosing the same options as before. If the 'error' folder or apache-httpd folder did not exist and therefore can't be deleted, then just re-run makegs2x64.bat again. If that fails, run makegs2x64.bat and select the clean command (option 6) and then re-run makegs2x64.bat to re-compile from scratch. If doing so in a fresh command prompt, remember to run the devel64-in32mode.bat setup.bat script in local before running makegs2x64.bat.

</TAB> </TABAREA>

Old instructions

<TABAREA tabs="Greenstone3,Greenstone2"> <TAB> You NEED Visual Studio C++. (We haven't tried it with Microsoft's free Visual Studio Express yet.)

Preparation: what you need

  • Make sure you have Java 1.4 or higher. I tried it with Java 1.4.2_08.

Set the environmental variable JAVA_HOME to the full path of the Java installation directory. To set environmental variables on Windows, go to Start > Control Panel. Make sure you are in Classic View, if not, in the left-hand pane, press the Switch to Classic View link.

Now double click on the System icon. Select the Advanced tab, click the Environment Variables button. And create a new (System) variable called JAVA_HOME with the value set to the full path to the Java directory.

  • Get Apache Ant, at least version 1.6.2. (I tried it with ant 1.6.5.)
  • Create the ANT_HOME environment variable, and set its value to be the full path to the root directory of your ant installation.
  • Then adjust the existing PATH variable to include the bin directory of ANT_HOME. I.e. append the following to your Windows Path variable:
;%ANT_HOME%\bin
  • You need the SVN command-line client, because during the first phase of Greenstone 3 source code compilation (the "ant prepare" step) svn is used to download a great many other files that are necessary for compiling and building Greenstone 3.

For example, I got svn-1.4.6-setup.exe from http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91

Installation instructions

See also:

  • the README.txt file in the top-level of your greenstone3 installation folder.
  • Now we can finally download Greenstone 3 source code from its SVN repository:

Open a command line prompt. Start > Run. Type: cmd. An msdos prompt will launch. Go (using cd) into the folder wherein you want to download greenstone 3 into. Then type:

svn checkout http://svn.greenstone.org/main/trunk/greenstone3

Depending on your Internet connection speed, the above may take a *long* time.

  • When it has finished checking out Greenstone 3 code, type the following in the command prompt:
ant prepare

Troubleshooting: If the build fails in this step due to some directory being "locked" (it failed in my case), then it will give you the line number where it failed. Open build.xml in your greenstone3 installation folder and go to the line. If the section around the looks like this:

929 	  <target name="prepare-core" unless="nosvn.mode">
930 	    <!-- just get rid of empty directories-->
931 	    <svn>
932 	      <update dir="."/>
933 	    </svn>
934 	  </target>

Then comment out <update dir="."/> to get:

929 	  <target name="prepare-core" unless="nosvn.mode">
930 	    <!-- just get rid of empty directories-->
931 	    <svn>
932 	      <!-- <update dir="."/> -->
933 	    </svn>
934 	  </target>

Try the ant command again:

ant prepare

Depending on your internet speed, the above can also take a very long time (it took me over an hour), as it is further checking out files from Greenstone 3's SVN repository.

  • Once it has finished, you need to do the special Windows step which involves Visual Studio (see Note 1 for the old instructions in case they work for you):
  • Locate your Visual Studio's vcvars32.bat file. It may be located in C:\Program Files\Microsoft Visual Studio\VC98\Bin\

Just have a look to see where it is on your Visual Studio installation.

  • Back in the command prompt go the location where your vcvars32.bat file is, and run it. Example:

> cd C:\Program Files\Microsoft Visual Studio\VC98\Bin\

> vcvars32.bat

It would now have set up the environment for you to be able to successfully compile greenstone3. Don't close the command prompt, because it's just been set for the next step.

  • In the *same* prompt from which you ran vcvars32.bat, go back into your greenstone3 directory and type:
ant install

Hopefully, after some time, it will come back saying that your build was successful.

  • Now you should be able to run the tomcat web server by typing
ant start

in the cmd prompt. Thereafter, open your web browser at http://localhost:8080/greenstone3/

Note 1

You could also try the following (it did not work for me):

Go into your greenstone 3 folder–the one svn downloaded all the source into. I'm calling the full path to this $GSDLHOME. Now that you are in GSDLHOME, open build.properties. Make sure that the compile.windows.c++.setup is set to the full path location of your Visual Studio's "vcvars32.bat" file. For example, the default value given is:

compile.windows.c++.setup=C:/Program Files/Microsoft Visual Studio/VC98/Bin/VCVARS32.BAT

Go back to the MSDOS prompt, move into your greenstone3 folder and type the following:

ant install

Advanced

For information on further configuration of the installation (such as changing the port number or host name of the web server), see Advanced, the Advanced section of the walkthrough of installing GS3 from SVN for Linux.

</TAB> <TAB> You will need:

  • Visual Studio, to use its compiling capabilities which work with the Windows makefiles of Greenstone

Where to get the source code

You can get the source code from SVN (as described below) or alternatively, you can either get the source distribution or, during the installation of the binary distribution, choose to include the source code (for these see source install.

For example, I got svn-1.4.6-setup.exe from http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91

  • Open an MSDOS prompt. As given in the SVN page, to get the gsdl source code, you will need to type the following at the prompt:
svn co http://svn.greenstone.org/main/trunk/greenstone2 greenstone2

which will checkout Greenstone 2 source code into a new folder called "greenstone2".

Getting windows binaries

This is required to get the conversion tools used for importing different types of files, such as wvware.

  • In an DOS prompt, go into the bin directory inside your Greenstone 2 installation folder.

For example:

cd C:\greenstone2\bin
  • Now checkout the binaries using the following command, which will create a new folder called 'windows':
svn co http://svn.greenstone.org/main/trunk/binaries/windows/bin windows

Compiling Greenstone 2 source code on Windows

Follow the instructions at Compiling Greenstone, the Windows section.

Getting the Greenstone Librarian Interface (GLI)

  • In your top-level greenstone2 folder, check out GLI from svn. The following will do so and put the checked out GLI files into a new folder called gli:
svn co http://svn.greenstone.org/main/trunk/gli gli
  • Move into the newly created folder gli and compile it up:
cd gli
makegli.bat
  • Setup the environment for Greenstone 2 by going into the top level directory again and running setup.bat:
cd ..
setup.bat
  • In older versions of GLI (before 2.82), launching GLI will always bring up a little popup asking whether you want to enter the Library and if you click to confirm, it will open a browser window before the GLI application itself appears. To avoid having to go through this procedure each time, you can edit the glisite.cfg file.

Still in the top-level Greenstone 2 folder, make a copy of the file glisite.cfg and name it gsdlsite.cfg. Then open up the original (glisite.cfg) and change the following two lines to become:

autoenter=1
start_browser=0
  • GLI can be launched by moving back into the gli folder and running gli.bat:
cd gli
gli.bat

You will need:

  • Visual Studio, to use its compiling capabilities which work with the Windows makefiles of Greenstone

Where to get the source code

You can get the source code from SVN (as described below) or alternatively, you can either get the source distribution or, during the installation of the binary distribution, choose to include the source code (for these see source install.

For example, I got svn-1.4.6-setup.exe from http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91

  • Open an MSDOS prompt. As given in the SVN page, to get the gsdl source code, you will need to type the following at the prompt:
svn co http://svn.greenstone.org/main/trunk/greenstone2 greenstone2

which will checkout Greenstone 2 source code into a new folder called "greenstone2".

Getting windows binaries

This is required to get the conversion tools used for importing different types of files, such as wvware.

  • In an DOS prompt, go into the bin directory inside your Greenstone 2 installation folder.

For example:

cd C:\greenstone2\bin
  • Now checkout the binaries using the following command, which will create a new folder called 'windows':
svn co http://svn.greenstone.org/main/trunk/binaries/windows/bin windows

Compiling Greenstone 2 source code on Windows

Follow the instructions at Compiling Greenstone, the Windows section.

Getting the Greenstone Librarian Interface (GLI)

  • In your top-level greenstone2 folder, check out GLI from svn. The following will do so and put the checked out GLI files into a new folder called gli:
svn co http://svn.greenstone.org/main/trunk/gli gli
  • Move into the newly created folder gli and compile it up:
cd gli
makegli.bat
  • Setup the environment for Greenstone 2 by going into the top level directory again and running setup.bat:
cd ..
setup.bat
  • In older versions of GLI (before 2.82), launching GLI will always bring up a little popup asking whether you want to enter the Library and if you click to confirm, it will open a browser window before the GLI application itself appears. To avoid having to go through this procedure each time, you can edit the glisite.cfg file.

Still in the top-level Greenstone 2 folder, make a copy of the file glisite.cfg and name it gsdlsite.cfg. Then open up the original (glisite.cfg) and change the following two lines to become:

autoenter=1
start_browser=0
  • GLI can be launched by moving back into the gli folder and running gli.bat:
cd gli
gli.bat

</TAB> </TABAREA>

en/developer/windows_source_install.1632974657.txt.gz · Last modified: 2021/09/30 04:04 by anupama