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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3942 - (hide annotations)
Fri Jul 27 01:04:48 2012 UTC (6 years, 8 months ago) by jfenwick
Original Path: trunk/doc/install/srclinux.tex
File MIME type: application/x-tex
File size: 11979 byte(s)
Porting changes back from 3.3 release branch

1 jfenwick 2289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2     %
3 jfenwick 3911 % Copyright (c) 2003-2012 by University of Queensland
4 jfenwick 2289 % 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 jfenwick 2317 \label{sec:srclinux}
15 caltinay 2536
16 jfenwick 3335 \subsection{Dependencies}
17 caltinay 2536
18 jfenwick 3322 The following instructions assume you are running the \file{bash} shell.
19 jfenwick 2317 Comments are indicated with \# characters.
20     Make sure you have the following installed:
21     \begin{itemize}
22 jfenwick 3322 \item \file{g++} and associated tools.
23     \item \file{make}
24 caltinay 2536 % I suspect that these are only needed by VTK and if we aren't using it anymore they could be removed
25 jfenwick 3322 % \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 jfenwick 2317 \end{itemize}
28    
29 caltinay 3599 \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 jfenwick 2602 \begin{itemize}
34 jfenwick 3322 \item \file{freetype2}
35 caltinay 3599 \item \file{zlib}
36     \item \file{libpng}
37 jfenwick 2602 \end{itemize}
38    
39 jfenwick 3942 \noindent In order to fully test the installation using the unit tests you also
40 caltinay 3599 need\footnote{On Debian and Ubuntu this is packaged as \file{libcppunit-dev}}:
41     \begin{itemize}
42     \item \file{cppunit}
43     \end{itemize}
44 jfenwick 3942 However, a large number of tests will work without it.
45 jfenwick 2602
46 jfenwick 3335 \subsection{Preliminaries}
47     \label{sec:prelim}
48 jfenwick 2317 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 jfenwick 3322 For additional visualization functionality see Section~\ref{sec:addfunc}.
51 jfenwick 2317
52 caltinay 2536 These instructions will produce the following directory structure:
53 jfenwick 2317 \begin{itemize}
54 jfenwick 3322 \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 caltinay 2536 \end{itemize}
61 jfenwick 2317 \end{itemize}
62    
63 jfenwick 3322 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 caltinay 2536 If you download your own versions of those packages substitute their version numbers and names as appropriate.
66 jfenwick 3322 There are a number of uses of the \file{make} command in the following instructions.
67 caltinay 2536 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 jfenwick 2317 \begin{shellCode}
70 jfenwick 3335 make
71 jfenwick 2529 \end{shellCode}
72 caltinay 2536 becomes
73 jfenwick 2529 \begin{shellCode}
74 jfenwick 3335 make -j 4
75 jfenwick 2529 \end{shellCode}
76    
77     \begin{shellCode}
78 jfenwick 2317 mkdir stand
79     cd stand
80 caltinay 2536 mkdir build doc pkg pkg_src
81 jfenwick 2529 export PKG_ROOT=$(pwd)/pkg
82 jfenwick 2317 \end{shellCode}
83    
84 caltinay 2536 \subsection{Building the dependencies}
85    
86 jfenwick 3322 Copy the compressed sources for the packages into \file{stand/pkg_src}.
87 caltinay 2536 If you are using the support bundles, decompress them in the stand directory:
88 jfenwick 2529 \begin{shellCode}
89     tar -xjf escript-support-3-src.tar.bz2
90     \end{shellCode}
91    
92 jfenwick 3322 Copy documentation files into \file{doc} then unpack the archives:
93 jfenwick 2317
94     \begin{shellCode}
95     cd build
96 jfenwick 2568 tar -jxf ../pkg_src/Python-2.6.2.tar.bz2
97 jfenwick 2529 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 jfenwick 2317 \end{shellCode}
103    
104 caltinay 2536 \begin{itemize}
105    
106     \item Build Python:
107 jfenwick 2317 \begin{shellCode}
108     cd Python*
109 jfenwick 2568 ./configure --prefix=$PKG_ROOT/python-2.6.2 --enable-shared 2>&1 \
110 jfenwick 2317 | tee tt.configure.out
111 jfenwick 2568 make
112 jfenwick 2317 make install 2>&1 | tee tt.make.out
113    
114     cd ..
115    
116 artak 2328 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 jfenwick 2317
120 jfenwick 2529 pushd ../pkg
121 jfenwick 2568 ln -s python-2.6.2/ python
122 jfenwick 2317 popd
123     \end{shellCode}
124    
125 caltinay 2536 Run the new python executable to make sure it works.
126 jfenwick 2317
127 caltinay 2536 \item Now build NumPy:
128 jfenwick 2317 \begin{shellCode}
129 jfenwick 2462 cd numpy-1.3.0
130     python setup.py build
131     python setup.py install --prefix $PKG_ROOT/numpy-1.3.0
132 jfenwick 2317 cd ..
133 jfenwick 2529 pushd ../pkg
134 jfenwick 2462 ln -s numpy-1.3.0 numpy
135 jfenwick 2317 popd
136 jfenwick 2462 export PYTHONPATH=$PKG_ROOT/numpy/lib/python2.6/site-packages:$PYTHONPATH
137 jfenwick 2317 \end{shellCode}
138    
139 jfenwick 2462 % \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 jfenwick 2529 % pushd ../pkg
151 jfenwick 2462 % ln -s numarray-1.5.2 numarray
152     % popd
153     % \end{shellCode}
154    
155 caltinay 2536 \item Next build scons:
156 jfenwick 2317 \begin{shellCode}
157     cd scons-1.2.0
158 artak 2328 python setup.py install --prefix=$PKG_ROOT/scons-1.2.0
159 jfenwick 2317
160 artak 2328 export PATH=$PKG_ROOT/scons/bin:$PATH
161 jfenwick 2317 cd ..
162 jfenwick 2529 pushd ../pkg
163 jfenwick 2317 ln -s scons-1.2.0 scons
164     popd
165     \end{shellCode}
166    
167 caltinay 2536 \item The Boost libraries...:
168 jfenwick 2317 \begin{shellCode}
169 jfenwick 2529 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 caltinay 2536 ./bjam
176 jfenwick 2529 ./bjam install --prefix=$PKG_ROOT/boost --libdir=$PKG_ROOT/boost/lib
177 artak 2328 export LD_LIBRARY_PATH=$PKG_ROOT/boost/lib:$LD_LIBRARY_PATH
178 jfenwick 2317 cd ..
179 jfenwick 2529 pushd ../pkg/boost/lib/
180     ln *.so.* libboost_python.so
181 jfenwick 2317 popd
182     \end{shellCode}
183    
184 caltinay 3265 \item ...and netCDF:
185 jfenwick 2317 \begin{shellCode}
186     cd netcdf-4.0
187 jfenwick 2462 CFLAGS="-O2 -fPIC -Df2cFortran" CXXFLAGS="-O2 -fPIC -Df2cFortran" \
188     FFLAGS="-O2 -fPIC -Df2cFortran" FCFLAGS="-O2 -fPIC -Df2cFortran" \
189 artak 2328 ./configure --prefix=$PKG_ROOT/netcdf-4.0
190 jfenwick 2317
191 jfenwick 2529 make
192 jfenwick 2317 make install
193    
194 artak 2328 export LD_LIBRARY_PATH=$PKG_ROOT/netcdf/lib:$LD_LIBRARY_PATH
195 jfenwick 2317 cd ..
196 jfenwick 2529 pushd ../pkg
197 jfenwick 2317 ln -s netcdf-4.0 netcdf
198     popd
199     \end{shellCode}
200    
201 caltinay 2536 \item Finally matplotlib:
202 jfenwick 2529 \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 caltinay 2536 \end{itemize}
214    
215 jfenwick 2568 % \subsection{VTK support}
216     % VTK is only required for pyvisi. To build it you need CMake and Mesa.
217 jfenwick 3322 % The packages can be downloaded independently or in the \file{escript-support-visi-3-src}.
218 jfenwick 2568 % If you will not be using pyvisi, then skip to \Sec{sec:compileescriptlinux}
219     %
220 jfenwick 3322 % Copy the compressed sources for the packages into \file{stand/pkg_src}.
221 jfenwick 2568 % 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 jfenwick 3322 % Now edit the \file{CMakeCache.txt} file and make the following changes.
274 jfenwick 2568 % Where .... appears please replace it with the absolute path to the pkg directory.
275 jfenwick 3322 % 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 jfenwick 2568 % (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 jfenwick 3322 % Edit \file{CMakeCache.txt} and change the following variables:
296 jfenwick 2568 %
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 jfenwick 2529
322 jfenwick 2324 \subsection{Compiling escript}\label{sec:compileescriptlinux}
323    
324 jfenwick 3322 Change to the directory containing your escript source (\file{stand/escript.d}), then:
325 jfenwick 2324
326 jfenwick 2317 \begin{shellCode}
327 jfenwick 2529 cd escript.d/scons
328 jfenwick 3335 cp TEMPLATE_linux.py YourMachineName_options.py
329 jfenwick 2317
330 jfenwick 2529 echo $PKG_ROOT
331     \end{shellCode}
332 jfenwick 2602 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 jfenwick 3322 For example the options file for \texttt{bob-desktop} would be named \file{bob_desktop_options.py}.
335 jfenwick 3335 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 jfenwick 2317
337    
338 jfenwick 3335 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 jfenwick 2529 \begin{shellCode}
376     cd ../bin
377     \end{shellCode}
378 jfenwick 2317
379 jfenwick 3322 Modify the STANDALONE line of \file{run-escript} to read:
380 jfenwick 2529
381 jfenwick 2317 STANDALONE=1
382    
383 jfenwick 3322 Start a new terminal and go to the \file{stand} directory.
384 jfenwick 2317
385 jfenwick 2529 \begin{shellCode}
386     export PATH=$(pwd)/pkg/scons/bin:$PATH
387 jfenwick 2317 cd escript.d
388 jfenwick 2923 eval $(bin/run-escript -e)
389 jfenwick 2317 scons
390     \end{shellCode}
391    
392     If you wish to test your build, then you can do the following.
393 caltinay 2536 Note this may take a while if you have a slow processor and/or less than 1GB of RAM.
394 jfenwick 2317 \begin{shellCode}
395 jfenwick 3942 scons py_tests
396 jfenwick 2317 \end{shellCode}
397 jfenwick 3942 (If you have cppunit installed you can run additional tests using \texttt{scons all_tests}.
398 jfenwick 2317
399 jfenwick 2324 \subsection{Cleaning up}
400 jfenwick 3335 Once you are satisfied, the \file{escript.d/build} and \file{stand/build} directories can be removed.
401 jfenwick 2317
402 caltinay 2536 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 jfenwick 2317 \begin{itemize}
404 jfenwick 3322 \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 jfenwick 2324 \item Hidden files, which can be removed using
408 jfenwick 2317 \begin{shellCode}
409 jfenwick 2602 find . -name '.?*' | xargs rm -rf
410 jfenwick 2317 \end{shellCode}
411 jfenwick 3322 in the \file{escript.d} directory.
412 jfenwick 2324 \end{itemize}
413 jfenwick 3322 \item from the \file{pkg} directory:
414 jfenwick 2324 \begin{itemize}
415 jfenwick 3335 \item \file{scons}, \file{scons-1.2.0}
416 jfenwick 2324 \end{itemize}
417 jfenwick 3322 \item \file{package\_src}\footnote{Do not remove this if you intend to redistribute.}.
418 jfenwick 2324 \end{itemize}
419 jfenwick 2317
420 jfenwick 2324 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