Compiling OpenSees on Max OS X 10.10

Prerequesites

  1. XCode 6.0.1
  2. Homebrew - ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  3. gcc - brew install gcc
  4. tcl/tk - brew install tcl-tk

Setup

Attached are two files to help the compilation, a script to do some cleaning and the Makefile.def

Folder stucture, I placed the source code inside a root folder to make it easier to update:

/build.sh
/OpenSees/Makefile.def
/OpenSees

The build.sh is entirely to make the changes in the makefiles smaller so I can update more easily.

The largest thing I changed in the Makefile.def what the CC++, CC, and the FC locations around line 150:

1
2
3
CC++ = /usr/bin/g++
CC = /usr/bin/gcc
FC = /usr/local/bin/gfortran

The gnu gcc compiler from brew currently doesn’t support 10.10 so that is why I am using the XCode ones in /usr/bin but XCode doesn’t have gfortran, so you still need the brew compiler.

Once you have this set up, you should be able to run (with a chmod +x):

build

or from the OpenSees folder you can pass in the HOME

make HOME=/Users/youruser/OpenSees

Troubleshooting

Since the brew install of gfortran doesn’t link the libgfortran you will get the following error:

clang: error: no such file or directory: '/usr/local/lib/libgfortran.a'

Fix that by linking in the libraries:

1
2
3
ln -sf /usr/local/lib/gcc/i686-apple-darwin11/4.2.1/x86_64/libgfortran.a /usr/local/lib
ln -sf /usr/local/lib/gcc/i686-apple-darwin11/4.2.1/x86_64/libgfortranbegin.a /usr/local/lib
ln -sf /usr/local/lib/gcc/i686-apple-darwin11/4.2.1/x86_64/libgfortranbegin.so /usr/local/lib
comments powered by Disqus