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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6651 - (show annotations)
Wed Feb 7 02:12:08 2018 UTC (15 months, 1 week ago) by jfenwick
File MIME type: application/x-tex
File size: 9135 byte(s)
Make everyone sad by touching all the files

Copyright dates update

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

  ViewVC Help
Powered by ViewVC 1.1.26