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

  ViewVC Help
Powered by ViewVC 1.1.26