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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6651 - (hide annotations)
Wed Feb 7 02:12:08 2018 UTC (19 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 jfenwick 3989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 jfenwick 6651 % Copyright (c) 2003-2018 by The University of Queensland
3 jfenwick 3989 % http://www.uq.edu.au
4 jfenwick 2289 %
5     % Primary Business: Queensland, Australia
6 jfenwick 6112 % Licensed under the Apache License, version 2.0
7     % http://www.apache.org/licenses/LICENSE-2.0
8 jfenwick 2289 %
9 jfenwick 3989 % Development until 2012 by Earth Systems Science Computational Center (ESSCC)
10 jfenwick 4657 % Development 2012-2013 by School of Earth Sciences
11     % Development from 2014 by Centre for Geoscience Computing (GeoComp)
12 jfenwick 3989 %
13     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 jfenwick 2289
15     \section{Installing from source for \linux}
16 jfenwick 2317 \label{sec:srclinux}
17 caltinay 2536
18 jfenwick 3335 \subsection{Dependencies}
19 caltinay 2536
20 jfenwick 3322 The following instructions assume you are running the \file{bash} shell.
21 jfenwick 2317 Comments are indicated with \# characters.
22     Make sure you have the following installed:
23     \begin{itemize}
24 jfenwick 3322 \item \file{g++} and associated tools.
25     \item \file{make}
26 caltinay 2536 % I suspect that these are only needed by VTK and if we aren't using it anymore they could be removed
27 jfenwick 3322 % \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 jfenwick 2317 \end{itemize}
30    
31 caltinay 3599 \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 jfenwick 2602 \begin{itemize}
36 jfenwick 3322 \item \file{freetype2}
37 caltinay 3599 \item \file{zlib}
38     \item \file{libpng}
39 jfenwick 2602 \end{itemize}
40    
41 jfenwick 3942 \noindent In order to fully test the installation using the unit tests you also
42 caltinay 3599 need\footnote{On Debian and Ubuntu this is packaged as \file{libcppunit-dev}}:
43     \begin{itemize}
44     \item \file{cppunit}
45     \end{itemize}
46 jfenwick 3942 However, a large number of tests will work without it.
47 jfenwick 2602
48 jfenwick 3335 \subsection{Preliminaries}
49     \label{sec:prelim}
50 jfenwick 2317 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 jfenwick 3322 For additional visualization functionality see Section~\ref{sec:addfunc}.
53 jfenwick 2317
54 caltinay 2536 These instructions will produce the following directory structure:
55 jfenwick 2317 \begin{itemize}
56 jfenwick 3322 \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 caltinay 2536 \end{itemize}
63 jfenwick 2317 \end{itemize}
64    
65 jfenwick 3322 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 caltinay 2536 If you download your own versions of those packages substitute their version numbers and names as appropriate.
68 jfenwick 3322 There are a number of uses of the \file{make} command in the following instructions.
69 caltinay 2536 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 jfenwick 2317 \begin{shellCode}
72 jfenwick 3335 make
73 jfenwick 2529 \end{shellCode}
74 caltinay 2536 becomes
75 jfenwick 2529 \begin{shellCode}
76 jfenwick 3335 make -j 4
77 jfenwick 2529 \end{shellCode}
78    
79     \begin{shellCode}
80 jfenwick 2317 mkdir stand
81     cd stand
82 caltinay 2536 mkdir build doc pkg pkg_src
83 jfenwick 2529 export PKG_ROOT=$(pwd)/pkg
84 jfenwick 2317 \end{shellCode}
85    
86 caltinay 2536 \subsection{Building the dependencies}
87    
88 jfenwick 3322 Copy the compressed sources for the packages into \file{stand/pkg_src}.
89 caltinay 2536 If you are using the support bundles, decompress them in the stand directory:
90 jfenwick 2529 \begin{shellCode}
91     tar -xjf escript-support-3-src.tar.bz2
92     \end{shellCode}
93    
94 jfenwick 3322 Copy documentation files into \file{doc} then unpack the archives:
95 jfenwick 2317
96     \begin{shellCode}
97     cd build
98 jfenwick 2568 tar -jxf ../pkg_src/Python-2.6.2.tar.bz2
99 jfenwick 2529 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 jfenwick 2317 \end{shellCode}
105    
106 caltinay 2536 \begin{itemize}
107    
108     \item Build Python:
109 jfenwick 2317 \begin{shellCode}
110     cd Python*
111 jfenwick 2568 ./configure --prefix=$PKG_ROOT/python-2.6.2 --enable-shared 2>&1 \
112 jfenwick 2317 | tee tt.configure.out
113 jfenwick 2568 make
114 jfenwick 2317 make install 2>&1 | tee tt.make.out
115    
116     cd ..
117    
118 artak 2328 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 jfenwick 2317
122 jfenwick 2529 pushd ../pkg
123 jfenwick 2568 ln -s python-2.6.2/ python
124 jfenwick 2317 popd
125     \end{shellCode}
126    
127 caltinay 2536 Run the new python executable to make sure it works.
128 jfenwick 2317
129 caltinay 2536 \item Now build NumPy:
130 jfenwick 2317 \begin{shellCode}
131 jfenwick 2462 cd numpy-1.3.0
132     python setup.py build
133     python setup.py install --prefix $PKG_ROOT/numpy-1.3.0
134 jfenwick 2317 cd ..
135 jfenwick 2529 pushd ../pkg
136 jfenwick 2462 ln -s numpy-1.3.0 numpy
137 jfenwick 2317 popd
138 jfenwick 2462 export PYTHONPATH=$PKG_ROOT/numpy/lib/python2.6/site-packages:$PYTHONPATH
139 jfenwick 2317 \end{shellCode}
140    
141 jfenwick 2462 % \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 jfenwick 2529 % pushd ../pkg
153 jfenwick 2462 % ln -s numarray-1.5.2 numarray
154     % popd
155     % \end{shellCode}
156    
157 caltinay 2536 \item Next build scons:
158 jfenwick 2317 \begin{shellCode}
159     cd scons-1.2.0
160 artak 2328 python setup.py install --prefix=$PKG_ROOT/scons-1.2.0
161 jfenwick 2317
162 artak 2328 export PATH=$PKG_ROOT/scons/bin:$PATH
163 jfenwick 2317 cd ..
164 jfenwick 2529 pushd ../pkg
165 jfenwick 2317 ln -s scons-1.2.0 scons
166     popd
167     \end{shellCode}
168    
169 caltinay 2536 \item The Boost libraries...:
170 jfenwick 2317 \begin{shellCode}
171 jfenwick 2529 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 caltinay 2536 ./bjam
178 jfenwick 2529 ./bjam install --prefix=$PKG_ROOT/boost --libdir=$PKG_ROOT/boost/lib
179 artak 2328 export LD_LIBRARY_PATH=$PKG_ROOT/boost/lib:$LD_LIBRARY_PATH
180 jfenwick 2317 cd ..
181 jfenwick 2529 pushd ../pkg/boost/lib/
182     ln *.so.* libboost_python.so
183 jfenwick 2317 popd
184     \end{shellCode}
185    
186 caltinay 3265 \item ...and netCDF:
187 jfenwick 2317 \begin{shellCode}
188     cd netcdf-4.0
189 jfenwick 2462 CFLAGS="-O2 -fPIC -Df2cFortran" CXXFLAGS="-O2 -fPIC -Df2cFortran" \
190     FFLAGS="-O2 -fPIC -Df2cFortran" FCFLAGS="-O2 -fPIC -Df2cFortran" \
191 artak 2328 ./configure --prefix=$PKG_ROOT/netcdf-4.0
192 jfenwick 2317
193 jfenwick 2529 make
194 jfenwick 2317 make install
195    
196 artak 2328 export LD_LIBRARY_PATH=$PKG_ROOT/netcdf/lib:$LD_LIBRARY_PATH
197 jfenwick 2317 cd ..
198 jfenwick 2529 pushd ../pkg
199 jfenwick 2317 ln -s netcdf-4.0 netcdf
200     popd
201     \end{shellCode}
202    
203 caltinay 2536 \item Finally matplotlib:
204 jfenwick 2529 \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 caltinay 2536 \end{itemize}
216    
217 jfenwick 2324 \subsection{Compiling escript}\label{sec:compileescriptlinux}
218    
219 jfenwick 3322 Change to the directory containing your escript source (\file{stand/escript.d}), then:
220 jfenwick 2324
221 jfenwick 2317 \begin{shellCode}
222 jfenwick 2529 cd escript.d/scons
223 jfenwick 3335 cp TEMPLATE_linux.py YourMachineName_options.py
224 jfenwick 2317
225 jfenwick 2529 echo $PKG_ROOT
226     \end{shellCode}
227 jfenwick 2602 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 jfenwick 3322 For example the options file for \texttt{bob-desktop} would be named \file{bob_desktop_options.py}.
230 jfenwick 3335 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 jfenwick 2317
232    
233 jfenwick 3335 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 jfenwick 4323 'x/stand/pkg/netcdf/lib/']
261 jfenwick 3335 \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 jfenwick 2529 \begin{shellCode}
271     cd ../bin
272     \end{shellCode}
273 jfenwick 2317
274 jfenwick 3322 Modify the STANDALONE line of \file{run-escript} to read:
275 jfenwick 2529
276 jfenwick 2317 STANDALONE=1
277    
278 jfenwick 3322 Start a new terminal and go to the \file{stand} directory.
279 jfenwick 2317
280 jfenwick 2529 \begin{shellCode}
281     export PATH=$(pwd)/pkg/scons/bin:$PATH
282 jfenwick 2317 cd escript.d
283 jfenwick 2923 eval $(bin/run-escript -e)
284 jfenwick 2317 scons
285     \end{shellCode}
286    
287     If you wish to test your build, then you can do the following.
288 caltinay 2536 Note this may take a while if you have a slow processor and/or less than 1GB of RAM.
289 jfenwick 2317 \begin{shellCode}
290 jfenwick 3942 scons py_tests
291 jfenwick 2317 \end{shellCode}
292 jfenwick 3942 (If you have cppunit installed you can run additional tests using \texttt{scons all_tests}.
293 jfenwick 2317
294 jfenwick 2324 \subsection{Cleaning up}
295 jfenwick 3335 Once you are satisfied, the \file{escript.d/build} and \file{stand/build} directories can be removed.
296 jfenwick 2317
297 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:
298 jfenwick 2317 \begin{itemize}
299 jfenwick 3322 \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 jfenwick 2324 \item Hidden files, which can be removed using
303 jfenwick 2317 \begin{shellCode}
304 jfenwick 2602 find . -name '.?*' | xargs rm -rf
305 jfenwick 2317 \end{shellCode}
306 jfenwick 3322 in the \file{escript.d} directory.
307 jfenwick 2324 \end{itemize}
308 jfenwick 3322 \item from the \file{pkg} directory:
309 jfenwick 2324 \begin{itemize}
310 jfenwick 3335 \item \file{scons}, \file{scons-1.2.0}
311 jfenwick 2324 \end{itemize}
312 jfenwick 3322 \item \file{package\_src}\footnote{Do not remove this if you intend to redistribute.}.
313 jfenwick 2324 \end{itemize}
314 jfenwick 2317
315 jfenwick 2324 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