/[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 2923 - (hide annotations)
Thu Feb 4 04:05:36 2010 UTC (9 years, 2 months ago) by jfenwick
Original Path: trunk/doc/install/srclinux.tex
File MIME type: application/x-tex
File size: 11066 byte(s)
Bringing non-release specific things from stage3.1 r2922 back to trunk

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

  ViewVC Help
Powered by ViewVC 1.1.26