Installing OCaml and Camlp5 to compile GeneWeb
Compiling GeneWeb requires the installation of OCaml and Camlp5. Nowadays, the simplest method is to install them through OPAM (OCaml preferred package manager) that is able to manage multiple versions of OCaml on the same machine. Note that Camlp5 must be installed for each version of the compiler.
Without OPAM, the old way of doing this was to install/compile OCaml and Camlp5 all by yourself [will perhaps be documented one day by one of our ancestors!].
When Ocaml and camlp5 are installed, you can clone repository to compile GeneWeb.
Don’t forget that 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.
For GeneWeb 7
This has been tested on a Debian in november 2015 (debian-8.2.0-i386-netinst.iso).
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.
Under OS X
This has been tested on OS X El Capitan 10.11.6 in September 2016.
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)"
If this gives the error “Illegal variable name.”, switch to Bash.
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.
Under Windows using Cygwin
This has been tested on Windows 7 x64 and x86 in January 2016.
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 downloaded 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 under a prompt with administrator rights and having Cygwin setup in the same directory.
GeneWeb 6.xx with OPAM
opam switch 3.12.1 eval `opam config env` opam install -y camlp5 ocamlfind
When using Opam on old sources, we need to replace the path to Camlp5
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
camlp5 -where or
ocamlfind query camlp5, for this exemple camlp5 lib is in
Previous chapter for Linux works for Windows under Cygwin modifying a few steps, OCaml version name is:
opam switch 3.12.1+mingw32
Using relative path or
/cygdrive/… don’t work, we must target camlp5 lib using its full Windows path that depends of where is your home directory in Cygwin installation:
sed -i 's|CAMLP5D=.*|CAMLP5D=c:\\cygwin\\home\\user\\.opam\\3.12.1+mingw32\\lib\\camlp5|' tools/Makefile.inc
Building version 6.07 like this also works under Windows.
Clone repository and compile GeneWeb
git clone https://github.com/geneweb/geneweb git pull ./configure && make opt && make distrib
If GeneWeb compilation fails, look at continuous integration tools to see if lastest build is passing on your plateform.
GeneWeb/OCaml/Camlp5 compability chart
|7 master||4.02.3||p5 6.13-6.17|
* “same version number” for camlp4 as Ocaml version number
** Dominique Deram, compilation under Windows XP (jan. 2011)