OOF: Finite Element Analysis of Microstructures

Installing OOF2 Prerequsites

oof2 logo

The hardest part of installing OOF2 can be installing the third party libraries that it uses. This page contains explicit instructions for installing the requisite libraries on several different operating systems.

The easiest way to install the libraries that OOF2 requires is to use a package manager, which will automatically configure, build, and install the libraries and all of the additional software that the libraries require. The tricky bit can be knowing which packages to request. This file gives explicit instructions for using package managers on OS X, NetBSD, and various flavors of Linux.

NOTE: These instructions assume that you are a non-admin user, but have sudo privileges. If you are doing this from an admin or root account you may be able to omit the sudo from many of the commands listed here.

[Linux][OpenSUSE] [Ubuntu][Debian] [CentOS]
[Macintosh OS X] [MacPorts] [Fink]
[NetBSD]


Linux

If your variety of Linux isn't listed and you successfully installed OOF2 on it, we would appreciate it if you'd tell us what you did, so that we can include your instructions here. Also, Linux distributions and packages sometimes change, so these instructions may be outdated. If they are, please let us know!

OpenSUSE

Run these commands:

   sudo zypper install python-devel
   sudo zypper install gtk2-devel python-gtk-devel libgnomecanvas-devel
   sudo zypper install liblapack3 lapack blas libblas3
   sudo zypper install libMagick++-devel
   sudo zypper install libbz2-devel
   sudo zypper install libtool
(tested with OpenSUSE 11.3.)

Ubuntu

Run these commands:

   sudo apt-get remove graphicsmagick-libmagick-dev-compat
   sudo apt-get install python-gtk2-dev
   sudo apt-get install libgnomecanvas2-dev
   sudo apt-get install libmagick++-dev
   sudo apt-get install liblapack-dev
The first line is only necessary if already have GraphicsMagick installed, but it's harmless if you don't. (Tested with Ubuntu 10.10 and 11.04.)

Debian

See Ubuntu. The same packages should work.

CentOS

Run these commands:

   yum install libgnomecanvas-devel
   yum install gtk2-devel pygtk2-devel python-devel
   yum install lapack-devel blas-devel libbz2-devel
   yum install bzip2-devel ImageMagick-c++-devel
   yum install libtool
   yum install gcc-c++
(Tested with CentOS 5.5.)


Macintosh OSX

Two commonly used package managers on OS X are MacPorts and fink. Both should work. If you have neither installed already, it will be easier to use MacPorts.

Although using either is much easier than installing all of the OOF2 dependencies by hand, neither fink nor MacPorts works completely smoothly because the default version of ImageMagick provided by each package manager is incompatible with OOF2. These instructions describe how to install ImageMagick as well.

[Update 4/2012: The default version of ImageMagick appears to work with MacPorts on OS X 10.7 (Lion). If you're using 10.7 or later, try following the instructions for 10.7 below. If OOF2 crashes when displaying images, rebuild it after following the instructions for 10.6, and let us know what happened so that we can correct these instructions.]

Neither fink nor MacPorts will install the version of swig that OOF2 requires. See Installing SWIG, below, if you need it to install it. If you aren't building your own OOF2 extensions, and if you use --skip-swig when building OOF2, you don't need to install SWIG.

Before you do anything else, make sure that you have installed X11, which is an optional installation on the Apple system DVDs. (Some old versions of Mac OS X have two packages, X11User.pkg and X11SDK.pkg. Install them both.) In principle, it's possible to use other X11 implementations, but we don't have any experience with them and find that Apple's X11 works well. (If you're using OS X 10.5, the X11 on the Apple system DVDs is broken. The latest development release of X11 is much better, and can be downloaded from Mac OS Forge).

When the instructions below tell you to type a command, type it in a Terminal window. You can copy and paste the lines from this page.

Macintosh OS X with MacPorts

  1. Install Xcode from the Optional Installs folder on the OS X DVD or the Apple App Store.

  2. Install MacPorts from http://www.macports.org/install.php, following their instructions. It's easiest to use the .pkg installer. If you get error messages when running "sudo port -v selfupdate", open a new Terminal window and try again.

  3. Type these commands. Some of them may take a few hours to run, depending on whether or not your computer already has some of the dependencies installed.

          sudo port install pkgconfig
          sudo port install py27-numpy -atlas 
          sudo port install py27-pygtk
          sudo port select python python27
          sudo port install libgnomecanvas
    
    Note: If you prefer to use Python 2.5 or Python 2.6 instead of Python 2.7, replace the '27's in the commands with '25's or '26's.

    Note: The numpy line is there to tell MacPorts to install the version of numpy that doesn't use atlas. Atlas is a substitute for the blas libraries distributed with OS X, and takes a very very long time to install. If you either already have atlas installed or don't mind waiting for it to build, you can skip the py27-numpy installation step completely. In that case, the default, atlas-using, version of numpy will be installed automatically when you install py27-gtk.

  4. If you're using OS X 10.6 or earlier, do this:

    1. Type these commands:

            mkdir -p ~/ports/graphics/ImageMagick
            cp /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/graphics/ImageMagick/Portfile \
                   ~/ports/graphics/ImageMagick
            cd ~/ports
            sudo portindex 
      Note: If you're using MacPorts version earlier than 2.0.4, replace the path in the second line with
      /opt/local/var/macports/sources/rsync.macports.org/release/ports/graphics/ImageMagick/Portfile

    2. Using any text editor (not a word processor!) edit ~/ports/graphics/ImageMagick/Portfile, appending these three lines:

            variant no_openmp description {Disable OpenMP} {
               configure.args-append   --disable-openmp
            } 

    3. Type this command:

            sudo port install ImageMagick +no_openmp

  5. If you're using OS X 10.7 (or later?), type this commmand:

          sudo port install ImageMagick

  6. If you're using Python 2.6 or 2.7, and you get this message when trying to build OOF2

      Can't find pygtk-2.0! Version 2.6 or later required
    then you need to work around a MacPorts bug by setting the PKG_CONFIG_PATH environment variable to /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/pkgconfig before building. Replace the 2.7 with 2.6 if you're using python 2.6. For example, if you're using the bash shell, type
      export PKG_CONFIG_PATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/pkgconfig
    
    You can put the line in your .profile file in your home directory to make the change permanent, if you find yourself rebuilding OOF2 frequently for some reason.

Macintosh OS X with fink

  1. Install Xcode from the Optional Installs folder on the OS X DVD or the Apple App Store.
  2. Install fink, by going to http://www.finkproject.org/download/srcdist.php and following the instructions there. If the bootstrap script asks you to choose a mode and you're on a 64-bit capable Mac, choose 64bit-only.

    If you already have fink installed in 32 bit mode, you don't need to reinstall everything just to change to 64 bit mode. You may need to force ImageMagick to build in 32 bit mode in step 5.

  3. Enable the "unstable" fink packages.

    (a) Run "sudo fink configure", and answer "y" when asked about the unstable tree.

    (b) Run these commands:

           sudo fink selfupdate
           sudo fink selfupdate-rsync
           sudo fink index -f
           sudo fink scanpackages 

  4. Use fink to install the libraries that ImageMagick will require by typing these commands:

           sudo fink install libjpeg
           sudo fink install lcms
           sudo fink install libpng14-shlibs 

  5. Build ImageMagick without OpenMP, which is incompatible with OOF2 on OS X.

    • Go to http://www.imagemagick.org. Click "Download". Choose a site to download it from. Download the file with the latest version number and the .bz2 suffix.

    • Uncompress and untar the package:

             tar -xjf ImageMagick-<version>.tar.bz2
      
      where <version> is 6.6.7-10 or something like that.

    • Run these commands:

              cd ImageMagick-<version>
              ./configure LDFLAGS=-L/sw/lib CPPFLAGS=-I/sw/include --disable-openmp

    • Check the output from the configure command. If it says that support for some image format that you need hasn't been included, you probably need to go back to step 4 and install more packages from fink. The "Packages" link on the fink website will let you search for the package name.

      (If the output indicates no support for formats for which you are sure the libraries have been installed, and if it's possible that you have a 32 bit version of fink, try reconfiguring ImageMagick with CPPFLAGS="-I/sw/include -m32" (including the quotation marks!) instead of CPPFLAGS=-I/sw/include. The OOF developers haven't tested this. Please let us know if it works or not.)

    • Build and install ImageMagick by running these commands:

              make
              sudo make install 

  6. Use fink to install the other packages that OOF2 requires by typing these commands, some of which may take a while to run:
           sudo fink install python 
           sudo fink install pygtk2-gtk-py27-dev
           sudo fink install libgnomecanvas2-dev
    

Installing SWIG on OS X

The only obstacle to installing swig 1.1 build 883 on a Mac is that the Mac's file system is not case sensitive, and swig's build procedure tries to make a subdirectory named SWIG and a file named swig in the same directory. You can install swig on a case-insensitive disk, you just can't build it there. There are at least three ways to get around this inconvenience:

  • Build swig on a disk with a different type of file system. Format the disk with the Unix File System, using Apple's Disk Utility application.
  • Use Disk Utility to create a disk image, formatted with the Unix File System. After you open the disk image, it will act just like a real disk, and you can use it to build swig.
  • Hack the swig source files so that it doesn't have a case problem. If you don't mind a second hand swig, you can download our modified version here:


NetBSD

OOF2 version 2.0.5 and 2.1.1 or later will work on NetBSD. OOF2 version 2.1.0 does not work. These commands were sufficient to install OOF2 on a 32-bit version of NetBSD 5.1. Execute them from a root account.

    echo /usr/X11R7/lib >> /etc/ld.so.conf
    pkg_add pkg-config
    pkg_add py-gobject-shared
    pkg_add py26-gtk2
    pkg_add libgnomecanvas
    pkg_add ImageMagick
    pkg_add freetype2
    pkg_add fontconfig
      
The first line may not be necessary if you set LD_LIBRARY_PATH.

Installing the prerequisites will provide a program called "python2.6" in /usr/pkg/bin. You can use this to build oof2, but you'll have to invoke it explicitly:

  python2.6 setup.py build --skip-swig --library-dirs=/usr/pkg/lib install
You could also create an alias or symbolic link called "python" that points to /usr/pkg/bin/python2.6, and then you can follow the instructions in README without change.