8/7/18

Build Guile for FreeBSD

I love Scheme and wanted to use it under FreeBSD. One of the problems though with Scheme is that there is no default implementation.
Considering the effort and the improvements of Gnu Guile during the last years I thought to give it a try.
The binary packages provided via the pkg facility are very old and the same applies for the ports so I had to build a copy on my own, something that I never tried before.

I followed instructions from https://www.gnu.org/software/guile/download/ and cloned the repository
$ git clone git://git.sv.gnu.org/guile.git

I then cd into the directory and tried to build it. In the README file you will find instructions specific for FreeBSD 11.0
FreeBSD 11.0:
For a build supporting threads, please `pkg install' the following
- pkgconf : provides pkg-config
- gmake : /usr/bin/make does not work
- boehm-gc-threaded : needed for threaded support

Configure as:

$ ./configure --with-bdw-gc=bdw-gc-threaded
You first need to make sure that following packages are installed before building. Otherwise build or installation might fail with no helpful error message.

$ sudo pkg install pkgconf gmake boehm-gc-threaded libtool automake autoconf autogen readline libffi libltdl gmp libunistring texinfo gettext gettext-runtime gettext-tools flex indexinfo texinfo

First thing I noticed is that the configure file is missing. Apparently if you want to build the project you need to also read the HACKING file.

You should first run the ./autogen.sh to generate the configuration file.
Under FreeBSD 11.2 I got
m4: illegal option -- -
usage: m4 [-gPs] [-Dname[=value]] [-d flags] [-I dirname] [-o filename]
        [-t macro] [-Uname] [file ...]
After some search I found this https://lists.gnu.org/archive/html/bug-guile/2014-01/msg00015.html

$ autoreconf -i --force --verbose


Another helpful article was https://www.reddit.com/r/guile/comments/8np6ad/compiling_guile_223_on_freebsd_11/

based on that instead of just running /configure with one option I did the following:

$ ./configure --with-threads --with-bdw-gc=bdw-gc-threaded --with-libreadline-prefix=/usr/local --with-libintl-prefix=/usr/local --with-libgmp-prefix=/usr/local --with-libltdl-prefix=/usr/local --with-libunistring-prefix=/usr/local --with-libiconv-prefix=/usr/local


Once configure is complete do:
$ gmake

I was lucky enough that after all effort by following the above steps to have a successful built. Last step is to install guile.

$ sudo gmake install

if installation fails make sure you have installed all required packages. I tried this several times and found out that if any the required packages is missing the built or the installation fails with no clear indication of the real issue.
Good luck



No comments:

Post a Comment