BUILD_NOTES_MacOSX 60.4 KB
Newer Older
hrchilds's avatar
hrchilds committed
1
                         Building VisIt on MacOS X
hrchilds's avatar
hrchilds committed
2
                         =========================
hrchilds's avatar
hrchilds committed
3

treadway's avatar
treadway committed
4 5 6 7 8 9
This document describes how to build VisIt on MacOS X under at least 10.4.x 
on Intel and 10.3.9 on PPC. 

build_visit
  The recomended method for building VisIt on MacOS X is to use the 
  build_visit script available at:
10
    http://www.llnl.gov/VisIt/1.11.2/build_visit 
treadway's avatar
treadway committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24
  Note: you may need to restore the execute permissions after downloading
  with, chmod +x build_visit
  Using build_visit a basic build for the Mac can be initiated with:
     ./build_visit -z
  The above command will download the required VisIt and 3rd party source code,
  configuring, and building it all using your C++ compiler. The full-blown
  version of VisIt (same as the binary distribution minus Mili) use:
    ./build_visit -45bcefgnrwz 
  Some users are more comfortable with a GUI interface. The build_visit script
  optionally uses dialog, a script-interpreter which providing a set of curses
  widgets, similar to the what is used in Linux kernel configuration. Dialog
  is not include in the distribution of MacOS X. A source distribution of
  dialog is available at: http://invisible-island.net/dialog/dialog.tar.gz,
  and a Universal binary is available at:
25
    http://www.llnl.gov/VisIt/1.9.1/dialog
treadway's avatar
treadway committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
  Note: you may need to restore the execute permissions after downloading
  with, chmod +x dialog

Universal binary
  The single step building of a universal binary for MacOS X is impossible
  at this point. The resulting binary using diables exceptions on the PowerPC
  Mac, and most of the third pary libraries can't perform the required
  cross-compile. A good reference for some of the issues involved
  is: http://developer.apple.com/technotes/tn2005/tn2137.html. 
  The Mac binaries adds a significant degree of difficulty to the VisIt build.
  Some of the reasons for this complexity include:
  1) MacOS X dynamic shared libraries use the .dylib extension. The later GNU
  autotools, and libtool know about this, but the library must be built using 
  these later versions. If the package is a few years old there's a good chance
  it doesn't know how to build dynamic libraries for the Mac.
  2) Intel Mac binaries require gcc/g++-4.x. Quite a few of the third-party 
  libraries are a few years old, and even though they use configure, they were
  released before MacOS X and gcc-4.x.
  3) The Intel Mac is not the same architecture as the PPC Mac. Some packages 
  even if they do support the MacOS X, assume that MacOS X = PowerPC (32-bit
  only). This gets even more complex, when 4-way universal binaries (ppc, i386,
  ppc_64, and x86_64) are desired.
  4) The configure file are created with older autoconf scripts which don't 
  support either: Mac OS X, gcc-4.x, or cross-compiling. In the worse case
  configure can't determine that a cross compile is required, and configure
  can't determine the target machines characteristics by running code the build
  machine.
  5) The third-pary configure  doesn't support the building universal 
  binaries. Problems develop when configure determines the endianness or word
  size for compiling. Universal binaries must make this determination during
  the compile. Each architecture in a universal binary requires it's own
  separate compile.
  Building of a universal install target requires 2 independent builds of VisIt
  and its supporting libraries. The PowerPC Mac be running at least MacOS
  X10.3.9, and the Intel Mac running MacOS X10.4.x (Tiger). Each build is put
61 62
  into a binary distribution tarball (e.g., visit1_11_2.darwin-ppc.tar.gz or
  visit1_11_2.darwin-i386.tar.gz) by the clearcase_bin/visit-bin-dist step.
treadway's avatar
treadway committed
63
  Each of these tarballs can be installed in a executable distributions,
64
  see: http://www/visit/1.11.2/INSTALL_NOTES.
treadway's avatar
treadway committed
65

66
Build Notes (if you still want to do it by hand)
treadway's avatar
treadway committed
67 68 69 70 71 72
  VisIt relies on several external libraries which must be built and installed
  prior to building VisIt.  This document provides detailed step by step
  instructions for building VisIt and each of the dependent libraries.  The
  instructions have been designed so that you can cut and paste most of the
  commands needed to build the libraries and VisIt from this file into your
  shell prompt.
hrchilds's avatar
hrchilds committed
73

hrchilds's avatar
hrchilds committed
74 75
    Library  Version  Description           For More Information
    =======  =======  ===========           ====================
treadway's avatar
treadway committed
76 77
    Mesa     6.4.2    3-D Graphics Library  http://www.mesa3d.org/
                   http://www.llnl.gov/visit/3rd_party/Mesalib-6.4.2.tar.gz
hrchilds's avatar
hrchilds committed
78
    Python   2.5      Scripting Language    http://www.python.org
treadway's avatar
treadway committed
79
                   http://www.llnl.gov/visit/3rd_party/Python-2.5.tar.gz
80 81
    Qt       4.4.3    GUI Toolkit           http://www.trolltech.com
                   http://www.llnl.gov/visit/3rd_party/qt-mac-opensource-4.4.3.tar.gz
hrchilds's avatar
hrchilds committed
82
    VTK      5.0.0c   Visualization Toolkit http://www.vtk.org
treadway's avatar
treadway committed
83
                   http://www.llnl.gov/visit/3rd_party/vtk-5.0.0c.tar.gz
hrchilds's avatar
hrchilds committed
84
    cmake    2.4.5    Make file generation  http://www.cmake.org
treadway's avatar
treadway committed
85
                   http://www.llnl.gov/visit/3rd_party/cmake-2.4.5.tar.gz
hrchilds's avatar
hrchilds committed
86
    Silo     4.5.1    File I/O library       
treadway's avatar
treadway committed
87
                   http://www.llnl.gov/visit/3rd_party/silo060605.sh
hrchilds's avatar
hrchilds committed
88
    
hrchilds's avatar
hrchilds committed
89 90
    Optional Version  Description           For More Information
    ======== =======  ===========           ====================
treadway's avatar
treadway committed
91 92
    Boxlib   2.5      An AMR I/O library    
                   http://www.llnl.gov/visit/3rd_party/boxlib.tar.rz
hrchilds's avatar
hrchilds committed
93 94
    CFITSIO  3006     File I/O library       
                             http://heasarc.gsfc.nasa.gov/docs/heasarc/fits.html
treadway's avatar
treadway committed
95
                   http://www.llnl.gov/visit/3rd_party/cfitsio3006.tar.gz
hrchilds's avatar
hrchilds committed
96
    CGNS     2.4.3    File I/O library      http://www.cgns.org    
treadway's avatar
treadway committed
97
                   http://www.llnl.gov/visit/3rd_party/cgnslib_2.4-3.tar.gz
hrchilds's avatar
hrchilds committed
98
    ExodusII 4.46     File I/O library      http://www.sourceforge.net/projects/
treadway's avatar
treadway committed
99
                   http://www.llnl.gov/visit/3rd_party/exodusii-4.46.tar.gz
hrchilds's avatar
hrchilds committed
100
    GDAL     1.3.2    GIS reader library    http://www.gdal.org
treadway's avatar
treadway committed
101 102 103 104 105 106 107 108 109 110
                   http://www.llnl.gov/visit/3rd_party/gdal-1.3.2.tar.gz
    H5Part   1.3.3    I/O library           
                             https://codeforge.lbl.gov/projects/h5part
                   http://www.llnl.gov/visit/3rd_party/H5Part-20070711.tar.gz
    HDF4     2.4.1    I/O library           
                             http://hdfgroup.org/products/hdf4/index.html
                   http://www.llnl.gov/visit/3rd_party/HDF4.2r1.tar.gz
    HDF5     1.6.5    I/O library           
                             http://hdfgroup.org/products/hdf5/index.html
                   http://www.llnl.gov/visit/3rd_party/hdf5-1.6.5.tar.gz
hrchilds's avatar
hrchilds committed
111
    Mili     1.09     I/O library           (none)    
treadway's avatar
treadway committed
112
                   NOT RELEASED
hrchilds's avatar
hrchilds committed
113
    netCDF   3.6.0    File I/O library       
treadway's avatar
treadway committed
114 115 116 117 118
                             http://www.unidata.ucar.edu/packages/netcdf/
                   http://www.llnl.gov/visit/3rd_party/netcdf.tar.gz
    szip     2.1      szip-2.1.tar.gz         
                             http://hdfgroup.org/doc_resource/SZIP/
                   http://www.llnl.gov/visit/3rd_party/szip-2.1.tar.gz
hrchilds's avatar
hrchilds committed
119
    
treadway's avatar
treadway committed
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
  The public version of VisIt has been built with the above listed versions
  of the libraries, so it is known to work properly with those versions.  For
  all the packages except VTK and Qt, you can probably use newer versions of
  the packages and VisIt should work properly. For VTK, you must use the 5.0.0c
  distribution provided on the VisIt Web site, because extensions/fixes have
  been added to the VTK-5.x library. The version of Qt used to build VisIt on
  MacOS X must be greater than or equal to 3.3.6 to support gcc-4.x and Intel
  Mac. For Mesa, you must build a mangled version of Mesa.  

  All of the third party libraries necessary to build VisIt (except Mili,
  whose sources hasn't been released) are available for download from:
  http://www.llnl.gov/visit/3rd_party/.  It is suggested that you start there
  and then go to the "For More Information" web sites for any remaining
  libraries.

  It is essential that you build all the dependent packages and VisIt using
  the same c++ compiler or you will encounter linking problems because
  different compilers or different versions of the same compiler may use
  different name mangling schemes. For MacOS X, we recommend using at least
  Xcode 2.4.1.
hrchilds's avatar
hrchilds committed
140 141 142


==============================================================================
hrchilds's avatar
hrchilds committed
143
Crucial linker flags for dynamic library
hrchilds's avatar
hrchilds committed
144 145 146 147
==============================================================================

-install_name        The -install_name flag inserts the name of the library
                     into the actual dylib file. Normally if you do not
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
                     provide this flag, the path where you built the library is
                     inserted into the dylib file and applications that link
                     with the dylib look for it in the path stored in the dylib,
                     which easily leads to the library not being found. In order
                     to make sure that the system can find the dylib file used
                     by your application, make sure you build dylib files so
                     their installed name is relative to the executable.
                   
                     For VisIt, which has a bin directory and a separate lib
                     directory for libraries, we set the installation name like
                     this:
                     
                     -install_name,@executable_path/../lib/libfoo.dylib.
                     
                     The above example makes sure that applications in bin that
                     linked with libfoo.dylib look for it in ../lib instead of
                     a hardcoded path.
                 
hrchilds's avatar
hrchilds committed
166 167

==============================================================================
hrchilds's avatar
hrchilds committed
168
install_name_tool
hrchilds's avatar
hrchilds committed
169 170
==============================================================================

hrchilds's avatar
hrchilds committed
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
This tool allows us to change information about where an application looks for 
libraries or what these libraries are called. By changing the internal file
information we can use relative paths to the 3rd party libraries, and not
relaying on DYLD_LIBRARY_PATH (or LD_LIBRARY_PATH) environment variables.
For example the multithreaded version of Qt, replace libqt.3.dylib with 
libqt-mt.3.dylib, the build scripts all assume libqt.dylib (or simply -lqt).
Assume we must update both the library and an executable so that they know 
where the qt library can be found. This is where the install_name_tool 
command-line tool comes in handy. For the Qt library:
    cp libqt-mt.3.dylib libqt.dylib
    install_name_tool -id @executable_path/../lib/libqt.dylib \
        libqt.dylib
    
And for included libraries, and the executable:
    install_name_tool \
        -change libqt-mt.3.dylib \
        @executable_path/../lib/libqt.dylib \
        demo
    
The "@executable_path" symbol should to be typed as is; it must not be replaced 
by the real path to the executable on your machine.
hrchilds's avatar
hrchilds committed
192 193 194 195 196 197

==============================================================================
otool
==============================================================================

MacOS X has a utility called otool that allows you to examine the contents of
hrchilds's avatar
hrchilds committed
198 199 200 201 202 203 204
a dynamic library or an executable. This tool performs function similar to the
ldd tool (used in Linux). Otool is very handy for determining the names and
locations of the dynamic library's needed for this binary. Here are the most 
useful options for otool:

# Print all of the dependent libraries
otool -L libfoo.dylib
hrchilds's avatar
hrchilds committed
205

hrchilds's avatar
hrchilds committed
206 207 208
==============================================================================
Creating dynamic libraries
==============================================================================
hrchilds's avatar
hrchilds committed
209

hrchilds's avatar
hrchilds committed
210 211 212
Use gxx/g++ in place of the link editor on the specified input object files to
creates the dynamic library.  The library's name  is specified  by  output  
(the argument to the -o flag).  The input object files may be in any correct
treadway's avatar
treadway committed
213 214 215 216
format that contains universal object files, or plain object files. The 
options: -install_name, -compatibility_version, -current_version, 
-undefined dynamic_lookup, and -header-pad_max_install_names must be embedded
in the -Wl, option for passage to the linker.
hrchilds's avatar
hrchilds committed
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237

Example:
gcc -dynamiclib -o libfoo.dylib src/*.o \
-Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,\
-compatibility_version,2.0,-current_version,2.2.1,\
-install_name,@executable_path/../lib/libfoo.dylib

Example for universal binary:
gcc -dynamiclib -o libfoo.dylib src/*.o \
-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk,\
-headerpad_max_install_names,-undefined,dynamic_lookup,\
-compatibility_version,2.0,-current_version,2.2.1,\
-install_name,@executable_path/../lib/libfoo.dylib \
 -arch ppc -arch i386

==============================================================================
Creating dynamic libraries from static libraries
==============================================================================

Using Apple's custom libtool command takes the specified input object files and
creates dynamic a library for use with the link editor, ld(1).  The library's 
treadway's avatar
treadway committed
238 239
name  is specified  by  output  (the argument to the -o flag).  The input
object files may be in any correct format that contains universal object files,
hrchilds's avatar
hrchilds committed
240 241 242 243 244 245 246 247 248 249
archives, object files. The options: -install_name, -compatibility_version, 
current_version, -multiply_defined, and -header-pad_max_install_names are
commonly used.

Example:
libtool -o libfoo.dylib-i386 -dynamic libfoo.a -lSystem \
-twolevel_namespace -undefined dynamic_lookup -arch_only i386 \
-headerpad_max_install_names \
-install_name @executable_path/../lib/libfoo.dylib \
-compatibility_version 1.0 -current_version 1.1.5
hrchilds's avatar
hrchilds committed
250

treadway's avatar
treadway committed
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
However it's been found that some third party libraries fail to produce working
dynamic libraries using the above method. So a relinking of the object files is
required to create a dynamic library.

Example:
mkdir tmpdir
cd tmpdir
ar x ../libfoo.a
gcc -dynamiclib -o ../libfoo.dylib *.o \
-Wl,-headerpad_max_install_names,\
-compatibility_version,2.0,-current_version,2.2.1,\
-install_name,@executable_path/../lib/libfoo.dylib
cd ..
rm -rf tmpdir

hrchilds's avatar
hrchilds committed
266 267 268 269 270 271 272
==============================================================================
Building an application that can run on multiple versions of MacOS X
==============================================================================

By default, the linker on MacOS X will resolve all system library dependencies
such that the final linked binary file will depend on a particular version of
the system libraries. For example, this prevents you from building on 
hrchilds's avatar
hrchilds committed
273
MacOS X 10.4 and running your application on MacOS X 10.3. As of MacOS X 10.3,
hrchilds's avatar
hrchilds committed
274
there is a special linker flag, called -undefined, that allows system library
hrchilds's avatar
hrchilds committed
275
dependencies to be left undefined during the link step. There is 
hrchilds's avatar
hrchilds committed
276 277 278 279 280 281 282 283 284 285 286
also an environment variable called MACOSX_DEPLOYMENT_TARGET that can be 
set to tell the linker which versions of the system libraries to expect. 
Setting the  MACOSX_DEPLOYMENT_TARGET environment variable and using the
-undefined linker flag will help your compiled application run on more than
one version of MacOS X.

To make sure that when you build an application on MacOS X 10.3, it can also 
run on MacOS X 10.4 and beyond, you should set the MACOSX_DEPLOYMENT_TARGET
environment variable before you build your application.

Example:
hrchilds's avatar
hrchilds committed
287
export MACOSX_DEPLOYMENT_TARGET=10.3
hrchilds's avatar
hrchilds committed
288

hrchilds's avatar
hrchilds committed
289 290 291
You should also add the -headerpad_max_install_names to your LDFLAGS in your
Makefile, this option allows renaming of the install name stored in the
dynamic library file.
hrchilds's avatar
hrchilds committed
292

hrchilds's avatar
hrchilds committed
293
These are the default linker flags for the Mac used by VisIt.
hrchilds's avatar
hrchilds committed
294
Example:
hrchilds's avatar
hrchilds committed
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
LDFLAGS="$LDFLAGS -Wl,-undefined,dynamic_lookup,-headerpad_max_install_names"

==============================================================================
Configuring universal binaries on MacOS X
==============================================================================

The first approach is to simply have configure build a universal binary, by
passing in the appropriate CFLAGS, CXXFLAGS and LDFLAGS environment variables. 
This isdone simply by running:
./configure --prefix=${VISITPATH}/foo CXXFLAGS=\
 "-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" \
 CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" \
 LDFLAGS="-arch i386 -arch ppc"  --disable-dependency-tracking
 
The --disable-dependency-tracking option to configure causes it to not use gcc's
built-in dependency generation code, which does not work with multiple -arch
targets.

This is the easiest means of generating universal binaries, but unfortunatly
most older configure scripts will not support this feature.

With MacOS X 10.5 a 4-way universial binary can be created by adding:
-arch ppc_64 -arch x86_64 to the flags.

==============================================================================
Universal binaries on MacOS X by merging multiple builds
==============================================================================

If the third-party library does care about byte order, word size, or pointer
size, and configure supports cross-compiling. Multiple invocations of 
configure/make will generate architecture based objects, that can in turn can 
be merged into universal binaries. Not all open source projects follow these
convensions. The lipo command is used to merge the multiple builds.

In the worse case (configu doen't support cross-compiling) multiple machines
will be needed to generate the architecture based objects.

On both an Intel- and PowerPC-based Macintosh, configure and build the program
as follows:
./configure --prefix=${VISITPATH}/foo
make

Copy the resultant libfoo.dylib programs to a single machine; for example, into
/tmp on a PowerPC-based Macintosh, with the names libfoo.dylib-intel and
libfoo.dylib-ppc, respectively. Then, use the lipo command to combine the two:

lipo -create libfoo.dylib-intel libfoo.dylib-ppc -output libfoo.dylib

As before, the file command can verify the file contents:
$ file libfoo.dylib
libfoo.dylib: Mach-O universal binary with 2 architectures
libfoo.dylib (for architecture ppc):        Mach-O dynamically linked shared
library ppc
libfoo.dylib (for architecture i386):       Mach-O dynamically linked shared
library i386

The same procedure as above applies to executables.
hrchilds's avatar
hrchilds committed
352

hrchilds's avatar
hrchilds committed
353 354 355 356 357 358 359
==============================================================================
Support libraries
==============================================================================

Most of the instructions in this document are for building the various support
libraries that VisIt depends on as prebound dynamic libraries. Few of the
libraries that VisIt uses actually have support in their make system for
hrchilds's avatar
hrchilds committed
360 361 362 363
producing universal binary libraries so it is imperative that you follow the
directions. The following procedure used an Intel-Mac as the primary build
machine, also a PowerPC-Mac was required to build a few of the 3-party
libraries that didn't support cross compiling.
hrchilds's avatar
hrchilds committed
364 365

Before building VisIt or any of its support libraries, you need to create a
hrchilds's avatar
hrchilds committed
366 367 368
"visit" directory in which the support libraries will be installed. We also 
create a file that contains the path so we can use that in some of the
instructions later on.
hrchilds's avatar
hrchilds committed
369 370 371

mkdir visit
echo `pwd`/visit > visitpath
hrchilds's avatar
hrchilds committed
372
export VISITPATH="`pwd`/visit"
hrchilds's avatar
hrchilds committed
373

hrchilds's avatar
hrchilds committed
374 375 376 377 378 379 380
Also, note when these instructions indicate that a library's source code must
be replaced or modified. VTK requires some source code modifications before
compilation. Since the source exists within VisIt's source code directory, 
take this opportunity to unzip VisIt's source code distribution and set an
environment variable that will be used to identify VisIt's source code 
directory.

hrchilds's avatar
hrchilds committed
381 382
# Make sure that you build a version of VisIt that can run on MacOS X 10.3
# and later.
hrchilds's avatar
hrchilds committed
383
export MACOSX_DEPLOYMENT_TARGET=10.3
hrchilds's avatar
hrchilds committed
384

hrchilds's avatar
hrchilds committed
385
==============================================================================
386
Building Qt 4 frameworks
hrchilds's avatar
hrchilds committed
387 388
==============================================================================

389
Qt 4 builds as a set of frameworks.
hrchilds's avatar
hrchilds committed
390

hrchilds's avatar
hrchilds committed
391
# Unzip the Qt source
392 393
tar zxf qt-mac-opensource-4.4.3.tar.gz
cd qt-mac-opensource-4.4.3
hrchilds's avatar
hrchilds committed
394

395 396
# Build Qt 4
./configure --prefix=$VISITPATH/qt -make libs -make tools -fast -no-separate-debug-info -no-qt3support -no-dbus -no-sql-mysql -no-sql-sqlite 
hrchilds's avatar
hrchilds committed
397 398
make

399
# Install Qt 4
hrchilds's avatar
hrchilds committed
400
make install
401
cd ..
hrchilds's avatar
hrchilds committed
402 403

==============================================================================
treadway's avatar
treadway committed
404
Building Mesa 
405
==============================================================================              
hrchilds's avatar
hrchilds committed
406 407 408 409 410 411 412

Mesa is a 3-D graphics library with an API which is very similar to that of
OpenGL.  It is used for performing off-screen rendering.

#
# Build Mesa
#
treadway's avatar
treadway committed
413 414
tar zxf MesaLib-6.4.2.tar.gz
cd Mesa-6.4.2
hrchilds's avatar
hrchilds committed
415 416 417 418 419 420 421

#
# Special instructions for building Mesa on MacOS X
#
# The darwin target for building Mesa assumes that you want to build Mesa
# with support for X11. This is not what we want to do for the version of
# Mesa that we'll use for VisIt since we only want offscreen rendering.
hrchilds's avatar
hrchilds committed
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438

# Remove the X11 libraries, and change GL_LIB so it will build a 
# library called libMesaGL.dylib instead of libGL.dylib. Finally, 
# edit GLU_LIB_DEPS so it uses -lMesaGL instead of -lGL.
vi configs/default
#    Change:
#      GL_LIB = GL
#      GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread
#      GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) \
#           $(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lm
#      GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(EXTRA_LIB_PATH) \
#           -lXt -lX11
#      to
#      GL_LIB = MesaGL
#      GL_LIB_DEPS = -lm -lpthread
#      GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm
#      GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
hrchilds's avatar
hrchilds committed
439
#
hrchilds's avatar
hrchilds committed
440 441 442 443 444 445 446
# Remove all X include files and libraries from the darwin target. Also add 
# -DUSE_MGL_NAMESPACE to the CFLAGS so a mangled version of Mesa will be built.
# edit configs/darwin-x86 for intel, configs/darwin for PPC, and
# configs/darwin-x86ppc for a universal build.
vi configs/darwin-x86ppc
#    Remove -I/usr/X11R6/include from CFLAGS, and CXXFLAGS.
#    Add -DUSE_MGL_NAMESPACE to the end of CFLAGS, and CXXFLAGS.
hrchilds's avatar
hrchilds committed
447
#
hrchilds's avatar
hrchilds committed
448 449 450 451 452 453 454 455 456 457 458
#    Change:
#      GL_LIB_NAME = libGL.dylib
#      GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread
#      OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lGL
#      GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lGL
#      GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lGL -lGLU -L/usr/X11R6/lib -lX11 \
#      -lXmu -lXi -lXext
#      GLW_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXt $(TOP)/lib/GL.dylib
#      APP_LIB_DEPS = -L$(TOP)/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \
#      -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm
#      to
treadway's avatar
treadway committed
459
#      GL_LIB_NAME = libMesaGL.dylib
hrchilds's avatar
hrchilds committed
460 461 462 463 464 465
#      GL_LIB_DEPS = -lm -lpthread
#      OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lMesaGL
#      GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lMesaGL
#      GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lMesaGL -lGLU
#      GLW_LIB_DEPS = $(TOP)/lib/MesaGL.dylib
#      APP_LIB_DEPS = -L$(TOP)/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
hrchilds's avatar
hrchilds committed
466
#
hrchilds's avatar
hrchilds committed
467 468 469 470 471 472 473 474 475
# Remove all of the source code files from the X11_DRIVER_SOURCES variable.
vi src/mesa/sources
#    Change:
#      X11_DRIVER_SOURCES =            \
#              drivers/x11/glxapi.c    \
#         . . .
#              drivers/x11/xm_tri.c
#    to:
#       X11_DRIVER_SOURCES =
hrchilds's avatar
hrchilds committed
476 477

#
treadway's avatar
treadway committed
478
# Build Mesa by typing in the Mesa-6.4.2 directory.
hrchilds's avatar
hrchilds committed
479
#
treadway's avatar
treadway committed
480
make darwin
hrchilds's avatar
hrchilds committed
481 482 483 484

#
# Install Mesa
#
hrchilds's avatar
hrchilds committed
485 486 487 488 489 490 491 492 493 494 495 496 497 498
make INSTALL_DIR=$VISITPATH/mesa install
cp lib/libMesa*.dylib $VISITPATH/mesa/lib
cd $VISITPATH/mesa/lib
rm libMesaGL.dylib
cp libMesaGL.1.dylib libMesaGL.dylib
install_name_tool -id @executable_path/../lib/libMesaGL.dylib \
libMesaGL.dylib
rm libOSMesa.dylib
cp libOSMesa.6.dylib libOSMesa.dylib
install_name_tool -id @executable_path/../lib/libOSMesa.dylib \
libOSMesa.dylib
install_name_tool -change libMesaGL.1.dylib \
@executable_path/../lib/libMesaGL.dylib libOSMesa.dylib
cd ../../..
hrchilds's avatar
hrchilds committed
499 500 501 502 503 504

==============================================================================
Building CMake in order to build VTK
==============================================================================

CMake is a cross-platform make system used to build VTK. Before building VTK,
hrchilds's avatar
hrchilds committed
505 506
we must build CMake. The VisIt third-party contains the older cmake-2.2.3 
It didn't build for me so I'm using the more recent cmake-2.4.5.
hrchilds's avatar
hrchilds committed
507

hrchilds's avatar
hrchilds committed
508 509 510
tar zxf cmake-2.4.5.tar.gz
cd cmake-2.4.5
env CXXFLAGS="" CFLAGS="" ./bootstrap
hrchilds's avatar
hrchilds committed
511 512 513 514 515 516 517 518 519 520 521
make
cd ..

==============================================================================
Building VTK as a set of prebound dynamic libraries
==============================================================================

VTK is an object oriented library for visualizing 3D data.  VisIt uses it
for all its visualization functionality. Follow the directions listed below
to build VTK.  If you have any problems building or installing VTK, read the
VTK/README.html file included in the VTK distribution for more information.
hrchilds's avatar
hrchilds committed
522 523
This distribution however would not build as 2-way universal binary without
building on separate machines.
hrchilds's avatar
hrchilds committed
524

hrchilds's avatar
hrchilds committed
525 526
tar zxf vtk-5.0.0c.tar.gz
cd VTK
hrchilds's avatar
hrchilds committed
527 528 529 530 531

Source code and build modifications:
====================================

The above VTK distribution must be modified a little to support features that
treadway's avatar
treadway committed
532 533 534 535 536 537 538
VisIt needs in order to run properly. For example, VisIt requires VTK to be
built with support for mangled mesa in order to support offscreen rendering.
VisIt uses offscreen rendering to save images, do scalable rendering in 
parallel, and to render images when the CLI is run in -nowin mode. VTK cannot
be built with mangled mesa support on MacOS X without some modifications to 
its source code and build system. Follow each of the next instructions before
building VTK to ensure that you produce VTK libraries that meet VisIt's needs.
hrchilds's avatar
hrchilds committed
539

hrchilds's avatar
hrchilds committed
540 541
vi CMakeLists.txt
# Look for the 2 lines containing: 
hrchilds's avatar
hrchilds committed
542
   -flat_namespace,-U,_environ
hrchilds's avatar
hrchilds committed
543
# and replace with: 
hrchilds's avatar
hrchilds committed
544
   -twolevel_namespace,-headerpad_max_install_names
hrchilds's avatar
hrchilds committed
545
# On the 2 lines containing:
hrchilds's avatar
hrchilds committed
546
   -no-cpp-precomp 
hrchilds's avatar
hrchilds committed
547
# add: 
hrchilds's avatar
hrchilds committed
548 549
   -fno-common

hrchilds's avatar
hrchilds committed
550 551
# Add a "#" to references to Widget library, search and change the 4 following
# lines:
hrchilds's avatar
hrchilds committed
552 553 554 555 556
   # SET(VTK_KITS ${VTK_KITS} WIDGETS)
   # SUBDIRS(Widgets)
   #   SUBDIRS(Widgets/Testing)
   #   INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h vtkWidgetsInstantiator)

hrchilds's avatar
hrchilds committed
557 558 559 560
vi Utilities/ftgl/CMakeLists.txt
# look for:
   SET (VTKFTGL_LIBS "${VTKFTGL_LIBS};${OPENGL_gl_LIBRARY}")
# Add the following code after the above string:
hrchilds's avatar
hrchilds committed
561

hrchilds's avatar
hrchilds committed
562 563 564
IF (FTGL_SUPPORT_MANGLE_MESA)
 SET (VTKFTGL_LIBS "${VTKFTGL_LIBS};${MANGLED_MESA_LIBRARY}")
ENDIF (FTGL_SUPPORT_MANGLE_MESA)
hrchilds's avatar
hrchilds committed
565

hrchilds's avatar
hrchilds committed
566 567
vi Rendering/CMakeLists.txt
# remove the line that contains:
hrchilds's avatar
hrchilds committed
568 569
   vtkXMesaRenderWindow.cxx.

treadway's avatar
treadway committed
570
vi Rendering/vtkGraphicsFactory.cxx
hrchilds's avatar
hrchilds committed
571 572 573 574 575 576 577 578
# wrap the
   #include "vtkXMesaRenderWindow.h"
# with:
   #if !defined(__APPLE__)
   #include "vtkXMesaRenderWindow.h"
   #endif
# to prevent that header from being included.

treadway's avatar
treadway committed
579
vi Rendering/vtkXMesaRenderWindow.cxx
hrchilds's avatar
hrchilds committed
580 581 582 583 584 585 586 587
# change:
   #include "vtkXMesaRenderWindow.h"
# to:
   #if !defined(__APPLE__)
   #include "vtkXMesaRenderWindow.h"
   #else
   #include "vtkMesaRenderWindow.h"
   #endif
hrchilds's avatar
hrchilds committed
588

hrchilds's avatar
hrchilds committed
589 590 591
vi Rendering/vtkImagingFactory.cxx
# The vtkImagingFactory class does not support creation of Mesa objects under
# Carbon. Find the code that looks like this:
hrchilds's avatar
hrchilds committed
592

hrchilds's avatar
hrchilds committed
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609
#ifdef VTK_USE_CARBON
  if (!strcmp("CarbonOpenGL",rl))
    {
    if(strcmp(vtkclassname, "vtkTextMapper") == 0)
      {
      return vtkOpenGLFreeTypeTextMapper::New();
      }
    if(strcmp(vtkclassname, "vtkImageMapper") == 0)
      {
      return vtkOpenGLImageMapper::New();
      }
    if(strcmp(vtkclassname, "vtkPolyDataMapper2D") == 0)
      {
      return vtkOpenGLPolyDataMapper2D::New();
      }
    }
#endif
hrchilds's avatar
hrchilds committed
610

hrchilds's avatar
hrchilds committed
611 612
# Modify that code so it includes the code to create Mesa objects when VTK has
# been instructed to use Mesa. The modified code will look like this:   
hrchilds's avatar
hrchilds committed
613

hrchilds's avatar
hrchilds committed
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648
#ifdef VTK_USE_CARBON
  if (!strcmp("CarbonOpenGL",rl))
    {
    if(strcmp(vtkclassname, "vtkTextMapper") == 0)
      {
#if defined(VTK_USE_MANGLED_MESA)
      if ( vtkImagingFactory::UseMesaClasses )
        {
        return vtkMesaFreeTypeTextMapper::New();
        }
#endif
      return vtkOpenGLFreeTypeTextMapper::New();
      }
    if(strcmp(vtkclassname, "vtkImageMapper") == 0)
      {
#if defined(VTK_USE_MANGLED_MESA)
      if ( vtkImagingFactory::UseMesaClasses )
        {
        return vtkMesaImageMapper::New();
        }
#endif
      return vtkOpenGLImageMapper::New();
      }
    if(strcmp(vtkclassname, "vtkPolyDataMapper2D") == 0)
      {
#if defined(VTK_USE_MANGLED_MESA)
      if ( vtkImagingFactory::UseMesaClasses )
        {
        return vtkMesaPolyDataMapper2D::New();
        }
#endif
      return vtkOpenGLPolyDataMapper2D::New();
      }
    }
#endif
hrchilds's avatar
hrchilds committed
649 650 651 652 653 654 655 656 657 658 659 660

You may have noticed that we don't do anything in VTK to preclude the use of
vtkCarbonRenderWindow, even though it cannot support Mesa. We register an
override of vtkCarbonRenderWindow later in VisIt's visit_vtk library that
forces VTK to create one of VisIt's vtkOSMesaRenderWindow objects instead
of creating vtkCarbonRenderWindow objects. This allows us to do offscreen
rendering in MacOS X without having to rewrite vtkCarbonRenderWindow.


Configuring VTK:
================

hrchilds's avatar
hrchilds committed
661
../cmake-2.4.5/bin/ccmake .
hrchilds's avatar
hrchilds committed
662 663 664 665 666 667 668 669 670 671 672 673

The above ccmake program is a menu for configuring VTK. Follow these steps to 
configure VTK and generate its makefiles. You must perform these steps before
you can build VTK.

1. First, press "c" for configure.
2. When it is finished, press "t" for advanced options, and change the 
   options listed below:

    Option                             Value
    =================================================
    SHARED_LIBS                        ON
hrchilds's avatar
hrchilds committed
674
    BUILD_TESTING                      OFF
hrchilds's avatar
hrchilds committed
675
    CMAKE_BUILD_TYPE                   Release
hrchilds's avatar
hrchilds committed
676 677 678 679 680 681
    CMAKE_CXX_FLAGS_RELEASE            -O3 -fno-common
    CMAKE_C_FLAGS_RELEASE              -O3 -fno-common
    CMAKE_EXE_LINKER_FLAGS_RELEASE     -Wl,-headerpad_max_install_names
    CMAKE_MODULE_LINKER_FLAGS_RELEASE  -Wl,-headerpad_max_install_names
    CMAKE_SHARED_LINKER_FLAGS_RELEASE  -Wl,-headerpad_max_install_names,\
-compatibility_version,5.0,-current_version,5.0.0
treadway's avatar
treadway committed
682
    CMAKE_VERBOSE_MAKEFILE             ON
hrchilds's avatar
hrchilds committed
683 684
    VTK_USE_MANGLED_MESA               ON

hrchilds's avatar
hrchilds committed
685 686 687
3. Type "c" to make ccmake configure. When it is done there are more options 
   to fill in. The use of $VISITPATH in this case is for illustration purposes
   only. Since you are inside of ccmake, substitute the actual value for
treadway's avatar
treadway committed
688
   $VISITPATH instead of using the $VISITPATH environment variable.
hrchilds's avatar
hrchilds committed
689 690 691

   Option                              Value
   =================================================
hrchilds's avatar
hrchilds committed
692 693
   MANGLED_MESA_INCLUDE_DIR            $VISITPATH/mesa/include
   MANGLED_MESA_LIBRARY                $VISITPATH/mesa/lib/libMesaGL.dylib
treadway's avatar
treadway committed
694 695
   MANGLED_OSMESA_INCLUDE_DIR          $VISITPATH/mesa/include
   MANGLED_OSMESA_LIBRARY              $VISITPATH/mesa/lib/libOSMesa.dylib
hrchilds's avatar
hrchilds committed
696 697 698 699 700 701 702 703

4. Type "c" to configure
5. Type "g" to generate and quit


Building VTK:
=============

hrchilds's avatar
hrchilds committed
704 705
# Now that VTK's source and build have been modified and you've configured and
# generated VTK's Makefiles, you can start building VTK.
hrchilds's avatar
hrchilds committed
706

hrchilds's avatar
hrchilds committed
707 708
make

hrchilds's avatar
hrchilds committed
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725
#
# fix the internal name with in the libraries
#
# first change the libraries name and identification by executing the following
# bourne shell script
cd bin
for i in libvtkCommon libvtkDICOMParser libvtkFiltering libvtkGenericFiltering \
libvtkGraphics libvtkHybrid libvtkIO libvtkImaging libvtkMPEG2Encode \
libvtkRendering libvtkVolumeRendering \
libvtkexpat libvtkfreetype libvtkftgl libvtkjpeg libvtkpng libvtksys \
libvtktiff libvtkzlib
do 
  rm $i.dylib
  mv $i.5.0.0.dylib $i.dylib
  install_name_tool -id @executable_path/../lib/$i.dylib $i.dylib
  rm $i.5.0.dylib
done
hrchilds's avatar
hrchilds committed
726

hrchilds's avatar
hrchilds committed
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745
#
# Next change the dependent libraries names and paths
for i in libvtkCommon libvtkDICOMParser libvtkFiltering libvtkGenericFiltering \
libvtkGraphics libvtkHybrid libvtkIO libvtkImaging libvtkMPEG2Encode \
libvtkRendering libvtkVolumeRendering \
libvtkexpat libvtkfreetype libvtkftgl libvtkjpeg libvtkpng libvtksys \
libvtktiff libvtkzlib 
do
  for j in libvtkCommon libvtkDICOMParser libvtkFiltering \
  libvtkGenericFiltering libvtkGraphics libvtkHybrid libvtkIO libvtkImaging \
  libvtkMPEG2Encode libvtkRendering libvtkVolumeRendering \
  libvtkexpat libvtkfreetype libvtkftgl libvtkjpeg \
  libvtkpng libvtksys libvtktiff libvtkzlib
  do
    install_name_tool -change $j.5.0.dylib @executable_path/../lib/$j.dylib \
    $i.dylib 
  done
done
cd ..
hrchilds's avatar
hrchilds committed
746 747 748
#
# Install VTK in the visit directory under the vtk directory.
#
hrchilds's avatar
hrchilds committed
749
mkdir $VISITPATH/vtk
hrchilds's avatar
hrchilds committed
750 751 752 753
mkdir $VISITPATH/vtk/{Common,Filtering,GenericFiltering}
mkdir $VISITPATH/vtk/{Graphics,Hybrid,IO,Imaging}
mkdir $VISITPATH/vtk/{Rendering,MangleMesaInclude,Utilities}
mkdir $VISITPATH/vtk/{VolumeRendering,lib}
hrchilds's avatar
hrchilds committed
754 755
mkdir $VISITPATH/vtk/{vtkstd,Utilities/vtktiff,Utilities/vtkexpat}
mkdir $VISITPATH/vtk/{Utilities/vtkzlib,Utilities/vtkjpeg}
hrchilds's avatar
hrchilds committed
756 757 758 759
cp vtkConfigure.h                 $VISITPATH/vtk
cp vtkToolkits.h                  $VISITPATH/vtk
cp vtk*Instantiator.h             $VISITPATH/vtk
cp Common/*.h                     $VISITPATH/vtk/Common
hrchilds's avatar
hrchilds committed
760
cp Common/*.txx                   $VISITPATH/vtk/Common
hrchilds's avatar
hrchilds committed
761
cp Filtering/*.h                  $VISITPATH/vtk/Filtering
hrchilds's avatar
hrchilds committed
762 763
cp Filtering/*.txx                $VISITPATH/vtk/Filtering
cp GenericFiltering/*.h           $VISITPATH/vtk/GenericFiltering
hrchilds's avatar
hrchilds committed
764 765 766 767 768
cp Graphics/*.h                   $VISITPATH/vtk/Graphics
cp Hybrid/*.h                     $VISITPATH/vtk/Hybrid
cp IO/*.h                         $VISITPATH/vtk/IO
cp Imaging/*.h                    $VISITPATH/vtk/Imaging
cp Rendering/*.h                  $VISITPATH/vtk/Rendering
hrchilds's avatar
hrchilds committed
769 770 771 772 773 774
cp Utilities/*.h                  $VISITPATH/vtk/Utilities
cp Utilities/vtktiff/*.h          $VISITPATH/vtk/Utilities/vtktiff
cp Utilities/vtkexpat/*.h         $VISITPATH/vtk/Utilities/vtkexpat
cp Utilities/vtkzlib/*.h          $VISITPATH/vtk/Utilities/vtkzlib
cp Utilities/vtkjpeg/*.h          $VISITPATH/vtk/Utilities/vtkjpeg
cp VolumeRendering/*.h            $VISITPATH/vtk/VolumeRendering
hrchilds's avatar
hrchilds committed
775
cp MangleMesaInclude/*.h          $VISITPATH/vtk/MangleMesaInclude
hrchilds's avatar
hrchilds committed
776
cp vtkstd/*                       $VISITPATH/vtk/vtkstd
hrchilds's avatar
hrchilds committed
777
cp bin/*.dylib                    $VISITPATH/vtk/lib
hrchilds's avatar
hrchilds committed
778

hrchilds's avatar
hrchilds committed
779
#
hrchilds's avatar
hrchilds committed
780
# Create a JPEG library from the VTK JPEG library in case the
hrchilds's avatar
hrchilds committed
781
# computer does not have a JPEG library.
hrchilds's avatar
hrchilds committed
782
ln -s $VISITPATH/vtk/lib/libvtkjpeg.dylib $VISITPATH/vtk/lib/libjpeg.dylib
hrchilds's avatar
hrchilds committed
783
cd ..
hrchilds's avatar
hrchilds committed
784

hrchilds's avatar
hrchilds committed
785
===============================================================================
hrchilds's avatar
hrchilds committed
786
Building Python as a dynamic library
hrchilds's avatar
hrchilds committed
787 788 789 790
===============================================================================

Python is a powerful, free scripting language that is used to drive VisIt's
viewer when running VisIt without a GUI. Python is cross platform and runs on
treadway's avatar
treadway committed
791 792 793 794 795 796 797
many UNIXes as well as MS Windows. VisIt can be configured to run without
Python if scripting features are not desired.  Follow the directions listed
below to build Python.  If you have any problems building or installing Python,
read the README file in the Python distribution for more information.  Python
currently can't be built as a 4-way universal binary, because it depends on
the Carbon framework, which is currently 32-bit, a 2-way build appears to
supported now.
hrchilds's avatar
hrchilds committed
798 799 800 801 802 803

tar zxf Python-2.5.tgz
cd Python-2.5
./configure --prefix=$VISITPATH/python \
OPT="-O3 -Wall -Wstrict-prototypes -fno-common" \
LDFLAGS="-Wl,-headerpad_max_install_names" 
hrchilds's avatar
hrchilds committed
804
make
hrchilds's avatar
hrchilds committed
805 806

# Install Python
hrchilds's avatar
hrchilds committed
807
make install
hrchilds's avatar
hrchilds committed
808
# Now that Python is built, we need to modify the install_name.
hrchilds's avatar
hrchilds committed
809
echo "char **environ=0;" > environhack.c
hrchilds's avatar
hrchilds committed
810
gcc -c environhack.c -fno-common
hrchilds's avatar
hrchilds committed
811 812 813 814 815 816 817 818 819 820 821
mkdir tmp
cd tmp
ar x ../libpython2.5.a
gcc -o ../libpython2.5.dylib -dynamiclib \
../environhack.o *.o -lSystem -lSystemStubs \
-framework Carbon -Wl,-twolevel_namespace \
-Wl,-undefined,dynamic_lookup,-headerpad_max_install_names \
-Wl,-install_name,@executable_path/../lib/libpython2.5.dylib \
-Wl,-compatibility_version,2.5 \
-Wl,-current_version,2.5
cd ..
hrchilds's avatar
hrchilds committed
822 823
cp libpython2.5.dylib $VISITPATH/python/lib/python2.5/config/libpython2.5.dylib
cd ..
hrchilds's avatar
hrchilds committed
824

treadway's avatar
treadway committed
825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854
===============================================================================
Building SZIP as a dynamic library (optional, required with HDF5 or HDF4)
===============================================================================

Szip compression software, providing lossless compression of scientific data,
support is provided with HDF software products as of HDF5 Release 1.6.0
and HDF4 Release 2.0.

tar zxf szip-2.1.tar.gz
cd szip-2.1

# Configure
./configure --prefix=$VISITPATH/szip CFLAGS="-O2 -fno-common"

# make will bomb, but gets far enough
make
# Install SZIP headers
make install

# Create and install dynamic library
gcc -dynamiclib -o libsz.dylib src/*.o \
-Wl,-headerpad_max_install_names,-twolevel_namespace \
-Wl,-install_name @executable_path/../lib/libsz.dylib \
-Wl,-compatibility_version,2.0 \
-Wl,-current_version,2.1 -lSystem

cp libsz.dylib $VISITPATH/szip/lib

cd ..

hrchilds's avatar
hrchilds committed
855
===============================================================================
hrchilds's avatar
hrchilds committed
856
Building HDF5 as a dynamic library (optional)
hrchilds's avatar
hrchilds committed
857 858 859 860 861 862 863 864
===============================================================================

HDF5 is a data storage library that allows you to efficiently write large
volumes of structured storage to a disk file. VisIt can technically be built
without support for HDF5 so it is an optional, but recommended, package. Though
it is optional, we build it before the Silo library because the Silo library
should be built with support for HDF5 when possible. If you don't want to build
HDF5, you can skip this section but you will have to take care that you do not
hrchilds's avatar
hrchilds committed
865 866
attempt to build Silo with support for HDF5. HDF5 uses configure to
determine endianness and configure doesn't support cross-compiling. Therefore
hrchilds's avatar
hrchilds committed
867 868
HDF5 meeded to be built on both an Intel machine and a PPC machine. These 
resulting libraries are then merged together to get a universal binary.
treadway's avatar
treadway committed
869
HDF5 is now dependent on SZIP (above).
hrchilds's avatar
hrchilds committed
870

hrchilds's avatar
hrchilds committed
871
tar zxf hdf5-1.6.5.tar.gz
hrchilds's avatar
hrchilds committed
872
cd hdf5-1.6.5
hrchilds's avatar
hrchilds committed
873 874 875 876 877 878 879 880 881

HDF5 need more recent configure, and libtool configuration. I used the latest
releases from GNU for m4, autoconf, automake, and libtool. Run autoreconf
to rebuild the GUN build system.

autoreconf -vif

# Build a library for each architecure, on the PPC machine:
./configure --prefix=$VISITPATH/hdf5 CFLAGS="-O2 -fno-common" \
treadway's avatar
treadway committed
882 883
LDFLAGS="-Wl,-headerpad_max_install_names" \
--with-szlib=$VISITPATH/szip
hrchilds's avatar
hrchilds committed
884 885

# make will bomb, but gets far enough
hrchilds's avatar
hrchilds committed
886
make
hrchilds's avatar
hrchilds committed
887 888
# Install HDF5 headers
make install
hrchilds's avatar
hrchilds committed
889

hrchilds's avatar
hrchilds committed
890
# Create and install dynamic library
treadway's avatar
treadway committed
891 892 893 894 895 896 897 898 899 900
##libtool -o libhdf5.dylib -dynamic src/.libs/libhdf5.a -lSystem -lz \
##-twolevel_namespace -undefined dynamic_lookup \
##-headerpad_max_install_names \
##-install_name @executable_path/../lib/libhdf5.dylib \
##-compatibility_version 1.6 -current_version 1.6.5
gcc -dynamiclib -o libhdf5.dylib src/*.o \
-Wl,-headerpad_max_install_names,-twolevel_namespace \
-Wl,-install_name @executable_path/../lib/libhdf5.dylib \
-Wl,-compatibility_version,1.6 -Wl,-current_version,1.6.5 \
-L"$VISITDIR/szip/lib" -lSystem -lsz -lz
hrchilds's avatar
hrchilds committed
901 902 903

cp libhdf5.dylib $VISITPATH/hdf5/lib

hrchilds's avatar
hrchilds committed
904
cd ..
hrchilds's avatar
hrchilds committed
905

hrchilds's avatar
hrchilds committed
906
===============================================================================
hrchilds's avatar
hrchilds committed
907
Building Mili as a dynamic library  (optional)
hrchilds's avatar
hrchilds committed
908 909
===============================================================================

hrchilds's avatar
hrchilds committed
910 911
Mili is a database file format library for finite element codes like ls-dyna.
VisIt has a database reader for this popular LLNL engineering database file
hrchilds's avatar
hrchilds committed
912
format. Mili file format support is optional and is not required for
hrchilds's avatar
hrchilds committed
913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936
VisIt to run. Mili doesn't require building on 2 different machines. 

tar zxf mili.tar
cd mili

vi src/mili_internal.h
# After line 56 insert #include <sys/types.h>

# Build
./configure --prefix=$VISITPATH/mili CFLAGS="-O2 -fno-common" \
LDFLAGS="-Wl,-headerpad_max_install_names"

cd MILI-Darwin-*/src

gcc -O2 -fno-common -D_LARGEFILE64_SOURCE -c mili.c direc.c param.c io.c \
util.c dep.c svar.c srec.c mesh_u.c wrap_c.c io_mem.c eprtf.c sarray.c \
gahl.c util.c partition.c ti.c tidirc.c

gcc -dynamiclib -o libmili.dylib mili.o direc.o param.o io.o dep.o \
svar.o srec.o mesh_u.o wrap_c.o io_mem.o eprtf.o sarray.o gahl.o util.o \
partition.o ti.o tidirc.o -Wl,-headerpad_max_install_names,\
-install_name,@executable_path/../lib/libmili.dylib,\
-compatibility_version,1.0,-current_version,1.10.0

hrchilds's avatar
hrchilds committed
937 938 939
mkdir $VISITPATH/mili
cp mili.h $VISITPATH/mili
cp mili_enum.h $VISITPATH/mili
hrchilds's avatar
hrchilds committed
940 941
cp libmili.dylib $VISITPATH/mili
cd ../../..
hrchilds's avatar
hrchilds committed
942

hrchilds's avatar
hrchilds committed
943
==============================================================================
hrchilds's avatar
hrchilds committed
944
Building HDF4 as a dynamic library  (optional)
hrchilds's avatar
hrchilds committed
945 946 947 948
==============================================================================

HDF4 is a data storage library that lets you write large volumes of data to 
disk files and it is the predecessor of HDF5. Like most of the other libraries
hrchilds's avatar
hrchilds committed
949
mentioned so far, HDF4 does not have a make target to produce a dynamic
hrchilds's avatar
hrchilds committed
950
library. In fact, its make target for MacOS X produces a static library. Follow
hrchilds's avatar
hrchilds committed
951
the instructions below for creating universal dynamic libraries. 
hrchilds's avatar
hrchilds committed
952 953 954 955 956 957
This distribution however would not build as 2-way universal binary without
building on separate machines.

HDF4 requires some external software libries, SZIP, ZLIB. and JPEG. ZLIB is
built in to MacOS, JPEG was created during the VTK step above, and SZIP
will be ignored.
hrchilds's avatar
hrchilds committed
958 959

# Unpack HDF4
hrchilds's avatar
hrchilds committed
960 961
tar zxf HDF4.2r1.tar.gz
cd HDF4.2r1
hrchilds's avatar
hrchilds committed
962 963

vi configure
hrchilds's avatar
hrchilds committed
964
# Note that as of VTK 5.0, the names in the VTK
hrchilds's avatar
hrchilds committed
965 966 967 968
# jpeg library are mangled so they have a "vtk_" prefix. HDF4 can be built
# against the VTK jpeg library just fine once you get past configure, which
# does not like VTK's mangled jpeg library.
# 
hrchilds's avatar
hrchilds committed
969 970 971
# Comment out lines 5659-5708
#
# insert after line 5708:
hrchilds's avatar
hrchilds committed
972
# ac_cv_lib_jpeg_jpeg_start_decompress=yes
hrchilds's avatar
hrchilds committed
973

hrchilds's avatar
hrchilds committed
974
# 
hrchilds's avatar
hrchilds committed
975
# Comment out lines 6878-7181 because the script exits with a failure to
hrchilds's avatar
hrchilds committed
976 977
# calculate the size of int*.
#
hrchilds's avatar
hrchilds committed
978
# Insert, after line 7181, ac_cv_sizeof_intp=4
hrchilds's avatar
hrchilds committed
979 980
#

hrchilds's avatar
hrchilds committed
981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003
vi hdf/src/hdfi.h
# Replace line 739:

#define DF_MT   DFMT_APPLE

# with the following:

#ifdef __i386
#ifndef INTEL86
#define INTEL86   /* we need this Intel define or bad things happen later */
#endif /* INTEL86 */
#define DF_MT   DFMT_APPLE_INTEL
#else
#define DF_MT   DFMT_APPLE
#endif /* __i386 */

# Replace line 889:

#if !(defined(macintosh) || defined(MAC))

# With:

#if !(defined(macintosh) || defined(MAC) || defined (__APPLE__))
hrchilds's avatar
hrchilds committed
1004 1005 1006

# Build
./configure --prefix=$VISITPATH/hdf4 \
hrchilds's avatar
hrchilds committed
1007 1008 1009
CPPFLAGS="-I$VISITPATH/vtk/Utilities -I$VISITPATH/vtk/Utilities/vtkjpeg" \
CFLAGS="-O2 -fno-common" \
LDFLAGS="-Wl,-headerpad_max_install_names" --with-jpeg=$VISITPATH/vtk/lib \
treadway's avatar
treadway committed
1010
--with-szlib=$VISITPATH/szip --disable-fortran --disable-dependency-tracking
hrchilds's avatar
hrchilds committed
1011 1012

# The build, and install will bomb during test, just ignore
hrchilds's avatar
hrchilds committed
1013 1014
make

hrchilds's avatar
hrchilds committed
1015 1016
# Install headers
make install
hrchilds's avatar
hrchilds committed
1017

hrchilds's avatar
hrchilds committed
1018 1019 1020 1021 1022
# Relink libdf.
gcc -dynamiclib -o libdf.dylib hdf/src/*.o \
-Wl,-headerpad_max_install_names,\
-install_name,@executable_path/../lib/libdf.dylib,\
-compatibility_version,4.0,-current_version,4.2.1 \
treadway's avatar
treadway committed
1023
-L$VISITPATH/vtk/lib -L$VISITPATH/szip/lib -ljpeg -lsz -lz
hrchilds's avatar
hrchilds committed
1024 1025

cp libdf.dylib $VISITPATH/hdf4/lib
hrchilds's avatar
hrchilds committed
1026

hrchilds's avatar
hrchilds committed
1027 1028 1029 1030 1031
# Relink libmfhdf.
gcc -dynamiclib -o libmfhdf.dylib mfhdf/libsrc/*.o \
-Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,\
-install_name,@executable_path/../lib/libmfhdf.dylib,\
-compatibility_version,4.0,-current_version,4.2.1 \
treadway's avatar
treadway committed
1032 1033
-L$VISITPATH/vtk/lib -L$VISITPATH/szip/lib -L$VISITPATH/hdf4/lib \
-ljpeg -ldf -lsz -lz
hrchilds's avatar
hrchilds committed
1034

hrchilds's avatar
hrchilds committed
1035 1036 1037
cp libmfhdf.dylib $VISITPATH/hdf4/lib

cd ..
hrchilds's avatar
hrchilds committed
1038 1039

==============================================================================
hrchilds's avatar
hrchilds committed
1040
Building NetCDF as a dynamic library  (optional)
hrchilds's avatar
hrchilds committed
1041 1042 1043
==============================================================================

NetCDF is a scientific data storage library that lets you write platform-
hrchilds's avatar
hrchilds committed
1044 1045 1046 1047
independent binary files. The build system doesn't allow for a universal 
binary build, the endianness and word size is determined in configure, and
cross-compiling doesn't work, so a merge from 2 different machine builds is
needed.
hrchilds's avatar
hrchilds committed
1048 1049

# Unpack NetCDF
hrchilds's avatar
hrchilds committed
1050 1051 1052
tar zxf netcdf.tar.gz
cd netcdf-3.6.0-p1
cd src
hrchilds's avatar
hrchilds committed
1053

hrchilds's avatar
hrchilds committed
1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064
# The exodusII library uses the netcdf library for low-level data storage.
# The netcdf library must be modified slightly in order to handle the
# exodusII datamodel. 

vi libsrc/netcdf.h
# Modify the following defines:

#define NC_MAX_DIMS     65536    /* max dimensions per file */
#define NC_MAX_VARS     524288   /* max variables per file */
#define NC_MAX_VAR_DIMS 8        /* max per variable dimensions */

hrchilds's avatar
hrchilds committed
1065
# Have to run configure to create head files on both PPC and Intel machines
hrchilds's avatar
hrchilds committed
1066
./configure --enable-largefile --prefix=$VISITPATH/netcdf/3.6.0 \
hrchilds's avatar
hrchilds committed
1067
"CFLAGS="-O2 -fno-common" CXXFLAGS="-O2 -fno-common" FC=""
hrchilds's avatar
hrchilds committed
1068

hrchilds's avatar
hrchilds committed
1069
# Build the C library 
hrchilds's avatar
hrchilds committed
1070
cd libsrc
hrchilds's avatar
hrchilds committed
1071

hrchilds's avatar
hrchilds committed
1072 1073
gcc -c -O2 -fno-common -DVERSION=`cat ../VERSION` libvers.c
gcc -c -O2 -fno-common attr.c dim.c error.c nc.c ncio.c \
hrchilds's avatar
hrchilds committed
1074 1075 1076 1077 1078 1079 1080
ncx.c putget.c string.c v1hpg.c v2i.c var.c
# Create dynamic library.
gcc -dynamiclib -o ../libnetcdf.dylib attr.o dim.o error.o libvers.o nc.o \
ncio.o ncx.o putget.o string.o v1hpg.o v2i.o var.o \
-Wl,-headerpad_max_install_names,\
-install_name,@executable_path/../lib/libnetcdf.dylib,\
-compatibility_version,3.6,-current_version,3.6.0
hrchilds's avatar
hrchilds committed
1081

hrchilds's avatar
hrchilds committed
1082 1083 1084 1085 1086 1087 1088 1089
# Build the C library 
cd ../cxx
g++ -c -O2 -fno-common -I../libsrc -I.   netcdf.cpp
g++ -c -O2 -fno-common -I../libsrc -I.   ncvalues.cpp
g++ -dynamiclib -o ../libnetcdf_c++.dylib netcdf.o ncvalues.o \
-L.. -lnetcdf -Wl,-headerpad_max_install_names,\
-install_name,@executable_path/../lib/libnetcdf_c++.dylib,\
-compatibility_version,3.6,-current_version,3.6.0
hrchilds's avatar
hrchilds committed
1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100
cd ..
# Install header files.
mkdir $VISITPATH/netcdf
mkdir $VISITPATH/netcdf/3.6.0
mkdir $VISITPATH/netcdf/3.6.0/{include,lib}
cp cxx/ncvalues.h $VISITPATH/netcdf/3.6.0/include
cp cxx/netcdf.hh $VISITPATH/netcdf/3.6.0/include
cp cxx/netcdfcpp.h $VISITPATH/netcdf/3.6.0/include
cp libsrc/netcdf.h $VISITPATH/netcdf/3.6.0/include

cp libnetcdf.dylib $VISITPATH/netcdf/3.6.0/lib
hrchilds's avatar
hrchilds committed
1101
cp libnetcdf_c++.dylib $VISITPATH/netcdf/3.6.0/lib
hrchilds's avatar
hrchilds committed
1102
cd ../..
hrchilds's avatar
hrchilds committed
1103

hrchilds's avatar
hrchilds committed
1104 1105

===============================================================================
hrchilds's avatar
hrchilds committed
1106
Building CGNS as a dynamic library  (optional)
hrchilds's avatar
hrchilds committed
1107 1108 1109 1110 1111 1112 1113 1114 1115
===============================================================================
The CFD General Notation System (CGNS) consists of a collection of 
conventions, and software implementing those conventions, for the storage
and retrieval of CFD (computational fluid dynamics) data. The principal 
target of CGNS is data normally associated with compressible viscous flow
(i.e., the Navier-Stokes equations), but the standard is also applicable
to subclasses such as Euler and potential flows.

# Unpack CGNS
hrchilds's avatar
hrchilds committed
1116
tar zxf cgnslib_2.4-3.tar.gz
hrchilds's avatar
hrchilds committed
1117 1118
cd cgnslib_2.4

hrchilds's avatar
hrchilds committed
1119 1120
# CGNS's configure was built with a real old autoconf, so need to use the
# env syntax.
hrchilds's avatar
hrchilds committed
1121 1122 1123 1124 1125
# Configure CGNS
env CFLAGS="-O2 -fno-common" ./configure --prefix=$VISITPATH/cgns/2.4
make

# Install headers, etc.
hrchilds's avatar
hrchilds committed
1126 1127 1128 1129
mkdir $VISITPATH/cgns
mkdir $VISITPATH/cgns/2.4
mkdir $VISITPATH/cgns/include
mkdir $VISITPATH/cgns/lib
hrchilds's avatar
hrchilds committed
1130

hrchilds's avatar
hrchilds committed
1131 1132
make install

hrchilds's avatar
hrchilds committed
1133 1134
# Create dynamic library
libtool -o libcgns.dylib -dynamic DARWIN/libcgns.a -lSystem -lSystemStubs \
hrchilds's avatar
hrchilds committed
1135 1136
-headerpad_max_install_names \
-install_name @executable_path/../lib/libcgns.dylib \
hrchilds's avatar
hrchilds committed
1137
-compatibility_version 2.4 -current_version 2.4
hrchilds's avatar
hrchilds committed
1138

hrchilds's avatar
hrchilds committed
1139 1140
cp libcgns.dylib $VISITPATH/cgns/2.4/lib
cd ..
hrchilds's avatar
hrchilds committed
1141 1142

===============================================================================
hrchilds's avatar
hrchilds committed
1143
Building GDAL as a dynamic library  (optional)
hrchilds's avatar
hrchilds committed
1144 1145 1146
===============================================================================
GDAL is a translator library for raster geospatial data formats that presents
a single abstract data model to the calling application for all supported
hrchilds's avatar
hrchilds committed
1147 1148 1149
formats. The VisIt provided gdal-1.3.0 had problems building, so I'm
using the current gdal-1.3.2 release. The endianness and word size is determined
in configure, and cross-compiling doesn't work so a machine merge is needed.
hrchilds's avatar
hrchilds committed
1150 1151

# Unpack GDAL
hrchilds's avatar
hrchilds committed
1152 1153
tar zxf gdal-1.3.2.tar.gz
cd gdal-1.3.2
hrchilds's avatar
hrchilds committed
1154 1155

# Configure GDAL
hrchilds's avatar
hrchilds committed
1156 1157 1158 1159
./configure --prefix=$VISITPATH/gdal/1.3.2 --with-tiff=internal \ 
--with-gif=internal --with-png=internal --with-jpeg=internal \
--with-libz=internal --with-netcdf=no --without-jasper --without-python \
CFLAGS="-O2 -fno-common" CXXFLAGS="-O2 -fno-common" F77=""
hrchilds's avatar
hrchilds committed
1160

hrchilds's avatar
hrchilds committed
1161 1162 1163 1164 1165
make

# Install GDAL headers, etc.
make install

hrchilds's avatar
hrchilds committed
1166 1167 1168
# Prepare dynamic library
cp .libs/libgdal.1.10.0.dylib libgdal.dylib
install_name_tool -id @executable_path/../lib/libgdal.dylib libgdal.dylib
hrchilds's avatar
hrchilds committed
1169

hrchilds's avatar
hrchilds committed
1170
# 
hrchilds's avatar
hrchilds committed
1171 1172
rm $VISITPATH/gdal/1.3.2/lib/libgdal.dylib
cp libgdal.dylib $VISITPATH/gdal/1.3.2/lib/libgdal.dylib
hrchilds's avatar
hrchilds committed
1173
cd ..
hrchilds's avatar
hrchilds committed
1174 1175

===============================================================================
hrchilds's avatar
hrchilds committed
1176
Building Exodus II as a dynamic library  (optional)
hrchilds's avatar
hrchilds committed
1177 1178 1179 1180 1181 1182
===============================================================================
EXODUS II is a model developed to store and retrieve data for finite element 
analyses. It is used for preprocessing (problem definition), postprocessing 
(results visualization), as well as code to code data transfer. An EXODUS II
data file is a random access, machine independent, binary file that is written
and read via C, C++, or Fortran library routines which comprise the Application 
hrchilds's avatar
hrchilds committed
1183 1184 1185
Programming Interface. (exodusII is based on netcdf). I needed to do a machine
merge in order to get a universal binary.

hrchilds's avatar
hrchilds committed
1186
The EXODUS II library depends on the customized NetCDF library, from above.
hrchilds's avatar
hrchilds committed
1187 1188 1189 1190 1191 1192

#
# Build and install the exodus libraries.
#
tar zxf exodusii-4.46.tar.gz
cd exodusii-4.46/cbind/src
hrchilds's avatar
hrchilds committed
1193 1194

# Build the Exodus II source (note that it requires NetCDF)
hrchilds's avatar
hrchilds committed
1195 1196
export NETCDFLIB=$VISITPATH/netcdf/3.6.0/lib
export NETCDFINC=$VISITPATH/netcdf/3.6.0/include
hrchilds's avatar
hrchilds committed
1197
gcc -O2 -fno-common -I../include -I$NETCDFINC -c *.c
hrchilds's avatar
hrchilds committed
1198

hrchilds's avatar
hrchilds committed
1199 1200 1201 1202 1203
# Build a universal dynamic library
gcc -dynamiclib -o libexoIIv2c.dylib *.o -Wl,-headerpad_max_install_names,\
-install_name,@executable_path/../lib/libexoIIv2c.dylib,\
-compatibility_version,4.0,-current_version,4.46 \
-L$NETCDFLIB -lnetcdf
hrchilds's avatar
hrchilds committed
1204 1205

# Install Exodus
hrchilds's avatar
hrchilds committed
1206 1207 1208
mkdir $VISITPATH/exodus
mkdir $VISITPATH/exodus/4.46
mkdir $VISITPATH/exodus/4.46/{inc,lib}
hrchilds's avatar
hrchilds committed
1209 1210
cp libexoIIv2c.dylib $VISITPATH/exodus/4.46/lib
cp ../include/*.h $VISITPATH/exodus/4.46/inc
hrchilds's avatar
hrchilds committed
1211 1212
ln -s $VISITPATH/netcdf/3.6.0/include/netcdf.h \
$VISITPATH/exodus/4.46/inc/netcdf.h
hrchilds's avatar
hrchilds committed
1213
cd ../../..
hrchilds's avatar
hrchilds committed
1214 1215

===============================================================================
hrchilds's avatar
hrchilds committed
1216
Building Silo as a dynamic library  (optional)
hrchilds's avatar
hrchilds committed
1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229
===============================================================================

Silo is a self-describing, machine-independent scientific file format.
Silo is one of the file formats supported by VisIt.  Follow the directions
listed below to build Silo.  If you have any problems building or installing
Silo, read the INSTALL_NOTES file in the SILO distribution for more
information.

Note that these instructions assume that Silo will be built with HDF5 support.
If you build Silo with HDF5 support then you must have first built HDF5 using
the instructions provided earlier in this document. If you don't want to build
Silo with HDF5 support, replace the --with-hdf5=... with --without-hdf5.
The library segment offsets used assume that Silo will be built with support
hrchilds's avatar
hrchilds committed
1230 1231
for HDF5. I needed to do a machine merge in order to get a universal binary,
because the endianness and word size is determined in configure.
hrchilds's avatar
hrchilds committed
1232 1233

# Build silo source into an archive library
hrchilds's avatar
hrchilds committed
1234 1235
sh silo060605.sh
cd silo060605
hrchilds's avatar
hrchilds committed
1236
#
hrchilds's avatar
hrchilds committed
1237

hrchilds's avatar
hrchilds committed
1238 1239 1240 1241 1242 1243 1244
# Need to fake-out dependency tracking.
mv include/make-depend-gnu.in include/make-depend-gnu.in.orig
cp include/make-depend-std.in include/make-depend-gnu.in
#
# Set the values of some helper variables
export HDF5INCLUDE=$VISITPATH/hdf5/include
export HDF5LIB=$VISITPATH/hdf5/lib
treadway's avatar
treadway committed
1245 1246 1247 1248 1249 1250 1251 1252
ln -s $VISITPATH/szip/lib/libsz.dylib $VISITPATH/hdf5/lib/libsz.dylib

# Edit configure, replacing all occurences of "-lhdf5" with "-lhdf5 -lsz".
cat configure | sed 's/-lhdf5/-lhdf5 -lsz/' > tmp.conf
mv configure configure.orig
mv tmp.conf configure
chmod +x configure

hrchilds's avatar
hrchilds committed
1253 1254 1255 1256 1257 1258 1259
./configure --prefix=$VISITPATH/silo CFLAGS="-O2 -fno-common" \
CXXFLAGS="-O2 -fno-common" \
LDFLAGS="-Wl,-headerpad_max_install_names,-undefined,dynamic_lookup" \
--disable-sdx --disable-browser --without-readline \
--without-exodus --without-python --with-hdf5=$HDF5INCLUDE,$HDF5LIB

# Compile the needed subroutines. Force make to ignore errors from
treadway's avatar
treadway committed
1260
# archive creation, it should get us to where we want to be.
hrchilds's avatar
hrchilds committed
1261 1262 1263
make -i

gcc -dynamiclib -o libsilo.dylib silo/*/*.o \
treadway's avatar
treadway committed
1264
-Wl,-headerpad_max_install_names,\
hrchilds's avatar
hrchilds committed
1265 1266
-install_name,@executable_path/../lib/libsilo.dylib,\
-compatibility_version,4.5,-current_version,4.5.1 \
treadway's avatar
treadway committed
1267
-L$HDF5LIB -lhdf5 -lsz -lz
hrchilds's avatar
hrchilds committed
1268 1269 1270

# Install headers. Ignore archive creation errors.
make -i install
hrchilds's avatar
hrchilds committed
1271 1272

# Install Silo
hrchilds's avatar
hrchilds committed
1273
cp libsilo.dylib  $VISITPATH/silo/lib
hrchilds's avatar
hrchilds committed
1274 1275
cd ..

hrchilds's avatar
hrchilds committed
1276 1277 1278 1279 1280 1281
===============================================================================
Building Boxlib as a dynamic library (optional)
===============================================================================

Boxlib is an I/O library for reading and writing structured AMR mesh data.
I needed to do a machine merge in order to get a universal binary.
hrchilds's avatar
hrchilds committed
1282

hrchilds's avatar
hrchilds committed
1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322
#
# Build Boxlib.
#
# Boxlib requires a Fortran compiler, skip the Boxlib building if you
# don't have access to a Fortran compiler

tar -zxf boxlib.tar.gz
cd CCSEApps/BoxLib

vi GNUmakefile
# You will need to add -fno-common
# to the compile flags.
# This can be done by adding the lines:
CXXFLAGS += -fno-common
CCFLAGS += -fno-common
# near the top of the file GNUmakefile.
#
# Change: 
DEBUG = FALSE
USE_MPI = FALSE
COMP =

vi BaseFab.cpp
# Comment out the references to Fortran routines FORT_FASTCOPY, and 
# FORT_SETVAL, in BaseFab.cpp,
# Comment out lines 101 and 102:
    if (destbox == domain && srcbox == src.box())
    {
# to:
//    if (destbox == domain && srcbox == src.box())
//    {
# Do the same thing to lines: 110 through 135, 148, 149, 156 through 173

vi FPC.cpp
# Add the Apple macro defination to FPC.cpp.
# At lines 67, 94, and 140 change:
# defined(__sun) || \
#to: 
# defined(__sun) || defined(__ppc__) || defined(__ppc64__) || \

hrchilds's avatar
hrchilds committed
1323 1324 1325 1326 1327 1328 1329 1330 1331
vi Make.package
# Comment out the Fortran interfaces starting a line 94:
#f$(BOXLIB_BASE)_sources += BLutil_F.f
#f$(BOXLIB_BASE)_sources += BLParmParse_F.f
#f$(BOXLIB_BASE)_sources += BLBoxLib_F.f

#F$(BOXLIB_BASE)_sources += SPECIALIZE_$(DIM)D.F
#F$(BOXLIB_BASE)_headers += SPECIALIZE_F.H

hrchilds's avatar
hrchilds committed
1332 1333 1334 1335 1336 1337 1338 1339
# Create a Darwin Makefile templet:
cp ../mk/Make.FreeBSD ../mk/Make.Darwin

#
# Start off by building the 3d version.
# 
# Don't want the fortran bindings, so we'll try and bull I way through to that
# part.
hrchilds's avatar
hrchilds committed
1340
make -f GNUmakefile
hrchilds's avatar
hrchilds committed
1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357

# Build a dynamic library
libtool -o libbox3D.dylib -dynamic libbox3d.Darwin.CC.f77.a -lSystem \
-twolevel_namespace -undefined dynamic_lookup -headerpad_max_install_names \
-install_name @executable_path/../lib/libbox3D.dylib \
-compatibility_version 2.0 -current_version 2.5

tar cf Boxlib3D.h.tar *.H
#
# Now build the 2d version.
#
make clean

vi GNUmakefile
# You will need to modify the GNUmakefile to set the dimension to 2.  This
# will involve replacing "3" with "2" in the line "DIM       = 3".
#
hrchilds's avatar
hrchilds committed
1358
make -f GNUmakefile
hrchilds's avatar
hrchilds committed
1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387

# Build a universal dynamic library
libtool -o libbox2D.dylib -dynamic libbox2d.Darwin.CC.f77.a -lSystem \
-twolevel_namespace -undefined dynamic_lookup -headerpad_max_install_names \
-install_name @executable_path/../lib/libbox2D.dylib \
-compatibility_version 2.0 -current_version 2.5

tar cf Boxlib2D.h.tar *.H
#
# Install#
mkdir $VISITPATH/boxlib
mkdir $VISITPATH/boxlib/include
mkdir $VISITPATH/boxlib/lib
mkdir $VISITPATH/boxlib/include/2D
mkdir $VISITPATH/boxlib/include/3D
cp libbox3D.dylib $VISITPATH/boxlib/lib/
cp libbox2D.dylib $VISITPATH/boxlib/lib/

#
# Install the header files.
#
cp Boxlib2D.h.tar $VISITPATH/boxlib/include/2D
cp Boxlib3D.h.tar $VISITPATH/boxlib/include/3D
cd $VISITPATH/boxlib/include/2D
tar xf Boxlib2D.h.tar
cd $VISITPATH/boxlib/include/3D
tar xf Boxlib3D.h.tar
cd $VISITPATH
cd ..
hrchilds's avatar
hrchilds committed
1388

hrchilds's avatar
hrchilds committed
1389
===============================================================================
hrchilds's avatar
hrchilds committed
1390
Building CFITSIO as a dynamic library (Optional)
hrchilds's avatar
hrchilds committed
1391 1392
===============================================================================

hrchilds's avatar
hrchilds committed
1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414
CFITSIO is a library for reading FITS files. FITS stands for `Flexible Image 
Transport System' and is the standard astronomical data format endorsed by 
both NASA and the IAU. FITS is much more than an image format (such as JPG 
or GIF) and is primarily designed to store scientific data sets consisting 
of multi-dimensional arrays (1-D spectra, 2-D images or 3-D data cubes) and
2-dimensional tables containing rows and columns of data.
Cfitsio uses an old autoconf, only makeing a static library.
I could build a 2-way universal binary.

#
# Build CFITSIO
#
tar zxf cfitsio3006.tar.gz
cd cfitsio

#
env CFLAGS="-O2 -fno-common" LDFLAGS="-Wl,-headerpad_max_install_names" \
./configure --prefix=$VISITPATH/cfitsio/3006

make
# Build a dynamic library
libtool -o libcfitsio.dylib -dynamic libcfitsio.a -lSystem \
treadway's avatar
treadway committed
1415
-twolevel_namespace -headerpad_max_install_names \
hrchilds's avatar
hrchilds committed
1416 1417 1418 1419 1420 1421 1422 1423 1424
-install_name @executable_path/../lib/libcfits.dylib \
-compatibility_version 3.0 -current_version 3.006

# Install.
mkdir $VISITPATH/cfitsio
make install
cd ..
#

treadway's avatar
treadway committed
1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451
===============================================================================
Building H5Part as a dynamic library (optional)
===============================================================================

H5Part is a very simple data storage schema and provides an API that simplifies the reading/writing of the data to the HDF5 file format.

tar zxf H5Part-1.4.0.tar.gz
cd H5Part-1.4.0

# Configure
./configure --prefix=$VISITPATH/H5Part CFLAGS="-O2 -fno-common"

# build
make
# Install headers
make install

# Create and install dynamic library
libtool -o libH5Part.dylib -dynamic libH5Part.a -lSystem \
-twolevel_namespace -headerpad_max_install_names \
-install_name @executable_path/../lib/libH5Part.dylib \
-compatibility_version 1.4 -current_version 1.4.0

cp libH5Part.dylib $VISITPATH/H5Part/lib

cd ..

hrchilds's avatar
hrchilds committed
1452 1453 1454
===============================================================================
Building VisIt
===============================================================================
hrchilds's avatar
hrchilds committed
1455

hrchilds's avatar
hrchilds committed
1456 1457 1458 1459 1460 1461
VisIt uses GNU's autoconf system to provide platform independence when
building VisIt in a UNIX environment. Autoconf creates a script called
configure that tests your system for various libraries and programs required
to build VisIt.  Follow the directions listed below to build VisIt.
More information about building VisIt follows after that.

hrchilds's avatar
hrchilds committed
1462 1463 1464
#
# Unzipping VisIt's source code distribution
#
1465 1466
tar zxf visit1.11.0.tar.gz
cd visit1.11.0/src
hrchilds's avatar
hrchilds committed
1467

hrchilds's avatar
hrchilds committed
1468 1469 1470 1471
#
# HDF5 and Silo
#
If you built the Silo library with support for HDF5 using the instructions in
hrchilds's avatar
hrchilds committed
1472 1473
this document then create a symbolic link to it from the Silo directory so 
VisIt's configure script will find it..
hrchilds's avatar
hrchilds committed
1474

hrchilds's avatar
hrchilds committed
1475
ln -s $VISITPATH/hdf5/lib/libhdf5.dylib $VISITPATH/silo/lib/libhdf5.dylib
hrchilds's avatar
hrchilds committed
1476

hrchilds's avatar
hrchilds committed
1477
#
hrchilds's avatar
hrchilds committed
1478
# Configure VisIt
hrchilds's avatar
hrchilds committed
1479 1480
# The example Mac configurations are config-site/tread.llnl.gov.conf and
# config-site/tread.local.conf
hrchilds's avatar
hrchilds committed
1481
#
hrchilds's avatar
hrchilds committed
1482
cd config-site
treadway's avatar
treadway committed
1483
echo VISITHOME=`cat ../../../visitpath` > `hostname`.conf
hrchilds's avatar
hrchilds committed
1484
cat Template.conf >> `hostname`.conf
hrchilds's avatar
hrchilds committed
1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504
# Edit `hostname`.conf so that:
QT_BIN=$VISITHOME/qt/bin
QT_INCLUDE=$VISITHOME/qt/include
QT_LIB=$VISITHOME/qt/lib
MESA=$VISITHOME/mesa
VTK=$VISITHOME/vtk
PYDIR=$VISITHOME/python     
PYVERSION=python2.5
DEFAULT_BOXLIB2D_INCLUDE=$VISITHOME/boxlib/include/2D
DEFAULT_BOXLIB2D_LIBS=$VISITHOME/boxlib/lib
DEFAULT_BOXLIB3D_INCLUDE=$VISITHOME/boxlib/include/3D
DEFAULT_BOXLIB3D_LIBS=$VISITHOME/boxlib/lib
DEFAULT_CFITSIO_INCLUDE=$VISITHOME/cfitsio/3006/include
DEFAULT_CFITSIO_LIB=$VISITHOME/cfitsio/3006/lib
DEFAULT_CGNS_INCLUDE=$VISITHOME/cgns/2.4/include                            
DEFAULT_CGNS_LIB=$VISITHOME/cgns/2.4/lib
DEFAULT_EXODUS_INCLUDES=$VISITHOME/exodusII/include
DEFAULT_EXODUS_LIBRARY=$VISITHOME/exodusII/lib
DEFAULT_GDAL_INCLUDE=$VISITHOME/gdal/1.3.2/include                            
DEFAULT_GDAL_LIB=$VISITHOME/gdal/1.3.2/lib                            
treadway's avatar
treadway committed
1505 1506
DEFAULT_H5PART_INCLUDE=$VISITHOME/h5part/include
DEFAULT_H5PART_LIB=$VISITHOME/h5part/lib
hrchilds's avatar
hrchilds committed
1507 1508 1509 1510 1511 1512 1513 1514 1515
DEFAULT_HDF4_FLAGS=$VISITHOME/hdf4/include                                
DEFAULT_HDF4_LIBS=$VISITHOME/hdf4/lib
DEFAULT_HDF5_INCLUDE=$VISITHOME/hdf5/include             
DEFAULT_HDF5_LIB=$VISITHOME/hdf5/lib
MILI_DIR=$VISITHOME/mili
DEFAULT_NETCDF_INCLUDE=$VISITHOME/netcdf/3.6.0/include
DEFAULT_NETCDF_LIB=$VISITHOME/netcdf/3.6.0/lib
DEFAULT_SILO_INCLUDES=$VISITHOME/silo/include
DEFAULT_SILO_LIBRARY=$VISITHOME/silo/lib
treadway's avatar
treadway committed
1516 1517
DEFAULT_SZIP_INCLUDE=$VISITHOME/szip/include
DEFAULT_SZIP_LIB=$VISITHOME/szip/lib
hrchilds's avatar
hrchilds committed
1518

hrchilds's avatar
hrchilds committed
1519
cd ..
hrchilds's avatar
hrchilds committed
1520

treadway's avatar
treadway committed
1521
./configure --enable-visitmodule
hrchilds's avatar
hrchilds committed
1522 1523 1524
#
# If VisIt failed to configure properly, check the contents of the
# `hostname`.conf file to make sure that it points to the libraries that
hrchilds's avatar
hrchilds committed
1525
# you build. You can look at tread.local.conf, which is a configuration file
hrchilds's avatar
hrchilds committed
1526 1527 1528
# for another MacOS X computer, if you want an example file that works.
#

treadway's avatar
treadway committed
1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540
# Patch some problems with some make files
cat databases/Fluent/Makefile | sed '/CXXFLAGS/s/$/ -O0/g' > Make.tmp
mv -f databases/Fluent/Makefile databases/Fluent/Makefile.orig
mv -f Make.tmp databases/Fluent/Makefile
cat databases/SimV1/Makefile | \
  sed '/LDFLAGS/s/$/ -Wl,-undefined,dynamic_lookup/g' > Make.tmp
mv -f databases/SimV1/Makefile databases/SimV1/Makefile.orig
mv -f Make.tmp databases/SimV1/Makefile
cat databases/SimV1Writer/Makefile | \
  sed '/LDFLAGS/s/$/ -Wl,-undefined,dynamic_lookup/g' > Make.tmp
mv -f databases/SimV1Writer/Makefile databases/SimV1Writer/Makefile.orig
mv -f Make.tmp databases/SimV1Writer/Makefile
hrchilds's avatar
hrchilds committed
1541 1542
# Build VisIt
make
hrchilds's avatar
hrchilds committed
1543

hrchilds's avatar
hrchilds committed
1544 1545
# Create a binary distribution tarball, which for an Intel Mac will create
# a visit1_6.darwin-i386.tar.gz file of about 60Mbytes.
hrchilds's avatar
hrchilds committed
1546 1547
clearcase_bin/visit-bin-dist

treadway's avatar
treadway committed
1548 1549 1550 1551 1552 1553
# To install the binaries in a directory called "INSTALL_DIR_PATH"
clearcase_bin/visit-install 1.6 darwin-i386 INSTALL_DIR_PATH

# To install the PPC binaries in a directory called "INSTALL_DIR_PATH", and
# create a disk image file called Visit-1.6.dmg containing both images, use:
clearcase_bin/visit-install -dmg 1.6 darwin-ppc INSTALL_DIR_PATH
hrchilds's avatar
hrchilds committed
1554

1555
If you have any problems send e-mail to visit-developers@ornl.gov.