1 |
|
2 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
3 |
% |
4 |
% Copyright (c) 2003-2008 by University of Queensland |
5 |
% Earth Systems Science Computational Center (ESSCC) |
6 |
% http://www.uq.edu.au/esscc |
7 |
% |
8 |
% Primary Business: Queensland, Australia |
9 |
% Licensed under the Open Software License version 3.0 |
10 |
% http://www.opensource.org/licenses/osl-3.0.php |
11 |
% |
12 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
13 |
|
14 |
\section{Installing from source for \linux} |
15 |
\label{sec:srclinux} |
16 |
The following instructions assume you are running the \filename{bash} shell. |
17 |
Comments are indicated with \# characters. |
18 |
|
19 |
Make sure you have the following installed: |
20 |
\begin{itemize} |
21 |
\item \filename{g++} and associated tools. |
22 |
\item \filename{make} |
23 |
\item \filename{libXext.so}\footnote{In Debian this is in the libXext-dev package.} |
24 |
\item \filename{libxt.so}\footnote{In Debian this is in the libxt-dev package.} |
25 |
\end{itemize} |
26 |
|
27 |
You will also need a copy of the \esfinley source code. |
28 |
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. |
29 |
For additional visualisation functionality see Section~\ref{sec:linaddfunc}. |
30 |
|
31 |
These instructions will produce the following structure: |
32 |
\begin{itemize} |
33 |
\item \filename{stand}: \begin{itemize} |
34 |
\item \filename{escript.d} |
35 |
\item \filename{packages} |
36 |
\item \filename{package_src} |
37 |
\item \filename{build} |
38 |
\item \filename{doc} |
39 |
\end{itemize} |
40 |
\end{itemize} |
41 |
|
42 |
The build directory can be removed when you are finished. |
43 |
|
44 |
\begin{shellCode} |
45 |
mkdir stand |
46 |
cd stand |
47 |
export PKG_ROOT=`pwd`/packages |
48 |
\end{shellCode} |
49 |
|
50 |
Copy compressed source bundles into \filename{stand/package_src}. |
51 |
Copy documentation files into \filename{doc}. |
52 |
|
53 |
\begin{shellCode} |
54 |
mkdir packages |
55 |
mkdir build |
56 |
cd build |
57 |
tar -jxf ../package_src/Python-2.6.1.tar.bz2 |
58 |
tar -jxf ../package_src/boost_1_37_0.tar.bz2 |
59 |
tar -jxf ../package_src/MesaLib-7.2.tar.bz2 |
60 |
tar -zxf ../package_src/netcdf-4.0.tar.gz |
61 |
tar -zxf ../package_src/vtk-5.2.1.tar.gz |
62 |
tar -zxf ../package_src/vtkdata-5.2.1.tar.gz |
63 |
tar -zxf ../package_src/numarray-1.5.2.tar.gz |
64 |
tar -zxf ../package_src/cmake-2.6.3.tar.gz |
65 |
tar -zxf ../package_src/scons-1.2.0.tar.gz |
66 |
\end{shellCode} |
67 |
|
68 |
Build python. |
69 |
\begin{shellCode} |
70 |
cd Python* |
71 |
./configure --prefix=$PKG_ROOT/python-2.6.1 --enable-shared 2>&1 \ |
72 |
| tee tt.configure.out |
73 |
make install 2>&1 | tee tt.make.out |
74 |
|
75 |
cd .. |
76 |
|
77 |
export PATH=$PKG_ROOT/python/bin:$PATH |
78 |
export PYTHONHOME=$PKG_ROOT/python |
79 |
export LD_LIBRARY_PATH=$PKG_ROOT/python/lib:$LD_LIBRARY_PATH |
80 |
|
81 |
pushd ../packages |
82 |
ln -s python-2.6.1/ python |
83 |
popd |
84 |
|
85 |
\end{shellCode} |
86 |
|
87 |
Run python to make sure it works. |
88 |
Now build numarray. |
89 |
|
90 |
\begin{shellCode} |
91 |
cd numarray-1.5.2 |
92 |
|
93 |
python setup.py install \ |
94 |
--gencode --install-lib=$PKG_ROOT/numarray-1.5.2/lib \ |
95 |
--install-headers=$PKG_ROOT=$PKG_ROOT/numarray-1.5.2/include/numarray \ |
96 |
2>&1 | tee tt.install.out |
97 |
|
98 |
|
99 |
export PYTHONPATH=$PKG_ROOT/numarray/lib:$PYTHONPATH |
100 |
cd .. |
101 |
pushd ../packages |
102 |
ln -s numarray-1.5.2 numarray |
103 |
popd |
104 |
\end{shellCode} |
105 |
|
106 |
Now we build scons. |
107 |
\begin{shellCode} |
108 |
cd scons-1.2.0 |
109 |
python setup.py install --prefix=$PKG_ROOT/scons-1.2.0 |
110 |
|
111 |
export PATH=$PKG_ROOT/scons/bin:$PATH |
112 |
cd .. |
113 |
pushd ../packages |
114 |
ln -s scons-1.2.0 scons |
115 |
popd |
116 |
\end{shellCode} |
117 |
|
118 |
...Boost libraries ... |
119 |
\begin{shellCode} |
120 |
cd boost_1_37_0 |
121 |
|
122 |
./configure --prefix=$PKG_ROOT/boost_1_37_0 --with-python-root=$PKG_ROOT/python \ |
123 |
--with-python-version=2.6 --with-libraries=python |
124 |
|
125 |
make |
126 |
make install |
127 |
ln -s $PKG_ROOT/boost_1_37_0 $PKG_ROOT/boost |
128 |
export LD_LIBRARY_PATH=$PKG_ROOT/boost/lib:$LD_LIBRARY_PATH |
129 |
cd .. |
130 |
pushd ../packages |
131 |
ln -s boost_1_37_0 boost |
132 |
popd |
133 |
\end{shellCode} |
134 |
|
135 |
... and netcdf. |
136 |
\begin{shellCode} |
137 |
cd netcdf-4.0 |
138 |
CFLAGS="-O2 fPIC -Df2cFortran" CXXFLAGS="-O2 fPIC -Df2cFortran" \ |
139 |
FFLAGS="-O2 fPIC -Df2cFortran" FCFLAGS="-O2 fPIC -Df2cFortran" \ |
140 |
./configure --prefix=$PKG_ROOT/netcdf-4.0 |
141 |
|
142 |
make -j2 |
143 |
make install |
144 |
|
145 |
export LD_LIBRARY_PATH=$PKG_ROOT/netcdf/lib:$LD_LIBRARY_PATH |
146 |
cd .. |
147 |
pushd ../packages |
148 |
ln -s netcdf-4.0 netcdf |
149 |
popd |
150 |
\end{shellCode} |
151 |
|
152 |
CMake and Mesa are required for VTK. |
153 |
\begin{shellCode} |
154 |
cd cmake-2.6.3 |
155 |
./configure --prefix=$PKG_ROOT/cmake-2.6.3 2>&1 | tee tt.configure |
156 |
make -j 4 |
157 |
make install |
158 |
|
159 |
export PATH=$PKG_ROOT/cmake/bin:$PATH |
160 |
cd .. |
161 |
pushd ../packages |
162 |
ln -s cmake-2.6.3 cmake |
163 |
popd |
164 |
\end{shellCode} |
165 |
|
166 |
These instructions do not compile MesaDemos or GLUT. |
167 |
If you need to check if Mesa compiled correctly, then the demos are a good test. |
168 |
\begin{shellCode} |
169 |
cd Mesa-7.2 |
170 |
./configure --prefix=$PKG_ROOT/mesa-7.2 --enable-gl-osmesa --with-driver=xlib |
171 |
|
172 |
make -j 4 |
173 |
make install |
174 |
|
175 |
export LD_LIBRARY_PATH=$PKG_ROOT/mesa:$LD_LIBRARY_PATH |
176 |
cd .. |
177 |
pushd ../packages |
178 |
ln -s mesa-7.2 mesa |
179 |
popd |
180 |
\end{shellCode} |
181 |
|
182 |
\begin{shellCode} |
183 |
cd VTK |
184 |
cmake . |
185 |
|
186 |
#Edit the CMakeCache and make the following changes: |
187 |
#(Please replace .... with an absolute path to the stand directory) |
188 |
|
189 |
#----------------- |
190 |
|
191 |
BUILD_EXAMPLES should be OFF |
192 |
BUILD_SHARED_LIBS should be ON |
193 |
|
194 |
CMAKE_INSTALL_PREFIX ..../stand/packages/vtk-5.2.1 |
195 |
CMAKE_VERBOSE_MAKEFILE TRUE |
196 |
|
197 |
#check PYTHON_EXECUTABLE is correct. |
198 |
#but it seems to be when I went through these steps |
199 |
|
200 |
VTK_OPENGL_HAS_OSMESA TRUE |
201 |
VTK_USE_64BIT_IDS ON |
202 |
# That last one is marked as "May cause some bugs" in the original instructions |
203 |
|
204 |
VTK_WRAP_PYTHON ON |
205 |
VTK_USE_MANGLED_MESA OFF |
206 |
|
207 |
#-------------------- |
208 |
|
209 |
cmake . |
210 |
#It won't work but it will put some variables in that you need. |
211 |
|
212 |
#Edit CMakeCache again and make the following changes |
213 |
|
214 |
#---------------- |
215 |
|
216 |
VTK_USE_TK OFF |
217 |
|
218 |
OSMESA_INCLUDE_DIR ..../stand/packages/mesa/include |
219 |
|
220 |
OSMESA_LIBRARY ..../stand/packages/mesa/lib/libOSMesa.so |
221 |
|
222 |
PYTHON_INCLUDE_PATH ..../stand/packages/python/include/python2.6 |
223 |
|
224 |
PYTHON_LIBRARY ..../stand/packages/python/lib/libpython2.6.so |
225 |
|
226 |
OPENGL_INCLUDE_DIR ..../stand/packages/mesa/include |
227 |
|
228 |
OPENGL_gl_LIBRARY ..../stand/packages/mesa/lib/libGL.so |
229 |
|
230 |
#---------------- |
231 |
|
232 |
cmake . |
233 |
make |
234 |
make install |
235 |
|
236 |
|
237 |
cd ../../packages |
238 |
ln -s vtk-5.2.1 vtk |
239 |
cd .. |
240 |
\end{shellCode} |
241 |
|
242 |
Now copy the \esfinley source into an \filename{escript.d} directory in \filename{stand}. |
243 |
|
244 |
\subsection{Compiling escript}\label{sec:compileescriptlinux} |
245 |
|
246 |
Change to the directory containing your escript source (\filename{escript.d}), then: |
247 |
|
248 |
\begin{shellCode} |
249 |
cd scons |
250 |
cp linux_options_example.py YourMachineName_options.py |
251 |
|
252 |
#edit the options file and make the following changes: |
253 |
#----------------------------------------------------------------- |
254 |
declare a PKG_ROOT variable at the top of the file eg: |
255 |
PKG_ROOT='/home/jfenwick/stand/packages' |
256 |
|
257 |
python_path = PKG_ROOT+'python/include/python2.6' |
258 |
python_lib_path = PKG_ROOT+'python/lib' |
259 |
python_libs = 'python2.6' |
260 |
|
261 |
boost_path = PKG_ROOT+'boost/include/boost-1_37' |
262 |
boost_lib_path = PKG_ROOT+'boost/lib' |
263 |
boost_libs = ['boost_python-gcc43-mt'] |
264 |
# You could simlink the boost python library to give a shorter |
265 |
# name but it's not worth it |
266 |
|
267 |
usevtk = 'yes' |
268 |
#------------------------------------------------------------------- |
269 |
|
270 |
ln -s $PKG_ROOT/vtk-5.2.1 $PKG_ROOT/vtk |
271 |
|
272 |
Modify /scripts/finley_wrapper_template |
273 |
|
274 |
STANDALONE=1 |
275 |
|
276 |
#Check to make sure the paths in the if [ $STANDALONE == 1 ] |
277 |
# Section are correct |
278 |
|
279 |
#----------------------------------------------------------------- |
280 |
|
281 |
scons bin/escript |
282 |
|
283 |
#start a new terminal |
284 |
cd stand |
285 |
export PATH=`pwd`/packages/scons/bin:$PATH |
286 |
cd escript.d |
287 |
eval `bin/escript -e` |
288 |
scons |
289 |
\end{shellCode} |
290 |
|
291 |
If you wish to test your build, then you can do the following. |
292 |
Note this may take a while if you have a slow processor and/or less than 1Gb of RAM. |
293 |
\begin{shellCode} |
294 |
scons all_tests |
295 |
\end{shellCode} |
296 |
|
297 |
\subsection{Cleaning up} |
298 |
Once you are satisfied, the \filename{escript.d/build} and \filename{\$PKG_ROOT/build} directories can be removed. |
299 |
|
300 |
If you \emph{really} want to save space and do not wish to be able to edit or recompile escript, you can remove the following: |
301 |
\begin{itemize} |
302 |
\item From the \filename{escript.d} directory:\begin{itemize} |
303 |
\item Everything except: \filename{bin}, \filename{include}, \filename{lib}, \filename{esys}, |
304 |
\filename{README_LICENSE}. |
305 |
\item Hidden files, which can be removed using |
306 |
\begin{shellCode} |
307 |
find . -name .?* | xargs rm -rf |
308 |
\end{shellCode} |
309 |
in the \filename{escript.d} directory. |
310 |
\end{itemize} |
311 |
\item from the \filename{packages} directory: |
312 |
\begin{itemize} |
313 |
\item \filename{scons}, \filename{scons-1.2.0}, \filename{cmake-2.6.3} and \filename{cmake} |
314 |
\end{itemize} |
315 |
\item \filename{package\_src}\footnote{Do not remove this if you intend to redistribute.}. |
316 |
\end{itemize} |
317 |
|
318 |
Please note that removing all these files may make it more difficult for us to diagnose problems. |
319 |
|
320 |
|
321 |
|
322 |
|
323 |
\section{Additional Functionality}\label{sec:linaddfunc} |
324 |
To perform visualisations you will need some additional tools. |
325 |
Since these do not need to be linked with any of the packages above, you can install versions available for your |
326 |
system, or build them from source. |
327 |
\begin{itemize} |
328 |
\item \filename{ppmtompeg} and \filename{jpegtopnm} from the \filename{netpbm} suite. - To build from source |
329 |
you would also need \filename{libjpeg} and its headers as well as \filename{libpng}\footnote{libpng requires zlib to build} and its headers. |
330 |
\item A tool to visualise VTK files. For example Mayavi or Visit. |
331 |
\end{itemize} |