Installing OCaml and Camlp5 to compile GeneWeb

From GeneWeb
Revision as of 18:16, 16 September 2016 by Houdini (Talk | contribs)

Jump to: navigation, search

Compiling GeneWeb requires the installation of OCaml and Camlp5.

Installing OCaml and Camlp5 through OPAM (OCaml preferred package manager) allows the installation of the two versions of OCaml needed for GeneWeb:

  • Old GeneWeb versions (lower than 7.00) should be compiled with OCaml version 3.12.1.
  • Starting at version 7.00, GeneWeb must be compiled with OCaml >4.02.

Camlp5 must be installed for each version of the compiler.

If your base has been built under an old version, it won't be compatible with bases built with new version: one should recover through the .gw format to migrate from one to the other.

When Ocaml and camlp5 are installed, you can clone repository to compile GeneWeb.

Under Windows using Cygwin

This has been tested on Windows 7 x64 and x86 in September 2016:

GeneWeb 7

If you have Windows Powershell (embedded in Windows since XP SP2), this batch script will download/compile/install Cygwin/Opam/OCaml/Camlp5/Ocamfind/GeneWeb for you. You can download the script copying this line on a Windows prompt (command line) with administrator rights:

powershell.exe -Command (new-object System.Net.WebClient).DownloadFile('https://gist.github.com/a2line/f134c88c80eafcf0411b38e32a0a7128/raw/','opamwin.bat')

Then just launch the script typing opamwin in the same console to install everything.

Without Powershell, you have to download the batch file opamwin.bat and the right Cygwin setup x64 or x86 manually. Launch the script with Cygwin setup in the same directory.

A temporary fix for issue #58 to fix native executable problem on Windows : the part of the script that compile GeneWeb itself contains a switch to the commit of the 8 may 2016 (git checkout -b win8mai 6a87ebef17af1d28ae6c1a3c6e4e1116dc737f28). Without it, since that date, you will compile smaller exe that work only in Cygwin.

Under Linux

This has been tested on a Debian in november 2015 (debian-8.2.0-i386-netinst.iso).

GeneWeb 7

To install Opam/OCaml (4.02.3)/Camlp5 (6.14)/ocamlfind (1.6.2):

apt-get install opam
opam init
opam update
opam switch 4.02.3
opam install -y camlp5 ocamlfind
eval 'opam config env'

If ocamfind install fails with opam, try installing pkg-config before with apt-get install pkg-config, then retry.

GeneWeb <6.08

To build previous versions of GeneWeb you need to switch to OCaml 3.12.1 with Opam:

opam switch 3.12.1
opam install -y camlp5 ocamlfind
eval 'opam config env'

When using Opam on old sources, we need to replace the path to Camlp5 CAMLP5D=+camlp5 in tools/Makefile.inc with a sed command after configuring Makefile:

./configure
sed -i 's|CAMLP5D=+camlp5|CAMLP5D=~/.opam/3.12.1/lib/camlp5|' tools/Makefile.inc
make
make distrib

You can check the path to Camlp5 with ocamlfind query camlp5, for this exemple camlp5 lib is in /root/.opam/3.12.1/lib/camlp5/.

Building like this was succesfull with 6.08-alpha, 6.05 and 6.04-src.tgz from geneweb.org (see #30).

Under OS X

This has been tested on OSX El Capitan 10.11.6 in september 2016.

GeneWeb 7

To install Opam/OCaml the best way is to install the corresponding packages with Homebrew, a package management software. You have to install first homebrew in Terminal application as explained by pasting this command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Once homebrew is installed you can easily install Opam in Terminal application with these commands:

brew install opam 
opam init
opam update
opam switch 4.02.3

and then OCaml:

opam install -y camlp5 ocamlfind
eval `opam config env`

Before compiling GeneWeb you need to update bash with homebrew in Terminal application:

brew install bash 

Do not take into account the caveats about bash path. You can now download and compile GeneWeb.


Clone repository and compile GeneWeb

GeneWeb uses the version control software Git. Its repository is hosted on Github at https://github.com/geneweb/geneweb. To compile GeneWeb, you need OCaml.

git clone https://github.com/geneweb/geneweb
git pull
./configure && make && make distrib

If GeneWeb compilation fails, look at continuous integration tools to see if lastest build is passing on your plateform.


GeneWeb Manual

Rembrandt Old Man Reading a Book.jpg

Use and manage genealogical databases

Technical annex