[vtkusers] Request for comments: Recipe for VTK under MacOS X

Tom Bridgman bridgman at wyeth.gsfc.nasa.gov
Thu Sep 25 09:13:57 EDT 2003


Here's my (draft) write-up on installing VTK under MacOS X.  I still
don't have MayaVi working, however, I'd like corrections, comments and
feedback (especially in areas where I have questions) on this.  At some
point I'd like to HTML-ify it and have it posted to the VTK and/or
MacPython web sites.

Building VTK with MacPython
---------------------------

This document assumes you have installed:
¥ MacOS X 10.2.6
¥ MacPython v2.3
¥ Installed Tkinter via PackageManager
¥ gcc 3.1 (Apple Developer Tools, December 2002)
¥ Need recent AquaTclTk 8.4+ in /Library/Frameworks/
¥ CMake v1.8.1
There are other ways to get to this point.

I'm unpacking the VTK data & source trees in $HOME/Development and 
assuming a system-wide installation in /usr/local/ = [installpath]
Note that /usr/local is not normally created under MacOS X, so
% sudo mkdir /usr/local/
if necessary

% gnutar xzvf VTK_cvs20030921.tgz
% gnutar xvzf vtkNightlyData.tar.gz

% setenv MACOSX_DEPLOYMENT_TARGET 10.2
# to avoid annoying warnings about the setting of this variable

% setenv VTK_DATA_ROOT $HOME/Development/VTKData 
# or wherever VTKData.readme is located (put in your .cshrc?)

% cd VTK

To configure the installation, do 

% cmake -i 
or 
% ccmake

==
At this point, there are several options to choose from.  This write-up
covers
Aqua-based Tk, but I believe the full list of options is:

     * Aqua-based Tk, MacPython (MayaVi possible)
     * X11-based Tk (Apple or XDarwin?), MacPython (MayaVi possible)
         Advantages/disadvantages to Aqua vs X11 Tk?
     * Cocoa (no python usage?, C++/ObjC only?, MayaVi not possible?)
         Use this version for Drew McCormack's Cocoa & VTK 
         project described at www.macdevcenter.com.
         What about PyObjC (Python + Objective-C) projects?

     Multiple build options possible on the same machine?
     Multiprocessor support?
     Other build options?

Can anyone clarify what you need for any of these other options?
==

BUILD_EXAMPLES=ON # doens't *need* to be on, but if you're learning VTK,
why not?
BUILD_SHARED_LIBS=ON
CMAKE_INSTALL_PREFIX=/usr/local/ 
VTK_DATA_ROOT=(path where VTKData.readme can be found)
VTK_USE_CARBON=ON
VTK_USE_COCOA=OFF
VTK_USE_HYBRID=ON
VTK_USE_PARALLEL=OFF # 'ON' doesn't seem to build, even on a
multi-processor machine
VTK_USE_X=OFF
VTK_WRAP_JAVA=OFF
# need both of these if you want Python wrappers
VTK_WRAP_PYTHON=ON
VTK_WRAP_TCL=ON
# not sure of the two below are *really* necessary.  Defaults are OFF &
ON respectively.
CMAKE_SKIP_RPATH=ON
BUILD_TESTING=OFF

# updates CMakeLists.txt file, then continues to prompt
# CMake should find Tcl/Tk headers & set for framework builds so you
should just be able
# to accept the default values at this point.

% make [options]
#  options = -j4 (dual processor machine) 70 minutes on 450MHz Dual G4
#            -j2 (single processor machine)

To see if everything built correctly, you can do a test of your local
build with
% ./bin/vtkpython Examples/Medical/Python/Medical3.py
(assuming you're in $HOME/Development/VTK)

Now to install it system-wide:

% sudo make install
# among other things, moves *.so & .*dylib to [installpath]/lib/vtk
# and useful binaries into [installpath]/bin

% cd Wrapping/Python/
% sudo /usr/local/bin/python setup.py install
# builds and installs the python wrappers in site-packages/vtk_python/
# should build links to *.so & *.dylib but *.dylib isn't working
# so make sure you

Make sure these are in you DYLD_LIBRARY_PATH and LD_LIBRARY_PATH
(put in your .cshrc?)
% setenv DYLD_LIBRARY_PATH /usr/local/lib/vtk/
% setenv LD_LIBRARY_PATH /usr/local/lib/vtk/

At this point, you should be able to run from your $HOME directory:
% cd
% pythonw Development/VTK/Examples/Medical/Python/Medical3.py

This appears to work in many cases but there seems to be a problem with
the tkFileDialog module which is crashing MayaVi.

--
Dr. William T."Tom" Bridgman           Scientific Visualization Studio
Global Science & Technology, Inc.      NASA/Goddard Space Flight Center
Email: bridgman at wyeth.gsfc.nasa.gov    Code 935
Phone: 301-286-1346                    Greenbelt, MD 20771
FAX:   TBD                             http://svs.gsfc.nasa.gov/



More information about the vtkusers mailing list