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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2536 - (hide annotations)
Thu Jul 16 23:53:07 2009 UTC (10 years, 2 months ago) by caltinay
File MIME type: application/x-tex
File size: 13501 byte(s)
installguide: Fixed typos, minor semantics, repetitions and whitespace issues.

1 jfenwick 2289
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 \macosx}
15 artak 2326 \label{sec:srcmac}
16    
17 caltinay 2536 Before you start installing from source you will need \macosx development tools installed on your Mac.
18     This will ensure that you have the following available:
19 artak 2326 \begin{itemize}
20     \item \filename{g++} and associated tools.
21     \item \filename{make}
22     \end{itemize}
23    
24 caltinay 2536 Here are the instructions on how to install these.
25 artak 2327 \begin{enumerate}
26 caltinay 2536 \item Insert the \macosx 10.5 (Leopard) DVD
27     \item Double-click on XcodeTools.mpkg, located inside Optional Installs/Xcode Tools
28     \item Follow the instructions in the Installer
29     \item Authenticate as the administrative user (the first user you create when setting up \macosx has administrator privileges by default)
30 artak 2327 \end{enumerate}
31    
32 artak 2326 You will also need a copy of the \esfinley source code.
33     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.
34 artak 2327 For additional visualisation functionality see Section~\ref{sec:macaddfunc}.
35 artak 2326
36 caltinay 2536 These instructions will produce the following directory structure:
37 artak 2326 \begin{itemize}
38 caltinay 2536 \item[] \filename{stand}: \begin{itemize}
39     \item[] \filename{escript.d}
40     \item[] \filename{packages}
41     \item[] \filename{package_src}
42     \item[] \filename{build}
43     \item[] \filename{doc}
44     \end{itemize}
45 artak 2326 \end{itemize}
46    
47 artak 2327 The following instructions assume you are running the \filename{bash} shell.
48     Comments are indicated with \# characters.
49    
50     Open a terminal~\footnote{If you do not know how to open a terminal on Mac, then just type terminal in the spotlight (search tool on the top of the right corner) and once found just click on it.} and type
51    
52 artak 2326 \begin{shellCode}
53     mkdir stand
54     cd stand
55     export PKG_ROOT=`pwd`/packages
56     \end{shellCode}
57    
58     Copy compressed source bundles into \filename{stand/package_src}.
59     Copy documentation files into \filename{doc}.
60    
61     \begin{shellCode}
62     mkdir packages
63     mkdir build
64     cd build
65     tar -jxf ../package_src/Python-2.6.1.tar.bz2
66     tar -jxf ../package_src/boost_1_38_0.tar.bz2
67     tar -jxf ../package_src/MesaLib-7.2.tar.bz2
68     tar -zxf ../package_src/netcdf-4.0.tar.gz
69     tar -zxf ../package_src/vtk-5.2.1.tar.gz
70     tar -zxf ../package_src/vtkdata-5.2.1.tar.gz
71     tar -zxf ../package_src/numarray-1.5.2.tar.gz
72     tar -zxf ../package_src/cmake-2.6.3.tar.gz
73     tar -zxf ../package_src/scons-1.2.0.tar.gz
74     \end{shellCode}
75    
76 caltinay 2536 \begin{itemize}
77    
78     \item Build python:
79 artak 2326 \begin{shellCode}
80     cd Python*
81    
82 artak 2328 ./configure --prefix=$PKG_ROOT/python-2.6.1 \
83     --exec-prefix=$PKG_ROOT/python-2.6.1 --enable-shared \
84     --enable-framework=$PKG_ROOT/python-2.6.1 2>&1 | tee tt.configure.out
85 artak 2326
86     make -j2
87    
88     make install 2>&1 | tee tt.make.out
89    
90     cp ../../packages/python-2.6.1/Python.framework/Versions/2.6/Python \
91     ../../packages/python-2.6.1/lib/libpython2.6.dylib
92    
93     cp ../../packages/python-2.6.1/Python.framework/Versions/2.6/Python \
94     ../../packages/python-2.6.1/lib/libpython.dylib
95    
96     cp ../../packages/python-2.6.1/include/python2.6/pyconfig.h \
97     ../../packages/python-2.6.1/Python.framework/Headers/
98    
99     cd ..
100    
101 artak 2328 export PATH=$PKG_ROOT/python/bin:$PATH
102     export PYTHONHOME=$PKG_ROOT/python
103     export LD_LIBRARY_PATH=$PKG_ROOT/python/lib:$LD_LIBRARY_PATH
104 artak 2326
105     pushd ../packages
106     ln -s python-2.6.1/ python
107     popd
108     \end{shellCode}
109    
110 caltinay 2536 Run python to make sure it works (check the version number).
111 artak 2326
112 caltinay 2536 \item Now build numarray:
113    
114 artak 2326 \begin{shellCode}
115     cd numarray-1.5.2
116    
117     python setup.py install \
118 artak 2328 --gencode --install-lib=$PKG_ROOT/numarray-1.5.2/lib \
119     --install-headers=$PKG_ROOT=$PKG_ROOT/numarray-1.5.2/include/numarray \
120 artak 2326 2>&1 | tee tt.install.out
121    
122    
123 artak 2328 export PYTHONPATH=$PKG_ROOT/numarray/lib:$PYTHONPATH
124 artak 2326 cd ..
125     pushd ../packages
126     ln -s numarray-1.5.2 numarray
127     popd
128     \end{shellCode}
129    
130     Now we build scons.
131     \begin{shellCode}
132     cd scons-1.2.0
133 artak 2328 python setup.py install --prefix=$PKG_ROOT/scons-1.2.0
134 artak 2326
135 artak 2328 export PATH=$PKG_ROOT/scons/bin:$PATH
136 artak 2326 cd ..
137     pushd ../packages
138     ln -s scons-1.2.0 scons
139     popd
140     \end{shellCode}
141    
142 caltinay 2536 \item The Boost libraries...:
143 artak 2326 \begin{shellCode}
144     cd boost_1_38_0
145    
146 artak 2328 ./configure --prefix=$PKG_ROOT/boost_1_38_0 --with-python-root=$PKG_ROOT/python \
147 artak 2326 --with-python-version=2.6 --with-libraries=python
148    
149     make -j2
150     make install
151 artak 2328 ln -s $PKG_ROOT/boost_1_38_0 $PKG_ROOT/boost
152     export LD_LIBRARY_PATH=$PKG_ROOT/boost/lib:$LD_LIBRARY_PATH
153 artak 2326 cd ..
154     pushd ../packages
155     ln -s boost_1_38_0 boost
156     popd
157     \end{shellCode}
158    
159 caltinay 2536 \item ...and NetCDF:
160 artak 2326 \begin{shellCode}
161     cd netcdf-4.0
162     CFLAGS="-O2 fPIC -Df2cFortran" CXXFLAGS="-O2 fPIC -Df2cFortran" \
163     FFLAGS="-O2 fPIC -Df2cFortran" FCFLAGS="-O2 fPIC -Df2cFortran" \
164 artak 2328 ./configure --prefix=$PKG_ROOT/netcdf-4.0
165 artak 2326
166     make -j2
167     make install
168    
169 artak 2328 export LD_LIBRARY_PATH=$PKG_ROOT/netcdf/lib:$LD_LIBRARY_PATH
170 artak 2326 cd ..
171     pushd ../packages
172     ln -s netcdf-4.0 netcdf
173     popd
174     \end{shellCode}
175    
176 caltinay 2536 \item CMake is required to build VTK:
177 artak 2326 \begin{shellCode}
178     cd cmake-2.6.3
179 artak 2328 ./configure --prefix=$PKG_ROOT/cmake-2.6.3 2>&1 | tee tt.configure
180 artak 2326 make -j 4
181     make install
182    
183 artak 2328 export PATH=$PKG_ROOT/cmake/bin:$PATH
184 artak 2326 cd ..
185     pushd ../packages
186     ln -s cmake-2.6.3 cmake
187     popd
188     \end{shellCode}
189    
190 caltinay 2536 \item VTK also requires Mesa:
191 artak 2326 \begin{shellCode}
192     cd Mesa-7.2
193 artak 2328 ./configure --prefix=$PKG_ROOT/mesa-7.2 --enable-gl-osmesa
194 artak 2326
195     make -j 4
196     make install
197    
198 artak 2328 export LD_LIBRARY_PATH=$PKG_ROOT/mesa:$LD_LIBRARY_PATH
199 artak 2326 cd ..
200     pushd ../packages
201     ln -s mesa-7.2 mesa
202     popd
203     \end{shellCode}
204    
205 caltinay 2536 These instructions do not compile MesaDemos or GLUT.
206     If you need to check if Mesa compiled correctly, then the demos are a good test.
207    
208     \item Now build VTK:
209 artak 2326 \begin{shellCode}
210     cd VTK
211     cmake .
212    
213     #Edit the CMakeCache and make the following changes:
214     #(Please replace .... with an absolute path to the stand directory)
215    
216     #-----------------
217    
218     BUILD_EXAMPLES should be OFF
219     BUILD_SHARED_LIBS should be ON
220    
221     CMAKE_INSTALL_PREFIX ..../stand/packages/vtk-5.2.1
222     CMAKE_VERBOSE_MAKEFILE TRUE
223    
224     #check PYTHON_EXECUTABLE is correct.
225     #but it seems to be when I went through these steps
226    
227     VTK_OPENGL_HAS_OSMESA TRUE
228     VTK_USE_64BIT_IDS ON
229     # That last one is marked as "May cause some bugs" in the original instructions
230    
231     VTK_WRAP_PYTHON ON
232     VTK_USE_MANGLED_MESA OFF
233    
234     #--------------------
235    
236     cmake .
237     #It won't work but it will put some variables in that you need.
238    
239     #Edit CMakeCache again and make the following changes
240    
241     #----------------
242    
243     VTK_USE_TK OFF
244    
245     OSMESA_INCLUDE_DIR ..../stand/packages/mesa/include
246    
247     OSMESA_LIBRARY ..../stand/packages/mesa/lib/libOSMesa.dylib
248    
249     PYTHON_INCLUDE_PATH ..../stand/packages/python/include/python2.6
250    
251     PYTHON_LIBRARY ..../stand/packages/python/lib/libpython2.6.dylib
252    
253     OPENGL_INCLUDE_DIR ..../stand/packages/mesa/include
254    
255     OPENGL_gl_LIBRARY ..../stand/packages/mesa/lib/libGL.dylib
256    
257     #----------------
258    
259     cmake .
260     make
261     make install
262    
263    
264     cd ../../packages
265     ln -s vtk-5.2.1 vtk
266     cd ..
267     \end{shellCode}
268    
269 caltinay 2536 \item Finally, build escript:\\
270     Copy the \esfinley source into an \filename{escript.d} directory in \filename{stand}.
271 artak 2326
272     \begin{shellCode}
273     cd scons
274     cp mac_options_example.py YourMachineName_options.py
275    
276     #edit the options file and make the following changes:
277     #-----------------------------------------------------------------
278     declare a PKG_ROOT variable at the top of the file eg:
279     PKG_ROOT='/Users/artak/stand/packages'
280    
281     python_path = PKG_ROOT+'python/include/python2.6'
282     python_lib_path = PKG_ROOT+'python/lib'
283     python_libs = 'python2.6'
284    
285     boost_path = PKG_ROOT+'boost/include/boost-1_38'
286     boost_lib_path = PKG_ROOT+'boost/lib'
287     boost_libs = ['boost_python-gcc43-mt']
288     # You could simlink the boost python library to give a shorter
289     # name but it's not worth it
290    
291     usevtk = 'yes'
292     #-------------------------------------------------------------------
293    
294 artak 2328 ln -s $PKG_ROOT/vtk-5.2.1 $PKG_ROOT/vtk
295 artak 2326
296     Modify /scripts/finley_wrapper_template
297    
298     STANDALONE=1
299    
300 artak 2328 #Check to make sure the paths in the if [ $STANDALONE == 1 ]
301 artak 2326 # Section are correct
302    
303     #-----------------------------------------------------------------
304    
305     scons bin/escript
306    
307     #start a new terminal
308     cd stand
309 artak 2328 export PATH=`pwd`/packages/scons/bin:$PATH
310 artak 2326 cd escript.d
311     eval `bin/escript -e`
312     scons
313     \end{shellCode}
314    
315 caltinay 2536 \end{itemize}
316    
317 artak 2326 If you wish to test your build, then you can do the following.
318 caltinay 2536 Note this may take a while if you have a slow processor and/or less than 1GB of RAM.
319 artak 2326 \begin{shellCode}
320     scons all_tests
321     \end{shellCode}
322    
323     Once you are satisfied, the \filename{build} and \filename{\$PKG_ROOT/build} directories can be removed.
324     Within the \filename{packages} directory, the \filename{scons}, \filename{scons-1.2.0}, \filename{cmake-2.6.3} and \filename{cmake} entries can also be removed.
325     If you are not redistributing this bundle you can remove \filename{\$PKG_ROOT/package_src}.
326    
327     If you do not plan to edit or recompile the source you can remove it.
328     The only entries which are required in \filename{escript.d} are:
329     \begin{itemize}
330     \item \filename{bin}
331 caltinay 2536 \item \filename{esys}
332     \item \filename{include}
333     \item \filename{lib}
334     \item \filename{README_LICENSE}
335 artak 2326 \end{itemize}
336    
337     Hidden files can be removed with
338     \begin{shellCode}
339     find . -name .?* | xargs rm -rf
340     \end{shellCode}
341    
342 artak 2327 \section{Additional Functionality}\label{sec:macaddfunc}
343 artak 2326 To perform visualisations you will need some additional tools.
344     Since these do not need to be linked with any of the packages above, you can install versions available for your
345     system, or build them from source.
346     \begin{itemize}
347 caltinay 2536 \item \filename{ppmtompeg} and \filename{jpegtopnm} from the \filename{netpbm} suite - to build from source
348     you would also need \filename{libjpeg} and its headers as well as \filename{libpng}\footnote{libpng requires zlib to build} and its headers
349     \item A tool to visualise VTK files - for example Mayavi or Visit
350 artak 2328 \end{itemize}
351    
352    
353 artak 2329 \section{Installing from source for \macosx using Macports}
354 artak 2328 \label{sec:srcmacports}
355    
356 caltinay 2536 As we mentioned in Section~\ref{sec:srcmac}, before you start installing from source you will need \macosx development tools installed on your Mac.
357 jfenwick 2333 If you do not have Macports already, please install Macports from \url{www.macports.org}. You can also install porticus (GUI for Macports).
358 artak 2328
359 caltinay 2536 Once you have Macports working install boost using porticus or from the terminal
360 artak 2328 \begin{shellCode}
361     sudo port install boost@1.35.0_2+complete
362     \end{shellCode}
363     Sometimes this fails due to unknown reasons, but to overcome this problem you need to run
364     \begin{shellCode}
365     sudo port clean boost@1.35.0_2+complete
366    
367     sudo port install boost@1.35.0_2+complete
368     \end{shellCode}
369    
370     Download scons source scons-0.98.5.tar.gz from \url{www.scons.org}.
371     \begin{shellCode}
372     tar xfz scons-0.98.5.tar.gz
373     cd scons-0.98.5
374     python setup.py install
375     \end{shellCode}
376    
377 caltinay 2536 Note: Do not try to install scons using porticus or \texttt{sudo port install scons}, because it automatically installs another python version and you are likely run into problems with different python versions.
378 artak 2328
379 jfenwick 2333 Download numarray-1.5.2.tar.gz from \\
380     \url{http://www.stsci.edu/resources/software_hardware/numarray/numarray.html}.
381 artak 2328 \begin{shellCode}
382     tar xfz numarray-1.5.2.tar.gz
383     cd numarray-1.5.2
384     python setup.py install --gencode 2>&1 | tee tt.install.out
385     \end{shellCode}
386    
387 caltinay 2536 You can run a test to check the numarray installation by
388 artak 2328 \begin{shellCode}
389     python
390     import numarray.testall as testall
391     testall.test()
392     \end{shellCode}
393    
394     Install netcdf, gsl and fltk using Macports
395     \begin{shellCode}
396     sudo port install netcdf
397     sudo port install gsl
398     sudo port intall fltk
399     \end{shellCode}
400     Note: If this fails, download and install from sources.
401    
402     Downlaod gmsh-2.2.3-source.tar and install from sources.
403     \begin{shellCode}
404     ./configure --with-gsl-prefix=/opt/local/ --with-fltk --prefix=/usr/local/
405     \end{shellCode}
406     Note: if you install using porticus or sudo port it automaticall installs in \filename{/opt/local/}, but if you install from sources it installs in /usr/local. So, make sure these paths are right.
407     \begin{shellCode}
408 jfenwick 2333 sudo make -j2
409 artak 2328 sudo make install
410     \end{shellCode}
411    
412     Download and install Mesa-7.0.3 (required for VTK) from sources
413     \begin{shellCode}
414     tar xjf MesaDemos-7.0.3.tar.bz2
415     tar xjf MesaGLUT-7.0.3.tar.bz2
416     tar xjf MesaLib-7.0.3.tar.bz2
417     cd Mesa-7.0.3
418    
419     sudo make -j 2
420     make install
421     \end{shellCode}
422    
423 caltinay 2536 Install vtk-5.0.4 from source. If you install from ports it won't configure to use shared libraries.
424     Once you untar it you will have (assume user is john) /Users/john/Downloads/VTK folder, then run the following:
425 artak 2328
426     \begin{shellCode}
427     sudo mkdir /usr/local/VTKBuild/
428     cd /usr/local/VTKBuild/
429     sudo ccmake /Users/john/Downloads/VTK/
430     # It will create CMakeCache.txt. Make sure you use the following configurations.
431    
432     # Advanced options ON
433     # BUILD_EXAMPLES ON
434     # BUILD_SHARED_LIBS ON
435     # VTK_WRAP_PYTHON ON
436     # CMAKE_VERBOSE_MAKEFILE TRUE
437     # VTK_OPENGL_HAS_OSMESA ON
438     # VTK_USE_MANGLED_MESA OFF
439     # VTK_USE_OFFSCREEN OFF
440    
441 artak 2329 sudo make -j2
442 artak 2328 sudo make install
443     \end{shellCode}
444    
445 caltinay 2536 Note: you need to set the following ENV variables in your \filename{/Users/john/.profile} for VTK to work:
446 artak 2328 \begin{shellCode}
447     export LD_LIBRARY_PATH = /usr/local/VTKBuild/bin: \
448     /usr/local/VTKBuild/bin:${LD_LIBRARY_PATH}
449     export PYTHONPATH = /usr/local/VTKBuild/Wrapping/Python:\
450     /usr/local/VTKBuild/bin:${PYTHONPATH}
451    
452     # For testing you can run:
453     python
454     import vtk
455     \end{shellCode}
456    
457 caltinay 2536 All that's left to install is triangle and netpbm (required for ppmtompeg) using Macports:
458 artak 2328 \begin{shellCode}
459     sudo port install triangle
460     sudo port install netpbm
461     \end{shellCode}
462    

  ViewVC Help
Powered by ViewVC 1.1.26