Friday, May 4, 2007

mrbayes 3.1.2 readline errors

Compilation of MrBayes v 3.1.2 is failing on Mac with the version of readline that Apple ships. I get messages about rl_completion_matches being undeclared when compiling bayes.c and then get a link error because the symbol for rl_completion_matches is not found.

You can hand edit the Makefile to not use readline, for example by putting
USEREADLINE ?= no in place of USEREADLINE ?= yes but then you lose the handy tab completion.


I opted to add env sensitivity in place of:


ifeq ($(strip $(USEREADLINE)),yes)
CFLAGS += -DUSE_READLINE
LIBS += -lncurses -lreadline
endif


I used:


ifeq ($(strip $(USEREADLINE)),yes)
ifneq ($(READLINE_PREFIX), none)
CFLAGS += -I$(READLINE_PREFIX)/include
LIBS += -L$(READLINE_PREFIX)/lib -bind_at_load
endif
CFLAGS += -DUSE_READLINE
LIBS += -lncurses -lreadline
endif


then (in a bash shell) before invoking make, I issued the command:

export READLINE_PREFIX=/usr/local

because I have installed readline-5.2 under /usr/local on my machine.

I get multiple definition warnings about ncurses symbols _UP, _PC, and _BC, but it compiles, links, and the readline facilities do work.

Thursday, May 3, 2007

ming flash animation library

I was interested in using the python bindings to ming to make simple swf animations for teaching purposes.

There was one compilation roadblock on my MacBook, but it wasn't too bad to get up and running. Here is what I did (not on the first try):

$ tar xfvz ~/archives/ming-0.4.0-dev-2006_04_20.tar.gz
$ cd ming-0.4.0/
$ sh autogen.sh
$ ./configure
$ open src/actioncompiler/compile.*
$ make static
$ cd py_ext/
$ python setup.py build
$ gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.4-fat-2.4/ming_wrap.o -L/usr/local/lib -L.. -lming -lz -o build/lib.macosx-10.4-fat-2.4/_mingc.so
$ python setup.py install
$ python shape.py
$ open test.swf

Note: the gcc is command just the last line of output that the setup.py build used with the -arch ppc removed. The C++ lib's Makefiles do not create universal binaries, so the linking with -lming was causing an ld warning.

The
test.swf file created by the test mad Adobe Illustrator unhappy, but displayed in Firefox.