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

  ViewVC Help
Powered by ViewVC 1.1.26