Thursday, March 23, 2006

Install gmp with c++ with Dynamic Libraries.

I have to admit I'm a libtool noob. However I know gcc and g++ 4.0.1 available with MacOS Tiger are able to compile c++ dynamic libraries. In fact this is done with flag -dynamiclib
However, gmp if configured with --enable-cxx and without disabling dyamic libraries fails. In fact it passes g++ the -shared option (that works for linux). If you compile plain gmp with no C++ support, the problem does not exist. I'm afraid it's a bug with gmp libtool (I suppose you could fix it with autoreconf, but I did not try it).
Unfortunately I need c++ support since I have to work with ppl. The solution is to modify all occurrences of "-shared" in the configure file with "-dynamiclib". And appears not to work.
The same hack worked with readline (but I'm afraid that's because readline was written in C and somehow support for C dynamic libraries seems better on mac os x: I'd say "older", so it's more likely developers made it work.
However darwin ports is able to build it the correct way. You only have to specify somewhere that gmp-cxx-wrappers should build with --host=none-apple-darwin

No comments: