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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.2287  
changed lines
  Added in v.2328

  ViewVC Help
Powered by ViewVC 1.1.26