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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2547 - (hide annotations)
Mon Jul 20 05:50:46 2009 UTC (10 years, 3 months ago) by caltinay
File MIME type: application/x-tex
File size: 12866 byte(s)
More work on the install guide.

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

  ViewVC Help
Powered by ViewVC 1.1.26