/[escript]/branches/doubleplusgood/doc/install/srclinux.tex
ViewVC logotype

Contents of /branches/doubleplusgood/doc/install/srclinux.tex

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2536 - (show annotations)
Thu Jul 16 23:53:07 2009 UTC (9 years, 9 months ago) by caltinay
Original Path: trunk/doc/install/srclinux.tex
File MIME type: application/x-tex
File size: 10810 byte(s)
installguide: Fixed typos, minor semantics, repetitions and whitespace issues.

1
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % Copyright (c) 2003-2008 by University of Queensland
5 % Earth Systems Science Computational Center (ESSCC)
6 % http://www.uq.edu.au/esscc
7 %
8 % Primary Business: Queensland, Australia
9 % Licensed under the Open Software License version 3.0
10 % http://www.opensource.org/licenses/osl-3.0.php
11 %
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
14 \section{Installing from source for \linux}
15 \label{sec:srclinux}
16
17 \subsection{Preliminaries}
18
19 The following instructions assume you are running the \filename{bash} shell.
20 Comments are indicated with \# characters.
21
22 Make sure you have the following installed:
23 \begin{itemize}
24 \item \filename{g++} and associated tools.
25 \item \filename{make}
26 % I suspect that these are only needed by VTK and if we aren't using it anymore they could be removed
27 \item \filename{libXext.so}\footnote{In Debian this is in the libXext-dev package.}
28 \item \filename{libxt.so}\footnote{In Debian this is in the libxt-dev package.}
29 \end{itemize}
30
31 You will also need a copy of the \esfinley source code.
32 If you retrieved the source using subversion, don't forget that one can use the export command instead of checkout to get a smaller copy.
33 For additional visualisation functionality see Section~\ref{sec:linaddfunc}.
34
35 These instructions will produce the following directory structure:
36 \begin{itemize}
37 \item[] \filename{stand} \begin{itemize}
38 \item[] \filename{escript.d}
39 \item[] \filename{pkg}
40 \item[] \filename{pkg_src}
41 \item[] \filename{build}
42 \item[] \filename{doc}
43 \end{itemize}
44 \end{itemize}
45
46 Before you start copy the \esfinley source into the \filename{escript.d} directory.
47 The following instructions refer to software versions in the \filename{escript-support-3-src} and \filename{escript-support-visi-3-src} bundles.
48 If you download your own versions of those packages substitute their version numbers and names as appropriate.
49 There are a number of uses of the \filename{make} command in the following instructions.
50 If your computer has multiple cores/processors you can speed up the compilation process by adding -j 2 after the make command.
51 For example to use all processors on a computer with 4 cores:
52 \begin{shellCode}
53 make
54 \end{shellCode}
55 becomes
56 \begin{shellCode}
57 make -j 4
58 \end{shellCode}
59
60 \begin{shellCode}
61 mkdir stand
62 cd stand
63 mkdir build doc pkg pkg_src
64 export PKG_ROOT=$(pwd)/pkg
65 \end{shellCode}
66
67 \subsection{Building the dependencies}
68
69 Copy the compressed sources for the packages into \filename{stand/pkg_src}.
70 If you are using the support bundles, decompress them in the stand directory:
71 \begin{shellCode}
72 tar -xjf escript-support-3-src.tar.bz2
73 \end{shellCode}
74
75 Copy documentation files into \filename{doc} then unpack the archives:
76
77 \begin{shellCode}
78 cd build
79 tar -jxf ../pkg_src/Python-2.6.1.tar.bz2
80 tar -jxf ../pkg_src/boost_1_39_0.tar.bz2
81 tar -zxf ../pkg_src/scons-1.2.0.tar.gz
82 tar -zxf ../pkg_src/numpy-1.3.0.tar.gz
83 tar -zxf ../pkg_src/netcdf-4.0.tar.gz
84 tar -zxf ../pkg_src/matplotlib-0.98.5.3.tar.gz
85 \end{shellCode}
86
87 \begin{itemize}
88
89 \item Build Python:
90 \begin{shellCode}
91 cd Python*
92 ./configure --prefix=$PKG_ROOT/python-2.6.1 --enable-shared 2>&1 \
93 | tee tt.configure.out
94 make install 2>&1 | tee tt.make.out
95
96 cd ..
97
98 export PATH=$PKG_ROOT/python/bin:$PATH
99 export PYTHONHOME=$PKG_ROOT/python
100 export LD_LIBRARY_PATH=$PKG_ROOT/python/lib:$LD_LIBRARY_PATH
101
102 pushd ../pkg
103 ln -s python-2.6.1/ python
104 popd
105 \end{shellCode}
106
107 Run the new python executable to make sure it works.
108
109 \item Now build NumPy:
110 \begin{shellCode}
111 cd numpy-1.3.0
112 python setup.py build
113 python setup.py install --prefix $PKG_ROOT/numpy-1.3.0
114 cd ..
115 pushd ../pkg
116 ln -s numpy-1.3.0 numpy
117 popd
118 export PYTHONPATH=$PKG_ROOT/numpy/lib/python2.6/site-packages:$PYTHONPATH
119 \end{shellCode}
120
121 % \begin{shellCode}
122 % cd numarray-1.5.2
123 %
124 % python setup.py install \
125 % --gencode --install-lib=$PKG_ROOT/numarray-1.5.2/lib \
126 % --install-headers=$PKG_ROOT=$PKG_ROOT/numarray-1.5.2/include/numarray \
127 % 2>&1 | tee tt.install.out
128 %
129 %
130 % export PYTHONPATH=$PKG_ROOT/numarray/lib:$PYTHONPATH
131 % cd ..
132 % pushd ../pkg
133 % ln -s numarray-1.5.2 numarray
134 % popd
135 % \end{shellCode}
136
137 \item Next build scons:
138 \begin{shellCode}
139 cd scons-1.2.0
140 python setup.py install --prefix=$PKG_ROOT/scons-1.2.0
141
142 export PATH=$PKG_ROOT/scons/bin:$PATH
143 cd ..
144 pushd ../pkg
145 ln -s scons-1.2.0 scons
146 popd
147 \end{shellCode}
148
149 \item The Boost libraries...:
150 \begin{shellCode}
151 pushd ../pkg
152 mkdir boost_1_39_0
153 ln -s boost_1_39_0 boost
154 popd
155 cd boost_1_39_0
156 ./bootstrap.sh --with-libraries=python --prefix=$PKG_ROOT/boost
157 ./bjam
158 ./bjam install --prefix=$PKG_ROOT/boost --libdir=$PKG_ROOT/boost/lib
159 export LD_LIBRARY_PATH=$PKG_ROOT/boost/lib:$LD_LIBRARY_PATH
160 cd ..
161 pushd ../pkg/boost/lib/
162 ln *.so.* libboost_python.so
163 popd
164 \end{shellCode}
165
166 \item ...and NetCDF:
167 \begin{shellCode}
168 cd netcdf-4.0
169 CFLAGS="-O2 -fPIC -Df2cFortran" CXXFLAGS="-O2 -fPIC -Df2cFortran" \
170 FFLAGS="-O2 -fPIC -Df2cFortran" FCFLAGS="-O2 -fPIC -Df2cFortran" \
171 ./configure --prefix=$PKG_ROOT/netcdf-4.0
172
173 make
174 make install
175
176 export LD_LIBRARY_PATH=$PKG_ROOT/netcdf/lib:$LD_LIBRARY_PATH
177 cd ..
178 pushd ../pkg
179 ln -s netcdf-4.0 netcdf
180 popd
181 \end{shellCode}
182
183 \item Finally matplotlib:
184 \begin{shellCode}
185 cd matplotlib-0.98.5.3
186 python setup.py build
187 python setup.py install --prefix=$PKG_ROOT/matplotlib-0.98.5.3
188 cd ..
189 pushd ../pkg
190 ln -s matplotlib-0.98.5.3 matplotlib
191 popd
192 cd ..
193 \end{shellCode}
194
195 \end{itemize}
196
197 \subsection{VTK support}
198 VTK is only required for pyvisi. To build it you need CMake and Mesa.
199 The packages can be downloaded independently or in the \filename{escript-support-visi-3-src}.
200 If you will not be using pyvisi, then skip to Section~\ref{sec:compileescriptlinux}
201
202 Copy the compressed sources for the packages into \filename{stand/pkg_src}.
203 If you are using the support bundles, decompress them in the stand directory.
204 \begin{shellCode}
205 tar -xjf escript-support-visi-3-src.tar.bz2
206 \end{shellCode}
207
208 \begin{shellCode}
209 cd build
210 tar -jxf ../pkg_src/MesaLib-7.2.tar.bz2
211 tar -zxf ../pkg_src/vtk-5.2.1.tar.gz
212 tar -zxf ../pkg_src/vtkdata-5.2.1.tar.gz
213 tar -zxf ../pkg_src/cmake-2.6.3.tar.gz
214 \end{shellCode}
215
216 \begin{itemize}
217
218 \item Build CMake:
219 \begin{shellCode}
220 cd cmake-2.6.3
221 ./configure --prefix=$PKG_ROOT/cmake-2.6.3 2>&1 | tee tt.configure
222 make
223 make install
224
225 export PATH=$PKG_ROOT/cmake/bin:$PATH
226 cd ..
227 pushd ../pkg
228 ln -s cmake-2.6.3 cmake
229 popd
230 \end{shellCode}
231
232 \item Build Mesa:
233 \begin{shellCode}
234 cd Mesa-7.2
235 ./configure --prefix=$PKG_ROOT/mesa-7.2 --enable-gl-osmesa --with-driver=xlib
236
237 make
238 make install
239
240 export LD_LIBRARY_PATH=$PKG_ROOT/mesa/lib:$LD_LIBRARY_PATH
241 cd ..
242 pushd ../pkg
243 ln -s mesa-7.2 mesa
244 popd
245 \end{shellCode}
246 These instructions do not compile MesaDemos or GLUT.
247 If you need to check if Mesa compiled correctly, then the demos are a good test.
248
249 \item Finally, build VTK:
250 \begin{shellCode}
251 cd VTK
252 cmake .
253 \end{shellCode}
254
255 Now edit the \filename{CMakeCache.txt} file and make the following changes.
256 Where .... appears please replace it with the absolute path to the pkg directory.
257 For example, replace \filename{CMAKE_INSTALL_PREFIX:PATH=..../vtk-5.2.1} with
258 \filename{CMAKE_INSTALL_PREFIX:PATH=/home/bob/stand/pkg/vtk-5.2.1}
259 (Search for the text before the =).
260 \begin{shellCode}
261 BUILD_EXAMPLES:BOOL=OFF
262 BUILD_SHARED_LIBS:BOOL=ON
263 CMAKE_INSTALL_PREFIX:PATH=..../vtk-5.2.1
264 CMAKE_VERBOSE_MAKEFILE:BOOL=TRUE
265 VTK_OPENGL_HAS_OSMESA:BOOL=TRUE
266 VTK_USE_64BIT_IDS:BOOL=ON
267 VTK_WRAP_PYTHON:BOOL=ON
268 VTK_USE_MANGLED_MESA:BOOL=OFF
269 \end{shellCode}
270
271 Now rerun cmake (it won't work but it adds some variables you need).
272
273 \begin{shellCode}
274 cmake .
275 \end{shellCode}
276
277 Edit \filename{CMakeCache.txt} and change the following variables:
278
279 \begin{shellCode}
280 VTK_USE_OFFSCREEN:BOOL=ON
281 VTK_USE_TK:BOOL=OFF
282 OSMESA_INCLUDE_DIR:PATH=..../mesa/include
283 OSMESA_LIBRARY:FILEPATH=..../mesa/lib/libOSMesa.so
284 PYTHON_INCLUDE_PATH:PATH=..../python/include/python2.6
285 PYTHON_LIBRARY:FILEPATH=..../python/lib/libpython2.6.so
286 OPENGL_INCLUDE_DIR:PATH=..../mesa/include
287 OPENGL_gl_LIBRARY:FILEPATH=..../mesa/lib/libGL.so
288 \end{shellCode}
289
290 The following steps will take a while so grab a coffee while it compiles.
291 \begin{shellCode}
292 cmake .
293 make
294 chmod +w Utilities/vtktiff/tif_fax3sm.c
295 make install
296
297 cd ../../pkg
298 ln -s vtk-5.2.1 vtk
299 cd ..
300 \end{shellCode}
301
302 \end{itemize}
303
304 \subsection{Compiling escript}\label{sec:compileescriptlinux}
305
306 Change to the directory containing your escript source (\filename{escript.d}), then:
307
308 \begin{shellCode}
309 cd escript.d/scons
310 cp linux_options_example.py YourMachineName_options.py
311
312 echo $PKG_ROOT
313 \end{shellCode}
314
315 Edit the options file and put the value of PKG_ROOT between the quotes in the PKG_ROOT= line.
316 For example:
317 \begin{shellCode}
318 PKG_ROOT="/home/bob/stand/pkg"
319 \end{shellCode}
320
321 \begin{shellCode}
322 cd ../bin
323 \end{shellCode}
324
325 Modify the STANDALONE line of \filename{escript} to read:
326
327 STANDALONE=1
328
329 Start a new terminal and go to the \filename{stand} directory.
330
331 \begin{shellCode}
332 export PATH=$(pwd)/pkg/scons/bin:$PATH
333 cd escript.d
334 eval $(bin/escript -e)
335 scons
336 \end{shellCode}
337
338 If you wish to test your build, then you can do the following.
339 Note this may take a while if you have a slow processor and/or less than 1GB of RAM.
340 \begin{shellCode}
341 scons all_tests
342 \end{shellCode}
343
344 \subsection{Cleaning up}
345 Once you are satisfied, the \filename{escript.d/build} and \filename{\$PKG_ROOT/build} directories can be removed.
346
347 If you \emph{really} want to save space and do not wish to be able to edit or recompile \esfinley, you can remove the following:
348 \begin{itemize}
349 \item From the \filename{escript.d} directory:\begin{itemize}
350 \item Everything except: \filename{bin}, \filename{include}, \filename{lib}, \filename{esys},
351 \filename{README_LICENSE}.
352 \item Hidden files, which can be removed using
353 \begin{shellCode}
354 find . -name .?* | xargs rm -rf
355 \end{shellCode}
356 in the \filename{escript.d} directory.
357 \end{itemize}
358 \item from the \filename{pkg} directory:
359 \begin{itemize}
360 \item \filename{scons}, \filename{scons-1.2.0}, \filename{cmake-2.6.3} and \filename{cmake}
361 \end{itemize}
362 \item \filename{package\_src}\footnote{Do not remove this if you intend to redistribute.}.
363 \end{itemize}
364
365 Please note that removing all these files may make it more difficult for us to diagnose problems.
366
367
368 \section{Additional Functionality}\label{sec:linaddfunc}
369 To perform visualisations you will need some additional tools.
370 Since these do not need to be linked with any of the packages above, you can install versions available for your system, or build them from source.
371 \begin{itemize}
372 \item \filename{ppmtompeg} and \filename{jpegtopnm} from the \filename{netpbm} suite - to build from source
373 you would also need \filename{libjpeg} and its headers as well as \filename{libpng}\footnote{libpng requires zlib to build} and its headers.
374 \item A tool to visualise VTK files. For example Mayavi or Visit.
375 \end{itemize}
376

  ViewVC Help
Powered by ViewVC 1.1.26