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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3942 - (show annotations)
Fri Jul 27 01:04:48 2012 UTC (6 years, 11 months ago) by jfenwick
File MIME type: application/x-tex
File size: 11979 byte(s)
Porting changes back from 3.3 release branch

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

  ViewVC Help
Powered by ViewVC 1.1.26