1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2 |
% |
3 |
% Copyright (c) 2003-2009 by University of Queensland |
4 |
% 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 |
\label{sec:srclinux} |
15 |
|
16 |
\subsection{Preliminaries} |
17 |
|
18 |
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 |
\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 |
\end{itemize} |
29 |
|
30 |
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 |
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 |
For additional visualization functionality see \Sec{sec:addfunc}. |
43 |
|
44 |
These instructions will produce the following directory structure: |
45 |
\begin{itemize} |
46 |
\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 |
\end{itemize} |
54 |
|
55 |
Before you start copy the \esfinley source into the \filename{escript.d} directory. |
56 |
The following instructions refer to software versions in the \filename{escript-support-3-src} bundle. |
57 |
If you download your own versions of those packages substitute their version numbers and names as appropriate. |
58 |
There are a number of uses of the \filename{make} command in the following instructions. |
59 |
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 |
\begin{shellCode} |
62 |
make |
63 |
\end{shellCode} |
64 |
becomes |
65 |
\begin{shellCode} |
66 |
make -j 4 |
67 |
\end{shellCode} |
68 |
|
69 |
\begin{shellCode} |
70 |
mkdir stand |
71 |
cd stand |
72 |
mkdir build doc pkg pkg_src |
73 |
export PKG_ROOT=$(pwd)/pkg |
74 |
\end{shellCode} |
75 |
|
76 |
\subsection{Building the dependencies} |
77 |
|
78 |
Copy the compressed sources for the packages into \filename{stand/pkg_src}. |
79 |
If you are using the support bundles, decompress them in the stand directory: |
80 |
\begin{shellCode} |
81 |
tar -xjf escript-support-3-src.tar.bz2 |
82 |
\end{shellCode} |
83 |
|
84 |
Copy documentation files into \filename{doc} then unpack the archives: |
85 |
|
86 |
\begin{shellCode} |
87 |
cd build |
88 |
tar -jxf ../pkg_src/Python-2.6.2.tar.bz2 |
89 |
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 |
\end{shellCode} |
95 |
|
96 |
\begin{itemize} |
97 |
|
98 |
\item Build Python: |
99 |
\begin{shellCode} |
100 |
cd Python* |
101 |
./configure --prefix=$PKG_ROOT/python-2.6.2 --enable-shared 2>&1 \ |
102 |
| tee tt.configure.out |
103 |
make |
104 |
make install 2>&1 | tee tt.make.out |
105 |
|
106 |
cd .. |
107 |
|
108 |
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 |
|
112 |
pushd ../pkg |
113 |
ln -s python-2.6.2/ python |
114 |
popd |
115 |
\end{shellCode} |
116 |
|
117 |
Run the new python executable to make sure it works. |
118 |
|
119 |
\item Now build NumPy: |
120 |
\begin{shellCode} |
121 |
cd numpy-1.3.0 |
122 |
python setup.py build |
123 |
python setup.py install --prefix $PKG_ROOT/numpy-1.3.0 |
124 |
cd .. |
125 |
pushd ../pkg |
126 |
ln -s numpy-1.3.0 numpy |
127 |
popd |
128 |
export PYTHONPATH=$PKG_ROOT/numpy/lib/python2.6/site-packages:$PYTHONPATH |
129 |
\end{shellCode} |
130 |
|
131 |
% \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 |
% pushd ../pkg |
143 |
% ln -s numarray-1.5.2 numarray |
144 |
% popd |
145 |
% \end{shellCode} |
146 |
|
147 |
\item Next build scons: |
148 |
\begin{shellCode} |
149 |
cd scons-1.2.0 |
150 |
python setup.py install --prefix=$PKG_ROOT/scons-1.2.0 |
151 |
|
152 |
export PATH=$PKG_ROOT/scons/bin:$PATH |
153 |
cd .. |
154 |
pushd ../pkg |
155 |
ln -s scons-1.2.0 scons |
156 |
popd |
157 |
\end{shellCode} |
158 |
|
159 |
\item The Boost libraries...: |
160 |
\begin{shellCode} |
161 |
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 |
./bjam |
168 |
./bjam install --prefix=$PKG_ROOT/boost --libdir=$PKG_ROOT/boost/lib |
169 |
export LD_LIBRARY_PATH=$PKG_ROOT/boost/lib:$LD_LIBRARY_PATH |
170 |
cd .. |
171 |
pushd ../pkg/boost/lib/ |
172 |
ln *.so.* libboost_python.so |
173 |
popd |
174 |
\end{shellCode} |
175 |
|
176 |
\item ...and NetCDF: |
177 |
\begin{shellCode} |
178 |
cd netcdf-4.0 |
179 |
CFLAGS="-O2 -fPIC -Df2cFortran" CXXFLAGS="-O2 -fPIC -Df2cFortran" \ |
180 |
FFLAGS="-O2 -fPIC -Df2cFortran" FCFLAGS="-O2 -fPIC -Df2cFortran" \ |
181 |
./configure --prefix=$PKG_ROOT/netcdf-4.0 |
182 |
|
183 |
make |
184 |
make install |
185 |
|
186 |
export LD_LIBRARY_PATH=$PKG_ROOT/netcdf/lib:$LD_LIBRARY_PATH |
187 |
cd .. |
188 |
pushd ../pkg |
189 |
ln -s netcdf-4.0 netcdf |
190 |
popd |
191 |
\end{shellCode} |
192 |
|
193 |
\item Finally matplotlib: |
194 |
\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 |
\end{itemize} |
206 |
|
207 |
% \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 |
|
314 |
\subsection{Compiling escript}\label{sec:compileescriptlinux} |
315 |
|
316 |
Change to the directory containing your escript source (\filename{stand/escript.d}), then: |
317 |
|
318 |
\begin{shellCode} |
319 |
cd escript.d/scons |
320 |
cp linux_standalone_options_example.py YourMachineName_options.py |
321 |
|
322 |
echo $PKG_ROOT |
323 |
\end{shellCode} |
324 |
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 |
|
328 |
Edit the options file and put the value of PKG_ROOT between the quotes in the PKG_ROOT= line. |
329 |
For example: |
330 |
\begin{shellCode} |
331 |
PKG_ROOT="/home/bob/stand/pkg" |
332 |
\end{shellCode} |
333 |
|
334 |
\begin{shellCode} |
335 |
cd ../bin |
336 |
\end{shellCode} |
337 |
|
338 |
Modify the STANDALONE line of \filename{escript} to read: |
339 |
|
340 |
STANDALONE=1 |
341 |
|
342 |
Start a new terminal and go to the \filename{stand} directory. |
343 |
|
344 |
\begin{shellCode} |
345 |
export PATH=$(pwd)/pkg/scons/bin:$PATH |
346 |
cd escript.d |
347 |
eval $(bin/escript -e) |
348 |
scons |
349 |
\end{shellCode} |
350 |
|
351 |
If you wish to test your build, then you can do the following. |
352 |
Note this may take a while if you have a slow processor and/or less than 1GB of RAM. |
353 |
\begin{shellCode} |
354 |
scons all_tests |
355 |
\end{shellCode} |
356 |
|
357 |
\subsection{Cleaning up} |
358 |
Once you are satisfied, the \filename{escript.d/build} and \filename{\$PKG_ROOT/build} directories can be removed. |
359 |
|
360 |
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 |
\begin{itemize} |
362 |
\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 |
\begin{shellCode} |
367 |
find . -name '.?*' | xargs rm -rf |
368 |
\end{shellCode} |
369 |
in the \filename{escript.d} directory. |
370 |
\end{itemize} |
371 |
\item from the \filename{pkg} directory: |
372 |
\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 |
|
378 |
Please note that removing all these files may make it more difficult for us to diagnose problems. |
379 |
|
380 |
|