Project

General

Profile

Installing Wt on Solaris with Sun CC Compiler and stlport4 » History » Version 2

Pieter Libin, 10/29/2009 02:18 PM

1 1 Pieter Libin
h1. Installing Wt on Solaris with Sun CC Compiler and stlport4
2
3
{{toc}}
4
5
6
h3. Overview 
7
8
Installing Wt on Solaris with Sun CC Compiler compiled and linked with stlport4.
9
10
successful builded on Solaris 10 sparc with Sun C++ compiler 5.9
11
12
13
h3. Dependencies 
14
15
* SUN Studio 12 (C++ Compiler 5.9): http://developers.sun.com/sunstudio/index.jsp
16
* SUN Studio 12 the latest patches: http://developers.sun.com/sunstudio/downloads/patches/ss12_patches.jsp
17
* GNU make (named as gmake in this document): http://ftp.gnu.org/pub/gnu/make/make-3.81.tar.gz
18
* GNU patch (named as gpatch in this document): ftp://ftp.gnu.org/gnu/patch/patch-2.5.9.tar.gz
19
* cmake: http://www.cmake.org/files/v2.6/cmake-2.6.3.tar.gz
20
21
install this programs for example into the $WT_ROOT path (see below).
22
23
24
h3. prepare the install directory 
25
26
We don't need to build and install the libraries as root.
27
28
You need only run this two commands as root (or ask your system admin to do that):
29
<pre>
30
mkdir /opt/WT
31
chown <user>:<group> /opt/WT
32
chmod 755 /opt/WT
33
</pre>
34
<user> and <group> have to be a valid system user and group
35
36
Now you can build and install the libs as <user>. Loggin as <user>
37
38
39
h3. set environment 
40
41
<pre>
42
WT_ROOT=/opt/WT
43
BUILD_DIR=$WT_ROOT/build
44
ZLIB_ROOT=$WT_ROOT
45
SSL_ROOT=$WT_ROOT
46
BOOST_CFG=sw-mt
47
BOOST_COMPILER=sw
48
BOOST_ROOT=$WT_ROOT
49
BOOST_VERSION=1_39
50
FCGI_ROOT=$WT_ROOT
51
PATH=$WT_ROOT/bin:$PATH
52
LD_LIBRARY_PATH=$WT_ROOT/lib:$LD_LIBRARY_PATH
53
mkdir $BUILD_DIR
54
mkdir $WT_ROOT/bin
55
mkdir $WT_ROOT/lib
56
export WT_ROOT BUILD_DIR ZLIB_ROOT SSL_ROOT BOOST_CFG BOOST_COMPILER BOOST_ROOT BOOST_VERSION FCGI_ROOT PATH LD_LIBRARY_PATH
57
</pre>
58
59
60
h3. download sources to $BUILD_DIR as example with wget 
61
62
<pre>
63
cd $BUILD_DIR
64
wget http://www.zlib.net/zlib-1.2.3.tar.gz
65
wget http://www.openssl.org/source/openssl-0.9.8k.tar.gz
66
wget http://switch.dl.sourceforge.net/sourceforge/boost/boost-jam-3.1.17.tgz
67
wget http://switch.dl.sourceforge.net/sourceforge/boost/boost_1_39_0.tar.gz
68
wget http://ftp.de.debian.org/debian/pool/main/libf/libfcgi/libfcgi_2.4.0.orig.tar.gz
69
wget http://ftp.de.debian.org/debian/pool/main/libf/libfcgi/libfcgi_2.4.0-7.diff.gz
70
wget http://switch.dl.sourceforge.net/sourceforge/witty/wt-2.2.4.tar.gz
71
</pre>
72
73
74
h3. build libs 
75
76
77
h4. zlib 
78
79
<pre>
80
cd $BUILD_DIR
81
gzip -dc zlib-1.2.3.tar.gz | tar xpf -
82
cd zlib-1.2.3
83
gmake all install
84
</pre>
85
86
87
h4. openssl 
88
89
<pre>
90
cd $BUILD_DIR
91
gzip -dc openssl-0.9.8k.tar.gz | tar xpf -
92
cd openssl-0.9.8k
93
./config --prefix=$SSL_ROOT --openssldir=$SSL_ROOT/share/ssl shared threads zlib
94
gmake all install
95
</pre>
96
97
98
h4. bjam 
99
100
<pre>
101
cd $BUILD_DIR
102
gzip -dc boost-jam-3.1.17.tgz | tar xpf -
103
cd boost-jam-3.1.17
104
./build.sh sunpro
105
cp $WT_ROOT/bin
106
</pre>
107
108
109
h4. boost 
110
111
<pre>
112
cd $BUILD_DIR
113
gzip -dc boost_1_39_0.tar.gz | tar xpf -
114
cd boost_1_39_0
115
echo "import toolset : using ;" >tools/build/v2/user-config.jam
116
echo "using sun : : CC : <stdlib>sun-stlport <cxxflags>\"-library=stlport4 \
117
  -xcode=pic32 -erroff=wvarhidemem,hidevf,hidevfinvb -errtags=yes\" <linkflags>\"-library=stlport4 \
118
  -xcode=pic32\" ;" >> tools/build/v2/user-config.jam
119
gpatch boost/thread/detail/thread.hpp <<EOF
120
107c107
121
<     private:
122
---
123
>     public:
124
108a109,110
125
>     private:
126
>         // need to be public: thread(thread&);
127
EOF
128
bjam install -d2 --prefix=$BOOST_ROOT \
129
  toolset=sun stdlib=sun-stlport \
130
  variant=release,debug threading=multi link=shared \
131
  -sNO_COMPRESSION=0 -sNO_BZIP2=1 -sNO_ZLIB=0 \
132
  -sZLIB_INCLUDE=$ZLIB_ROOT/include -sZLIB_LIBPATH=$ZLIB_ROOT/lib -sZLIB_BINARY=z
133
</pre>
134
135
136
h4. fcgi 
137
138
To build fcgi we use sources and patches from debian http://packages.debian.org/stable/libfcgi-dev, which is working well.
139
The orginal source file from http://www.fastcgi.com/dist will not build on solaris.
140
<pre>
141
cd $BUILD_DIR
142
gzip -dc libfcgi_2.4.0.orig.tar.gz | tar xpf -
143
mv libfcgi-2.4.0.orig libfcgi-2.4.0
144
cd libfcgi-2.4.0
145
gzip -dc ../libfcgi_2.4.0-7.diff.gz | gpatch -p1
146
CXXFLAGS=-library=stlport4 ./configure --prefix=$WT_ROOT --disable-static
147
gmake all install
148
</pre>
149
150
151
h4. wt 
152
153
<pre>
154
cd $BUILD_DIR
155
gzip -dc wt-2.2.4.tar.gz | tar xpf -
156
cd wt-2.2.4
157
gpatch -p1 <<EOF
158
diff -Nurp wt-2.2.4.org/src/Wt/WAbstractItemModel.C wt-2.2.4/src/Wt/WAbstractItemModel.C
159
--- wt-2.2.4.org/src/Wt/WAbstractItemModel.C    2009-03-04 12:00:30.000000000 +0100
160
+++ wt-2.2.4/src/Wt/WAbstractItemModel.C        2009-05-03 14:22:46.993329000 +0200
161
@@ -4,6 +4,7 @@
162
  * See the LICENSE file for terms of use.
163
  */
164
 
165
+#include <stdio.h>
166
 #include <boost/lexical_cast.hpp>
167
 #include <boost/algorithm/string/predicate.hpp>
168
 
169
diff -Nurp wt-2.2.4.org/src/Wt/WModelIndex.C wt-2.2.4/src/Wt/WModelIndex.C
170
--- wt-2.2.4.org/src/Wt/WModelIndex.C   2009-03-04 12:00:30.000000000 +0100
171
+++ wt-2.2.4/src/Wt/WModelIndex.C       2009-05-03 14:48:04.304612000 +0200
172
@@ -3,6 +3,7 @@
173
  *
174
  * See the LICENSE file for terms of use.
175
  */
176
+#include <string.h>
177
 #include <iostream>
178
 
179
 #include "Wt/WModelIndex"
180
diff -Nurp wt-2.2.4.org/src/http/WServer.C wt-2.2.4/src/http/WServer.C
181
--- wt-2.2.4.org/src/http/WServer.C     2009-03-04 12:00:30.000000000 +0100
182
+++ wt-2.2.4/src/http/WServer.C 2009-05-03 17:26:09.978681000 +0200
183
@@ -11,6 +11,9 @@
184
 #include <string>
185
 
186
 #if !defined(_WIN32)
187
+#ifdef __SUNPRO_CC
188
+#  define _POSIX_PTHREAD_SEMANTICS
189
+#endif
190
 #include <signal.h>
191
 #include <sys/types.h>
192
 #include <sys/wait.h>
193
EOF
194
mkdir build
195
cd build
196
cmake \
197
  -DCMAKE_CXX_FLAGS:STRING=-library=stlport4 \
198
  -DCMAKE_EXE_LINKER_FLAGS:STRING=-library=stlport4 \
199
  -DCMAKE_MODULE_LINKER_FLAGS:STRING=-library=stlport4 \
200
  -DCMAKE_SHARED_LINKER_FLAGS:STRING=-library=stlport4 \
201
  -DBOOST_COMPILER=$BOOST_COMPILER \
202
  -DBOOST_DIR=$BOOST_ROOT \
203
  -DBOOST_VERSION=$BOOST_VERSION \
204
  -DCMAKE_INSTALL_PREFIX=$WT_ROOT \
205
  -DCMAKE_VERBOSE_MAKEFILE=TRUE \
206
  -DCONFIGDIR=$WT_ROOT/etc \
207
  -DCONFIGURATION=$WT_ROOT/etc/wt_config.xml \
208
  -DCONNECTOR_FCGI=ON \
209
  -DCONNECTOR_HTTP=ON \
210
  -DDEPLOYROOT=$WT_ROOT/deploy \
211
  -DEXAMPLES_CONNECTOR=wtfcgi \
212
  -DFCGIPP_LIB=$FCGI_ROOT/lib/libfcgi++.so \
213
  -DFCGI_INCLUDE_DIR=$FCGI_ROOT/include \
214
  -DFCGI_LIB=$FCGI_ROOT/lib/libfcgi.so \
215
  -DMULTI_THREADED=ON \
216
  -DRUNDIR=$WT_ROOT/run \
217
  -DUSERLIB_ROOT=$WT_ROOT/lib \
218
  -DSSL_INCLUDE_DIRS=$SSL_ROOT/include \
219
  -DSSL_LIB=$SSL_ROOT/lib/libssl.so \
220
  -DZLIB_INCLUDE=$ZLIB_ROOT/include \
221
  -DZLIB_LIB=$ZLIB_ROOT/lib/libz.so \
222
  -DWTHTTP_CONFIGURATION=$WT_ROOT/etc ..
223
gmake
224
gmake -C examples
225
gmake install
226
</pre>
227
228
thanks Koen Deforche for the CMAKE_CXX_FLAGS help: http://sourceforge.net/mailarchive/message.php?msg_name=205a79980904172331u167bd2derc0f56d85954a0165%40mail.gmail.com