How to compile OpenDX on MacOS 10.6 Snow Leopard

Paul Tackley

Update 27 January 2011: Use fink (http://www.finkproject.org/). dx is now in the "stable" distribution. I successfully compiled and installed it using fink 0.32.0 on MacOS 10.6.8.

Older instructions from 3 August 2010:

1. Make sure Xcode is installed (e.g. from the DVD with the operating system)

2. Use FINK to install openmotif (see http://www.finkproject.org/)

3. Download the source code for dx-4.4.4 from www.opendx.org

4. Unpack, go to the directory with the source code and type:

"configure --without-javadx --x-includes=/usr/X11R6/include/ --x-libraries=/usr/X11R6/lib/ --with-motif-libs=/sw/lib/ --with-motif-includes=/sw/include/

make

sudo make install"

That worked on my Mac!

hint: make sure that the compilation process is using the version of gcc or g++ that comes with Xcode, not one that you have downloaded (e.g., from hpc.sourceforce.net) or compiled yourself (e.g., using FINK). Otherwise, it may crash with an error in some header file.

How to compile loadable DX modules on Snow Leopard

I previously (e.g. with Leopard) used outboard modules but for some reason these don't seem to work on Snow Leopard. Loadable modules do, however, work. Here I assume you have already written the module (.c and .mdf files), for example following the online guide and examples that come with the dxsamples-4.4.0 package, and just need an appropriate makefile, since there is no Mac makefile given in the samples. Below is one that works for me.

# makefile for LOADABLE module on macosx

# make sure this points to the right directory
BASE = /usr/local/dx
ARCH = macos

include $(BASE)/lib_$(ARCH)/arch.mak

BIN = $(BASE)/bin
INCLUDES = -I$(BASE)/include

CFLAGS = $(INCLUDES) -D$(ARCH)
LDFLAGS = -shared -e DXEntry -undefined dynamic_lookup


ReadStagVP: ReadStagVP.o
$(BIN)/mdf2c -m ReadStagVP_loadable.mdf > user.c
$(DXCC) $(CFLAGS) -c ReadStagVP_user.c
$(DXCC) $(LDFLAGS) -o ReadStagVP ReadStagVP.o ReadStagVP_user.o

ReadStagVP.o: ReadStagVP.c
$(DXCC) $(CFLAGS) -c ReadStagVP.c