Installing Wt on Cygwin using gcc

Version 8 (Wim Dumon, 09/15/2011 08:54 pm)

1 2 Wim Dumon
h1. Install Wt's dependencies
2 2 Wim Dumon
3 2 Wim Dumon
h2. Cygwin
4 2 Wim Dumon
5 6 Wim Dumon
From "the cygwin homepage":http://www.cygwin.com/, download setup.exe and install a typical C++ development system. Install at least these items:
6 6 Wim Dumon
* gcc4. Building Wt on cygwin requires gcc > 4. At the time of writing of this document, gcc4 was a separate package in cygwin, whereas the normal gcc package was gcc v3. I installed only gcc-4, and @gcc --version@ reports gcc 4.3.4.
7 6 Wim Dumon
* cmake
8 6 Wim Dumon
* make
9 2 Wim Dumon
10 2 Wim Dumon
h2. Get and install boost
11 2 Wim Dumon
12 2 Wim Dumon
Go to "the boost homepage":http://www.boost.org/ and download the most recent boost version. Build boost following the instructions for the version you downloaded. For example, boost 1.43.0 is compiled and installed in @/cygdrive/j/boost-cygwin@ using the following commands:
13 2 Wim Dumon
<pre>
14 8 Wim Dumon
./bootstrap.sh
15 2 Wim Dumon
./bjam.exe --prefix=/cygdrive/j/boost-cygwin --layout=versioned install
16 2 Wim Dumon
</pre>
17 2 Wim Dumon
18 2 Wim Dumon
Note: Compiling (and installing) boost on cygwin is painfully slow.
19 2 Wim Dumon
20 2 Wim Dumon
On my system, boost failed to copy the compiled dll's to the correct location. I ran the following command to correct this:
21 2 Wim Dumon
<pre>
22 2 Wim Dumon
for i in `find . -name \*.dll`; do cp $i /cygdrive/j/boost-cygwin/lib; done
23 2 Wim Dumon
</pre>
24 2 Wim Dumon
25 2 Wim Dumon
Add the directory where you copied these dlls to your PATH environment variable.
26 2 Wim Dumon
27 1
h1. Installing Wt on Cygwin using gcc
28 2 Wim Dumon
29 2 Wim Dumon
h2. Download Wt
30 2 Wim Dumon
31 2 Wim Dumon
Download Wt from "the wt download page":http://www.webtoolkit.eu/wt/download. The first version of Wt that attempts to support cygwin is version 3.1.3.
32 2 Wim Dumon
33 2 Wim Dumon
h2. Configure Wt
34 2 Wim Dumon
35 2 Wim Dumon
Run cmake. Turns out that cmake's built-in method is unable to discover boost on cygwin, so you need to set BOOST_DIR, BOOST_VERSION and BOOST_COMPILER yourself. Look in the 'lib' directory of the location where you installed boost in the previous step to find out the correct values for BOOST_VERSION and BOOST_COMPILER (e.g. in the examples below, the libraries are called @libboost_wave-gcc43-mt-1_43.a@)
36 2 Wim Dumon
37 2 Wim Dumon
You must build Wt in a different directory than the source directory:
38 2 Wim Dumon
39 2 Wim Dumon
<pre>
40 2 Wim Dumon
mkdir build
41 2 Wim Dumon
cd build
42 2 Wim Dumon
cmake -DBOOST_DIR=/cygdrive/j/boost-cygwin -DBOOST_VERSION=1_43 -DBOOST_COMPILER=gcc43 /path/to/wt-x.y.z
43 2 Wim Dumon
</pre>
44 2 Wim Dumon
45 2 Wim Dumon
h2. Build Wt
46 2 Wim Dumon
47 2 Wim Dumon
Start @make@ in the directory where you ran cmake:
48 2 Wim Dumon
<pre>
49 2 Wim Dumon
make -j 4
50 2 Wim Dumon
</pre>
51 2 Wim Dumon
52 2 Wim Dumon
h1. Run Wt examples
53 2 Wim Dumon
54 2 Wim Dumon
Always run examples with the pwd set to their source directory, not from the directory where they are built. Doing so will ensure that Wt will find resource files required to run the example. On top of the example-specific resource files, Wt uses a general 'resources' directory, containing images, css, themes, ... that are required by internal Wt widgets. You must copy them to your example directory before executing the example.
55 2 Wim Dumon
56 2 Wim Dumon
<pre>
57 2 Wim Dumon
cd wt-x.y.z/examples/hello
58 2 Wim Dumon
cp -r ../../resources .
59 2 Wim Dumon
./hello --docroot=. --http-port=8080 --http-address=0.0.0.0
60 2 Wim Dumon
</pre>
61 2 Wim Dumon
62 2 Wim Dumon
Surf to http://localhost:8080/ and enjoy!
63 2 Wim Dumon
64 2 Wim Dumon
Some examples have extra dependencies, such as ExtJS (extkitchen, widgetgallery, ...) and tinyMCE (widgetgallery); the FAQ on this wiki explains how to install these.