/[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 2536 - (hide 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 jfenwick 2289
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 jfenwick 2317 \label{sec:srclinux}
16 caltinay 2536
17     \subsection{Preliminaries}
18    
19 jfenwick 2317 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 caltinay 2536 \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 jfenwick 2317 \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 caltinay 2536 These instructions will produce the following directory structure:
36 jfenwick 2317 \begin{itemize}
37 caltinay 2536 \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 jfenwick 2317 \end{itemize}
45    
46 caltinay 2536 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 jfenwick 2529 There are a number of uses of the \filename{make} command in the following instructions.
50 caltinay 2536 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 jfenwick 2317 \begin{shellCode}
53 jfenwick 2529 make
54     \end{shellCode}
55 caltinay 2536 becomes
56 jfenwick 2529 \begin{shellCode}
57     make -j 4
58     \end{shellCode}
59    
60     \begin{shellCode}
61 jfenwick 2317 mkdir stand
62     cd stand
63 caltinay 2536 mkdir build doc pkg pkg_src
64 jfenwick 2529 export PKG_ROOT=$(pwd)/pkg
65 jfenwick 2317 \end{shellCode}
66    
67 caltinay 2536 \subsection{Building the dependencies}
68    
69 jfenwick 2529 Copy the compressed sources for the packages into \filename{stand/pkg_src}.
70 caltinay 2536 If you are using the support bundles, decompress them in the stand directory:
71 jfenwick 2529 \begin{shellCode}
72     tar -xjf escript-support-3-src.tar.bz2
73     \end{shellCode}
74    
75 caltinay 2536 Copy documentation files into \filename{doc} then unpack the archives:
76 jfenwick 2317
77     \begin{shellCode}
78     cd build
79 jfenwick 2529 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 jfenwick 2317 \end{shellCode}
86    
87 caltinay 2536 \begin{itemize}
88    
89     \item Build Python:
90 jfenwick 2317 \begin{shellCode}
91     cd Python*
92 artak 2328 ./configure --prefix=$PKG_ROOT/python-2.6.1 --enable-shared 2>&1 \
93 jfenwick 2317 | tee tt.configure.out
94     make install 2>&1 | tee tt.make.out
95    
96     cd ..
97    
98 artak 2328 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 jfenwick 2317
102 jfenwick 2529 pushd ../pkg
103 jfenwick 2317 ln -s python-2.6.1/ python
104     popd
105     \end{shellCode}
106    
107 caltinay 2536 Run the new python executable to make sure it works.
108 jfenwick 2317
109 caltinay 2536 \item Now build NumPy:
110 jfenwick 2317 \begin{shellCode}
111 jfenwick 2462 cd numpy-1.3.0
112     python setup.py build
113     python setup.py install --prefix $PKG_ROOT/numpy-1.3.0
114 jfenwick 2317 cd ..
115 jfenwick 2529 pushd ../pkg
116 jfenwick 2462 ln -s numpy-1.3.0 numpy
117 jfenwick 2317 popd
118 jfenwick 2462 export PYTHONPATH=$PKG_ROOT/numpy/lib/python2.6/site-packages:$PYTHONPATH
119 jfenwick 2317 \end{shellCode}
120    
121 jfenwick 2462 % \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 jfenwick 2529 % pushd ../pkg
133 jfenwick 2462 % ln -s numarray-1.5.2 numarray
134     % popd
135     % \end{shellCode}
136    
137 caltinay 2536 \item Next build scons:
138 jfenwick 2317 \begin{shellCode}
139     cd scons-1.2.0
140 artak 2328 python setup.py install --prefix=$PKG_ROOT/scons-1.2.0
141 jfenwick 2317
142 artak 2328 export PATH=$PKG_ROOT/scons/bin:$PATH
143 jfenwick 2317 cd ..
144 jfenwick 2529 pushd ../pkg
145 jfenwick 2317 ln -s scons-1.2.0 scons
146     popd
147     \end{shellCode}
148    
149 caltinay 2536 \item The Boost libraries...:
150 jfenwick 2317 \begin{shellCode}
151 jfenwick 2529 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 caltinay 2536 ./bjam
158 jfenwick 2529 ./bjam install --prefix=$PKG_ROOT/boost --libdir=$PKG_ROOT/boost/lib
159 artak 2328 export LD_LIBRARY_PATH=$PKG_ROOT/boost/lib:$LD_LIBRARY_PATH
160 jfenwick 2317 cd ..
161 jfenwick 2529 pushd ../pkg/boost/lib/
162     ln *.so.* libboost_python.so
163 jfenwick 2317 popd
164     \end{shellCode}
165    
166 caltinay 2536 \item ...and NetCDF:
167 jfenwick 2317 \begin{shellCode}
168     cd netcdf-4.0
169 jfenwick 2462 CFLAGS="-O2 -fPIC -Df2cFortran" CXXFLAGS="-O2 -fPIC -Df2cFortran" \
170     FFLAGS="-O2 -fPIC -Df2cFortran" FCFLAGS="-O2 -fPIC -Df2cFortran" \
171 artak 2328 ./configure --prefix=$PKG_ROOT/netcdf-4.0
172 jfenwick 2317
173 jfenwick 2529 make
174 jfenwick 2317 make install
175    
176 artak 2328 export LD_LIBRARY_PATH=$PKG_ROOT/netcdf/lib:$LD_LIBRARY_PATH
177 jfenwick 2317 cd ..
178 jfenwick 2529 pushd ../pkg
179 jfenwick 2317 ln -s netcdf-4.0 netcdf
180     popd
181     \end{shellCode}
182    
183 caltinay 2536 \item Finally matplotlib:
184 jfenwick 2529 \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 caltinay 2536 \end{itemize}
196    
197 jfenwick 2529 \subsection{VTK support}
198 caltinay 2536 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 jfenwick 2529
202     Copy the compressed sources for the packages into \filename{stand/pkg_src}.
203 caltinay 2536 If you are using the support bundles, decompress them in the stand directory.
204 jfenwick 2529 \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 caltinay 2536 \begin{itemize}
217    
218     \item Build CMake:
219 jfenwick 2317 \begin{shellCode}
220     cd cmake-2.6.3
221 artak 2328 ./configure --prefix=$PKG_ROOT/cmake-2.6.3 2>&1 | tee tt.configure
222 jfenwick 2529 make
223 jfenwick 2317 make install
224    
225 artak 2328 export PATH=$PKG_ROOT/cmake/bin:$PATH
226 jfenwick 2317 cd ..
227 jfenwick 2529 pushd ../pkg
228 jfenwick 2317 ln -s cmake-2.6.3 cmake
229     popd
230     \end{shellCode}
231    
232 caltinay 2536 \item Build Mesa:
233 jfenwick 2317 \begin{shellCode}
234     cd Mesa-7.2
235 artak 2328 ./configure --prefix=$PKG_ROOT/mesa-7.2 --enable-gl-osmesa --with-driver=xlib
236 jfenwick 2317
237 jfenwick 2529 make
238 jfenwick 2317 make install
239    
240 jfenwick 2529 export LD_LIBRARY_PATH=$PKG_ROOT/mesa/lib:$LD_LIBRARY_PATH
241 jfenwick 2317 cd ..
242 jfenwick 2529 pushd ../pkg
243 jfenwick 2317 ln -s mesa-7.2 mesa
244     popd
245     \end{shellCode}
246 caltinay 2536 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 jfenwick 2317
249 caltinay 2536 \item Finally, build VTK:
250 jfenwick 2317 \begin{shellCode}
251     cd VTK
252     cmake .
253 jfenwick 2529 \end{shellCode}
254 jfenwick 2317
255 jfenwick 2529 Now edit the \filename{CMakeCache.txt} file and make the following changes.
256 caltinay 2536 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 jfenwick 2529 \begin{shellCode}
261 jfenwick 2466 BUILD_EXAMPLES:BOOL=OFF
262     BUILD_SHARED_LIBS:BOOL=ON
263 jfenwick 2529 CMAKE_INSTALL_PREFIX:PATH=..../vtk-5.2.1
264 jfenwick 2466 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 jfenwick 2529 \end{shellCode}
270 jfenwick 2317
271 jfenwick 2529 Now rerun cmake (it won't work but it adds some variables you need).
272 jfenwick 2317
273 jfenwick 2529 \begin{shellCode}
274 jfenwick 2317 cmake .
275 jfenwick 2529 \end{shellCode}
276 jfenwick 2317
277 caltinay 2536 Edit \filename{CMakeCache.txt} and change the following variables:
278 jfenwick 2317
279 jfenwick 2529 \begin{shellCode}
280     VTK_USE_OFFSCREEN:BOOL=ON
281 jfenwick 2466 VTK_USE_TK:BOOL=OFF
282 jfenwick 2529 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 jfenwick 2317
290 caltinay 2536 The following steps will take a while so grab a coffee while it compiles.
291 jfenwick 2529 \begin{shellCode}
292 jfenwick 2317 cmake .
293 jfenwick 2529 make
294 jfenwick 2455 chmod +w Utilities/vtktiff/tif_fax3sm.c
295 jfenwick 2317 make install
296    
297 jfenwick 2529 cd ../../pkg
298 jfenwick 2317 ln -s vtk-5.2.1 vtk
299     cd ..
300     \end{shellCode}
301    
302 caltinay 2536 \end{itemize}
303 jfenwick 2529
304 jfenwick 2324 \subsection{Compiling escript}\label{sec:compileescriptlinux}
305    
306     Change to the directory containing your escript source (\filename{escript.d}), then:
307    
308 jfenwick 2317 \begin{shellCode}
309 jfenwick 2529 cd escript.d/scons
310 jfenwick 2317 cp linux_options_example.py YourMachineName_options.py
311    
312 jfenwick 2529 echo $PKG_ROOT
313     \end{shellCode}
314 jfenwick 2317
315 caltinay 2536 Edit the options file and put the value of PKG_ROOT between the quotes in the PKG_ROOT= line.
316 jfenwick 2529 For example:
317     \begin{shellCode}
318     PKG_ROOT="/home/bob/stand/pkg"
319     \end{shellCode}
320 jfenwick 2317
321 jfenwick 2529 \begin{shellCode}
322     cd ../bin
323     \end{shellCode}
324 jfenwick 2317
325 caltinay 2536 Modify the STANDALONE line of \filename{escript} to read:
326 jfenwick 2529
327 jfenwick 2317 STANDALONE=1
328    
329 jfenwick 2529 Start a new terminal and go to the \filename{stand} directory.
330 jfenwick 2317
331 jfenwick 2529 \begin{shellCode}
332     export PATH=$(pwd)/pkg/scons/bin:$PATH
333 jfenwick 2317 cd escript.d
334 jfenwick 2462 eval $(bin/escript -e)
335 jfenwick 2317 scons
336     \end{shellCode}
337    
338     If you wish to test your build, then you can do the following.
339 caltinay 2536 Note this may take a while if you have a slow processor and/or less than 1GB of RAM.
340 jfenwick 2317 \begin{shellCode}
341     scons all_tests
342     \end{shellCode}
343    
344 jfenwick 2324 \subsection{Cleaning up}
345     Once you are satisfied, the \filename{escript.d/build} and \filename{\$PKG_ROOT/build} directories can be removed.
346 jfenwick 2317
347 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:
348 jfenwick 2317 \begin{itemize}
349 jfenwick 2324 \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 jfenwick 2317 \begin{shellCode}
354     find . -name .?* | xargs rm -rf
355     \end{shellCode}
356 jfenwick 2324 in the \filename{escript.d} directory.
357     \end{itemize}
358 jfenwick 2529 \item from the \filename{pkg} directory:
359 jfenwick 2324 \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 jfenwick 2317
365 jfenwick 2324 Please note that removing all these files may make it more difficult for us to diagnose problems.
366    
367    
368 jfenwick 2317 \section{Additional Functionality}\label{sec:linaddfunc}
369     To perform visualisations you will need some additional tools.
370 caltinay 2536 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 jfenwick 2317 \begin{itemize}
372 caltinay 2536 \item \filename{ppmtompeg} and \filename{jpegtopnm} from the \filename{netpbm} suite - to build from source
373 jfenwick 2317 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 jfenwick 2529 \end{itemize}
376 caltinay 2536

  ViewVC Help
Powered by ViewVC 1.1.26