Installing Bher

From Church Wiki
Jump to: navigation, search

OS X installation

First, make sure you have Xcode installed (if you are on Lion, you need to have version 4.2 -- not, e.g., 4.3).

Next, install MacPorts.

In the Terminal, run these commands to install gsl, libffi, and gmp using MacPorts:

sudo port install gsl
sudo port install libffi
sudo port install gmp

(Note: If port does not work after installing MacPorts, make sure that the paths are set in the right file for your shell. For instance this is often .bash_profile but MacPorts may write the paths to .profile.)

Next git Vicare and check out the correct version:

git clone git:// vicare
cd vicare
git checkout 08bd828acfa9382324150b41f4e86c540c10a886

Then configure Vicare:

./configure --enable-libffi CFLAGS='-I/opt/local/include' CPPFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib -lgsl -lgslcblas' 
  • Note 1: You want to set the flags CFLAGS and CPPFLAGS the paths that have gmp.h and ffi.h -- if the above doesn't work search for the header files and put in the right paths. More recent MacPorts libffi packages appears to put ffi.h in /opt/local/lib/libffi-3.1.0 You can include several paths by using quotes and several -I flags. The same for the LDFLAGS where you want to specify the locations for libgmp and libffi.)
  • Note 2: If your automake version exceeds 1.11.1, then you may need to first edit vicare/scheme/, replacing all three occurrences of "pkglib_DATA" with "pkgdata_DATA", before will succeed.

After the configuration completes, compile the source by issuing the commands:

sudo make install

You can test your vicare install:

make check
make test

Get scheme-tools and bher:

git clone git:// scheme-tools
svn co bher

This will create two directories, scheme-tools and bher. Add these directories to the path variables inside your .profile file (or .bashrc or .bash_profile, or whatever the right file for your shell is):

export VICARE_LIBRARY_PATH=.:<bher-directory>:<scheme-tools-directory>
export PATH=.:<bher-directory>:$PATH


bher bher/tests/

Ubuntu installation

First get libraries that Bher depends on:

sudo apt-get install build-essential autoconf m4 automake perl
sudo apt-get install libgsl0-dev libffi-dev libgmp3-dev
sudo apt-get install subversion

Next, git Vicare Scheme (make sure you are in the directory you want to install the program to - this will be denoted as <DIR> from now on):

git clone git:// vicare
cd vicare
git checkout 08bd828acfa9382324150b41f4e86c540c10a886

Configure Vicare:

sudo apt-get install texinfo
./configure --enable-libffi
sudo make install

Git the scheme-tools and Bher:

git clone git:// scheme-tools
svn co bher

Set up your paths - remember <DIR> should be replaced by the directory you installed to (e.g., /Users/johnsmith/). You may also want to add these to your .bashrc file:

export VICARE_LIBRARY_PATH=.:<DIR>/vicare/bher:<DIR>/vicare/scheme-tools
export PATH=<DIR>/vicare/bher:$PATH

Finally, test Church (you need to remain in the <DIR> path):

bher ./bher/tests/

Cygwin installation

This will require ~1.2 gigs of space. Install Cygwin with these packages:

  • autobuild
  • autoconf
  • automake
  • bison
  • emacs
  • gcc
  • gcc-core
  • gcc-g++
  • git
  • gmp
  • gsl
  • gsl-devel
  • libffi4
  • libgmp-devel
  • libgmpxx4
  • make
  • pkg-config
  • python
  • subversion
  • wget

Start Cygwin and then issue these commands to install libffi from source:

mkdir src; cd src
tar xvfz libffi-3.0.11.tar.gz
cd libffi-3.0.11
make install

Download and install vicare:

git clone git:// vicare
cd vicare
git checkout 08bd828acfa9382324150b41f4e86c540c10a886
sed -i.bak 's/pkglib_DATA/pkgdata_DATA/g' scheme/
./configure --enable-libffi CFLAGS='-I/usr/include -I/usr/local/lib/libffi-3.0.11/include' CPPFLAGS='-I/usr/include -I/usr/local/lib/libffi-3.0.11/include' LDFLAGS='-L/usr/lib -L/usr/local/lib -lgsl -lgslcblas -lblas'
make install
ln -s /usr/local/share/vicare/vicare.boot /usr/local/lib/vicare/vicare.boot

Install the jschurch-schemable version of bher and scheme-tools:

git clone -b schemable git://
git clone git://

Add bher and scheme-tools to path locations:

echo "export VICARE_LIBRARY_PATH=.:~/jschurch:~/scheme-tools" >> ~/.bash_profile
echo "export PATH=.:~/jschurch:$PATH" >> ~/.bash_profile

Set up some emacs modes to make editing nicer:

mkdir -p ~/.emacs.d/lisp
wget -O ~/.emacs.d/lisp/quack.el
wget -O ~/.emacs.d/lisp/church.el
echo ";; include path to quack.el and church.el" >> .emacs
echo "(setq-default load-path (cons \"~/.emacs.d/lisp/\" load-path))" >> .emacs
echo "(require 'church)" >> .emacs

It's best to use Emacs to edit your code and run Bher. Here's an introductory video and also see the Emacs page on this wiki for a more in-depth reference (NB: the eval shortcuts like C-x C-e, C-c C-e, C-c C-r, and C-c C-b are currently broken)

Personal tools