/[escript]/trunk/doc/install/srclinux.tex
ViewVC logotype

Contents of /trunk/doc/install/srclinux.tex

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4406 - (show annotations)
Tue May 14 02:54:09 2013 UTC (6 years, 4 months ago) by caltinay
File MIME type: application/x-tex
File size: 9073 byte(s)
Removed references to pyvisi which disappeared a few releases ago...

1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 % Copyright (c) 2003-2013 by University of Queensland
3 % http://www.uq.edu.au
4 %
5 % Primary Business: Queensland, Australia
6 % Licensed under the Open Software License version 3.0
7 % http://www.opensource.org/licenses/osl-3.0.php
8 %
9 % Development until 2012 by Earth Systems Science Computational Center (ESSCC)
10 % Development since 2012 by School of Earth Sciences
11 %
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
14 \section{Installing from source for \linux}
15 \label{sec:srclinux}
16
17 \subsection{Dependencies}
18
19 The following instructions assume you are running the \file{bash} shell.
20 Comments are indicated with \# characters.
21 Make sure you have the following installed:
22 \begin{itemize}
23 \item \file{g++} and associated tools.
24 \item \file{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 \file{libXext.so}\footnote{In Debian this is in the libXext-dev package.}
27 % \item \file{libxt.so}\footnote{In Debian this is in the libxt-dev package.}
28 \end{itemize}
29
30 \noindent To compile matplotlib you will also need the following\footnote{For
31 Debian and Ubuntu users, installing \file{libfreetype6-dev} and
32 \file{libpng-dev} will be sufficient.} (if your distribution separates
33 development files, make sure to get the development packages):
34 \begin{itemize}
35 \item \file{freetype2}
36 \item \file{zlib}
37 \item \file{libpng}
38 \end{itemize}
39
40 \noindent In order to fully test the installation using the unit tests you also
41 need\footnote{On Debian and Ubuntu this is packaged as \file{libcppunit-dev}}:
42 \begin{itemize}
43 \item \file{cppunit}
44 \end{itemize}
45 However, a large number of tests will work without it.
46
47 \subsection{Preliminaries}
48 \label{sec:prelim}
49 You will also need a copy of the \esfinley source code.
50 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.
51 For additional visualization functionality see Section~\ref{sec:addfunc}.
52
53 These instructions will produce the following directory structure:
54 \begin{itemize}
55 \item[] \file{stand} \begin{itemize}
56 \item[] \file{escript.d}
57 \item[] \file{pkg}
58 \item[] \file{pkg_src}
59 \item[] \file{build}
60 \item[] \file{doc}
61 \end{itemize}
62 \end{itemize}
63
64 Before you start copy the \esfinley source into the \file{escript.d} directory.
65 The following instructions refer to software versions in the \file{escript-support-3-src} bundle.
66 If you download your own versions of those packages substitute their version numbers and names as appropriate.
67 There are a number of uses of the \file{make} command in the following instructions.
68 If your computer has multiple cores/processors you can speed up the compilation process by adding -j 2 after the make command.
69 For example to use all processors on a computer with 4 cores:
70 \begin{shellCode}
71 make
72 \end{shellCode}
73 becomes
74 \begin{shellCode}
75 make -j 4
76 \end{shellCode}
77
78 \begin{shellCode}
79 mkdir stand
80 cd stand
81 mkdir build doc pkg pkg_src
82 export PKG_ROOT=$(pwd)/pkg
83 \end{shellCode}
84
85 \subsection{Building the dependencies}
86
87 Copy the compressed sources for the packages into \file{stand/pkg_src}.
88 If you are using the support bundles, decompress them in the stand directory:
89 \begin{shellCode}
90 tar -xjf escript-support-3-src.tar.bz2
91 \end{shellCode}
92
93 Copy documentation files into \file{doc} then unpack the archives:
94
95 \begin{shellCode}
96 cd build
97 tar -jxf ../pkg_src/Python-2.6.2.tar.bz2
98 tar -jxf ../pkg_src/boost_1_39_0.tar.bz2
99 tar -zxf ../pkg_src/scons-1.2.0.tar.gz
100 tar -zxf ../pkg_src/numpy-1.3.0.tar.gz
101 tar -zxf ../pkg_src/netcdf-4.0.tar.gz
102 tar -zxf ../pkg_src/matplotlib-0.98.5.3.tar.gz
103 \end{shellCode}
104
105 \begin{itemize}
106
107 \item Build Python:
108 \begin{shellCode}
109 cd Python*
110 ./configure --prefix=$PKG_ROOT/python-2.6.2 --enable-shared 2>&1 \
111 | tee tt.configure.out
112 make
113 make install 2>&1 | tee tt.make.out
114
115 cd ..
116
117 export PATH=$PKG_ROOT/python/bin:$PATH
118 export PYTHONHOME=$PKG_ROOT/python
119 export LD_LIBRARY_PATH=$PKG_ROOT/python/lib:$LD_LIBRARY_PATH
120
121 pushd ../pkg
122 ln -s python-2.6.2/ python
123 popd
124 \end{shellCode}
125
126 Run the new python executable to make sure it works.
127
128 \item Now build NumPy:
129 \begin{shellCode}
130 cd numpy-1.3.0
131 python setup.py build
132 python setup.py install --prefix $PKG_ROOT/numpy-1.3.0
133 cd ..
134 pushd ../pkg
135 ln -s numpy-1.3.0 numpy
136 popd
137 export PYTHONPATH=$PKG_ROOT/numpy/lib/python2.6/site-packages:$PYTHONPATH
138 \end{shellCode}
139
140 % \begin{shellCode}
141 % cd numarray-1.5.2
142 %
143 % python setup.py install \
144 % --gencode --install-lib=$PKG_ROOT/numarray-1.5.2/lib \
145 % --install-headers=$PKG_ROOT=$PKG_ROOT/numarray-1.5.2/include/numarray \
146 % 2>&1 | tee tt.install.out
147 %
148 %
149 % export PYTHONPATH=$PKG_ROOT/numarray/lib:$PYTHONPATH
150 % cd ..
151 % pushd ../pkg
152 % ln -s numarray-1.5.2 numarray
153 % popd
154 % \end{shellCode}
155
156 \item Next build scons:
157 \begin{shellCode}
158 cd scons-1.2.0
159 python setup.py install --prefix=$PKG_ROOT/scons-1.2.0
160
161 export PATH=$PKG_ROOT/scons/bin:$PATH
162 cd ..
163 pushd ../pkg
164 ln -s scons-1.2.0 scons
165 popd
166 \end{shellCode}
167
168 \item The Boost libraries...:
169 \begin{shellCode}
170 pushd ../pkg
171 mkdir boost_1_39_0
172 ln -s boost_1_39_0 boost
173 popd
174 cd boost_1_39_0
175 ./bootstrap.sh --with-libraries=python --prefix=$PKG_ROOT/boost
176 ./bjam
177 ./bjam install --prefix=$PKG_ROOT/boost --libdir=$PKG_ROOT/boost/lib
178 export LD_LIBRARY_PATH=$PKG_ROOT/boost/lib:$LD_LIBRARY_PATH
179 cd ..
180 pushd ../pkg/boost/lib/
181 ln *.so.* libboost_python.so
182 popd
183 \end{shellCode}
184
185 \item ...and netCDF:
186 \begin{shellCode}
187 cd netcdf-4.0
188 CFLAGS="-O2 -fPIC -Df2cFortran" CXXFLAGS="-O2 -fPIC -Df2cFortran" \
189 FFLAGS="-O2 -fPIC -Df2cFortran" FCFLAGS="-O2 -fPIC -Df2cFortran" \
190 ./configure --prefix=$PKG_ROOT/netcdf-4.0
191
192 make
193 make install
194
195 export LD_LIBRARY_PATH=$PKG_ROOT/netcdf/lib:$LD_LIBRARY_PATH
196 cd ..
197 pushd ../pkg
198 ln -s netcdf-4.0 netcdf
199 popd
200 \end{shellCode}
201
202 \item Finally matplotlib:
203 \begin{shellCode}
204 cd matplotlib-0.98.5.3
205 python setup.py build
206 python setup.py install --prefix=$PKG_ROOT/matplotlib-0.98.5.3
207 cd ..
208 pushd ../pkg
209 ln -s matplotlib-0.98.5.3 matplotlib
210 popd
211 cd ..
212 \end{shellCode}
213
214 \end{itemize}
215
216 \subsection{Compiling escript}\label{sec:compileescriptlinux}
217
218 Change to the directory containing your escript source (\file{stand/escript.d}), then:
219
220 \begin{shellCode}
221 cd escript.d/scons
222 cp TEMPLATE_linux.py YourMachineName_options.py
223
224 echo $PKG_ROOT
225 \end{shellCode}
226 Where \texttt{YourMachineName} is the name of your computer as returned by the hostname command.
227 If the name contains non-alphanumeric characters, then you will need to replace them with underscores.
228 For example the options file for \texttt{bob-desktop} would be named \file{bob_desktop_options.py}.
229 If you wish to build with OpenMP, MPI or configure other aspects of the system take a quick look at Section~\ref{sec:compilesrc}.
230
231
232 You will need to edit your options file and specify where to find boost and netcdf.
233 (replace \file{x/stand} with the path to \file{stand})
234
235 \begin{python}
236 #boost_prefix = '/usr/local'
237 \end{python}
238
239 should be
240 \begin{python}
241 boost_prefix = ['x/stand/pkg/boost/include/boost-1_39/', 'x/stand/pkg/boost/lib/']
242 \end{python}
243
244 \begin{python}
245 #netcdf = True
246 \end{python}
247
248 should be
249 \begin{python}
250 netcdf = True
251 \end{python}
252
253 \begin{python}
254 #netcdf_prefix = '/usr/local'
255 \end{python}
256
257 should be \begin{python}
258 netcdf_prefix = ['x/stand/pkg/netcdf/include/',
259 'x/stand/pkg/netcdf/lib/']
260 \end{python}
261
262 %
263 % Edit the options file and put the value of PKG_ROOT between the quotes in the PKG_ROOT= line.
264 % For example:
265 % \begin{shellCode}
266 % PKG_ROOT="/home/bob/stand/pkg"
267 % \end{shellCode}
268
269 \begin{shellCode}
270 cd ../bin
271 \end{shellCode}
272
273 Modify the STANDALONE line of \file{run-escript} to read:
274
275 STANDALONE=1
276
277 Start a new terminal and go to the \file{stand} directory.
278
279 \begin{shellCode}
280 export PATH=$(pwd)/pkg/scons/bin:$PATH
281 cd escript.d
282 eval $(bin/run-escript -e)
283 scons
284 \end{shellCode}
285
286 If you wish to test your build, then you can do the following.
287 Note this may take a while if you have a slow processor and/or less than 1GB of RAM.
288 \begin{shellCode}
289 scons py_tests
290 \end{shellCode}
291 (If you have cppunit installed you can run additional tests using \texttt{scons all_tests}.
292
293 \subsection{Cleaning up}
294 Once you are satisfied, the \file{escript.d/build} and \file{stand/build} directories can be removed.
295
296 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:
297 \begin{itemize}
298 \item From the \file{escript.d} directory:\begin{itemize}
299 \item Everything except: \file{bin}, \file{include}, \file{lib}, \file{esys},
300 \file{README_LICENSE}.
301 \item Hidden files, which can be removed using
302 \begin{shellCode}
303 find . -name '.?*' | xargs rm -rf
304 \end{shellCode}
305 in the \file{escript.d} directory.
306 \end{itemize}
307 \item from the \file{pkg} directory:
308 \begin{itemize}
309 \item \file{scons}, \file{scons-1.2.0}
310 \end{itemize}
311 \item \file{package\_src}\footnote{Do not remove this if you intend to redistribute.}.
312 \end{itemize}
313
314 Please note that removing all these files may make it more difficult for us to diagnose problems.
315
316

  ViewVC Help
Powered by ViewVC 1.1.26