matsen/pplacer — Issue #185: Better OS X builds
Author: koadman
Created: 2011-11-12 18:00:22+00:00
State: open

Right now the OS X builds are for 10.7, but lots of people have older versions of OS X and 10.7 builds may not work on them. Also, if gsl could be statically linked it would eliminate the need to install libgsl manually which can be confusing for novice users.

To achive static gsl linking, the ocaml gsl binding makefile can be modified with the following patch:

--- Makefile.orig	2011-11-12 09:53:57.000000000 -0800
+++ Makefile	2011-11-11 16:22:16.000000000 -0800
@@ -1,5 +1,5 @@
# If you're compiling with cygwin, comment this out
-DYNAMIC_LINKING = true
+# DYNAMIC_LINKING = true

OCAMLC := ocamlc
OCAMLOPT := ocamlopt
@@ -149,7 +149,7 @@

install : all
$(OCAMLFIND) install gsl META \
- libmlgsl.$(A) dllmlgsl.$(D) gsl.cma gsl.cmxa gsl.$(A) $(CMI) $(MLOPTOBJ)
+ libmlgsl.$(A) gsl.cma gsl.cmxa gsl.$(A) $(CMI) $(MLOPTOBJ)

ocamlgsl.odoc : $(MLOBJ) $(CMI)
$(OCAMLDOC) -v -dump $@ $(filter-out gsl_misc.%, $(filter %.mli, $(SRC)))

`otool -L pplacer` can be used to check whether this worked.

In order to build binaries for older OS X, just add the compiler flag -mmacosx-version-min=10.4 -arch x86_64. I'm not sure what the best way to do make this work in ocaml would be, maybe export CC="gcc -mmacosx-version-min=10.4 -arch x86_64" ? Note that libgsl will also need to be built with these flags.