Installing the Development Version of the Crunch Compiler from Chicken Scheme

  1. October 2025

Disclaimer: There will be changes in the future and I would not be surprised if this already stops working tomorrow. But for today, this works!

The target is to build the chicken-crunch command.

We repeat the following steps:

for the following packages

  1. a Chicken Scheme 6 bootstrap version tar.gz tarball
  2. the latest ‘chicken-core’ from a git repo
  3. the latest ‘crunch’ egg from svn

The script show how these steps are built one after another.

Installation Commands

You find the the following commands also as script to under:

https://srctxt.com/archive/2025/20251025_install-crunch-dev/install-crunch-dev.sh


set -e
set -u


reset= # do nothing if 'reset' is empty, other wise rebuild all the steps

chicken_boot_url='http://www.call-with-current-continuation.org/chicken-6-prelim.tar.gz'
chicken_core_url='https://code.call-cc.org/git/chicken-core.git' 
chicken_crunch_url='https://anonymous@code.call-cc.org/svn/chicken-eggs/release/6/crunch'

chicken_home="$HOME/Builds/chicken-crunch"

chicken_boot_prefix="$chicken_home/chicken-boot"
chicken_prefix="$chicken_home/chicken"
chicken_bins="$chicken_prefix/bin"


mkdir -p  "$chicken_home"
cd "$chicken_home"


chicken_boot_file="${chicken_boot_url##*/}"
[ -f "$chicken_boot_file" ] || wget "$chicken_boot_url" -O "$chicken_boot_file"


chicken_boot_dir="${chicken_boot_file%%.*}"

[ -n "$reset" ] && rm -rf "$chicken_boot_dir" 

if [ -d "$chicken_boot_dir" ]; then 
    echo "OK: chicken-boot $chicken_boot_dir  already exists, skip ... "
else
    mkdir "$chicken_boot_dir"
    tar xfvz "$chicken_boot_file" -C "$chicken_boot_dir" --strip-components=1 

    cd "$chicken_boot_dir" 
    sh ./configure --prefix "$chicken_boot_prefix"
    make
    make install
    cd "$chicken_home" 
fi


[ -n "$reset" ] && rm -rf chicken-core

if [ -d "chicken-core" ]; then
    echo "OK: chicken-core already exists, skip ... "
else
    git clone "$chicken_core_url"  chicken-core

    cd chicken-core/
    ./configure --prefix "$chicken_prefix" --chicken "$chicken_boot_prefix/bin/chicken"
    make 

    set +e # disable set -e becaues of html errors in make install
    make install
    set -e
    cd "$chicken_home" 
fi


[ -n "$reset" ] && rm -rf crunch

if [ -d "crunch"  ]; then 
    echo "OK: chicken-crunch already exists, skip ... "
else
    rm -rf crunch
    svn co --username anonymous --password "" "$chicken_crunch_url"
    cd crunch/trunk
    "${chicken_bins}/chicken-install"
fi

[ -e "$chicken_bins/chicken-crunch" ] || {
    echo "Err: no chicken-crunch under $chicken_bins/chicken-crunch" >&2
    exit 1
}

rm -f hello.scm
echo '(import (scheme write))' > hello.scm
echo '(define (main) (display "Hello world"))' >> hello.scm

rm -f hello.c

echo ""

echo "${chicken_bins}/chicken-crunch" hello.scm -o hello.c
"${chicken_bins}/chicken-crunch" hello.scm -o hello.c

echo ""

rm -f hello.exe
echo cc hello.c  -o hello.exe  $("${chicken_bins}/chicken-crunch" -cflags -libs)
#cc hello.c  -o hello.exe "$("${chicken_bins}/chicken-crunch" -cflags -libs)" 

echo ""
echo "OK: every thing looks fine, you can now run the test program in '$chicken_home' with ./hello.exe"