/[escript]/trunk/doc/install/srclinux.tex
ViewVC logotype

Contents of /trunk/doc/install/srclinux.tex

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2538 - (show annotations)
Fri Jul 17 06:24:15 2009 UTC (10 years, 1 month ago) by caltinay
File MIME type: application/x-tex
File size: 10793 byte(s)
Install guide: Reworked introduction and enabled hyperref package

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

  ViewVC Help
Powered by ViewVC 1.1.26