Building Guile 2.0 on the Mac
Introduction
Guile 2.0 was just released in February so neither Fink nor MacPorts have support for it yet. There's no reason to wait, though. It's easy to build Guile from the source distribution. The only problem is that Mac OS X is missing several of the libraries that Guile needs, so they must be compiled and installed first.
In the step-by-step directions below, I have you rerun configure
after each step rather than trying to compile and install all the
libraries first. That's because your system may have fewer or more
missing libraries than mine and rerunning configure will tell you what
you need to do next.
Note that you'll need to be root or use sudo when running make install.
Step-by-step instructions
- Go to the Gnu Guile Web site and download the latest stable release (2.0.0 as of this writing).
-
Untar the source into the directory where Guile will live, change
into that directory and run
configure. Unless you have a current Gnu multiple precision library installed,configurewill return an error saying:Gnu MP 4.1 or greater not found, see README
-
If you don't get this error, you already have Gnu MP installed; go on
to step 4.
a. Otherwise, retrieve Gnu MP from the GMP Web site. I used the latest stable release, GMP 4.3.2 but there is also a “performance release,” GMP 5.0.1.
b. Run
configurewith the build option:./configure --build=x86_64-apple-darwin10
If you don't specify the
buildoption, the MP library will be built for a generic x86 system and the Guileconfigurescript will fail again with the same error. Ifx86_64-apple-darwin10does not describe your system, check the Guileconfig.logfile to see what it's expecting.c. Run
make check. This will exercise the library and make sure everything was built correctly.d. Run
make install -
Change back to the Guile directory and rerun
configure. The next error will tell you the next missing library. I gotconfigure: error: GNU libunistring is required, please install it.
a. Retrieve
libunistringfrom the libunistring Web site and untar it into a working directory.b. Do the usual
configure/make/make installdance to make and install the library. -
Return to the Guile directory and rerun
configure. This timeconfigurewill complain about a missingpkg-configscript. If you don't get this error go on to step 6.a. Retrieve
pkg-scriptfrom the pkg-config Wiki.b. Untar it into a working directory and run
configure/make/make install. -
Return to the Guile directory and rerun configure. This time
configurewill complain about a missinglibffi. If you did not get this error, go on to step 7.a. Retrieve the library from the libffi Web site.
b. Untar the library into a working directory and run
configure/make/make install. -
Return to the Guile directory and rerun configure. The
configurescript will complain about a missing BDW-gc library.a. Go to http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/ and down load the source for Version 7.1. Note that the stable version does not compile on the Mac.
b. Untar the source into a working directory and do the usual
configure/make/make check/make install. At some point (either during themakeor themake checkyou might get an error complaining that theucontextroutines are deprecated and that you need to specify _XOPEN_SOURCE. I did this by editing the source formach_dep.cand including the statement#define _XOPEN_SOURCE
right before the
#include <ucontext.h>
-
Return to the Guile directory and rerun
configure. This timeconfigureshould finish normally and you can try compiling Guile. If you get an error about the missing symbol_rl_get_keymap_name, you will need to go to the readline library Web page and get the latest version of the library. Before you build the library, delete or rename thelibreadlinethat is in/usr/lib. That version of the library is the BSD version supplied by Apple and is no longer compatible. Then build and install the newlibreadlinewith the usualconfigure/make/make install. Return to the Guile directory and runmake clean. Then rerun themake. If you don't run themake cleanGuile may sigfault when you try to run it. Check out your build by runningmake checkand then do themake install. At this point you should have a working version of Guile 2.0.