Compiling USF under macOS Catalina 10.15.5 (2020)

Here’s what I did to compile static binaries of Gerard Kleywegt’s Uppsala Software Factory (USF) suite from source on macOS Catalina 10.15.5.

You’re going to need the following tools, and some basic knowledge of how to use the Terminal app.

  • Intel C++ and Fortran (I used IFORT 20200623) – students can get this for free.
  • The GCC compiler collection (I used GCC 10.2.0 from homebrew)
  • A copy of the CCP4 program suite – the full CCP4 suite, not the source code. Use their package manager for an easy installation process.

Everything will be done in Terminal, so open it.

Change directory to your Desktop.

cd ~/Desktop

Grab a copy of the USF source code from Martyn Winn’s Github repository.

git clone

Change directory to the freshly cloned repository

cd Uppsala-Software-Factory

First we need to rebuild Gerard’s personal library – gklib – so move to that directory and edit the file make_fresh_gklib.csh.

cd gklib; chmod +x make_fresh_gklib.csh; nano make_fresh_gklib.csh

Scroll down to the section marked

OS X build ########################################################## OS X Build

We’re going to delete all the 32 bit stuff that stops this library from compiling. To do this, in the line

set fort="gfortran -D$OS -m$int_size -O -u -check_bounds -std=legacy -ffixed-line-length-132"



and add


Similarly, for the line

set ccom="gcc -c -g -D$OS -m$int_size"



Finally, we need to change the name of this library. Change the line

set lib=osx_kleylib



Ok, let’s build gklib. First save and exit nano (control+o, then control+x). Now run make_fresh_gklib.csh using the command


A load of stuff should print to screen as it compiles – it’ll look like this.

And then like this when it’s done.

Now we need to compile the actual USF suite. Move back a directory and make a copy of the Makefile provided by Martyn.

cd ../; cp Makefile_with_CCP4 Makefile; nano Makefile

We’re going to make several changes so the Makefile knows where everything is.

Change the line

srcdir = /home/mdw/USF/Uppsala-Software-Factory


srcdir := $(shell pwd -P)

Just below this, add the line

gccdir = /usr/local/opt/gcc/lib/gcc/10

Change the lines

CC = gcc
FC = gfortran


CC = icpc
FC = ifort -static-intel

Change the line

LDFLAGS_CCP4 = -L/xtal/ccp4-7.0-src/ccp4-7.0/lib -lccp4f -lccp4c -lmmdb2


LDFLAGS_CCP4 = -L/Applications/ccp4-7.1/lib -lccp4f -lccp4c -lmmdb2

(If your copy of CCP4 is installed somewhere else, or is newer/older, you’ll need to modify this)

Change the line

LDFLAGS = -static -L$(srcdir)/gklib -lgk

to (all on one line)

LDFLAGS = -L$(srcdir)/gklib -lgk $(gccdir)/libgfortran.a $(gccdir)/gcc/x86_64-apple-darwin19/10.2.0/libgcc.a $(gccdir)/libquadmath.a

(If you aren’t using GCC 10.2.0 then you’ll need to adjust the version numbers accordingly).

Now save and exit nano (control+o, then control+x) and make a folder called bin

mkdir bin

Now run make


And you’re done! All of your static binaries are now in bin. You can check they’re statically linked by running

ltool -L bin/*

You should only see one library per program, and that library should be

/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

search previous next tag category expand menu location phone mail time cart zoom edit close