Killring Rick Dillon's Weblog

Developer Notebook: Installing Rebol

After more than 15 years of work as a closed source language, Carl Sassenrath has decided that Rebol 3 will be released as open source. The code was released a few days ago, so I decided it was time to check it out.

Why is Rebol interesting?

The Rebol manifesto is great. Any computer science purist would fall in love:

It's about language... the enabling technology behind all technologies.

Love at first sight. But, philosophy aside, what else?

In many ways, it seems like Rebol is a really well-designed, modern counterpart to Lisp. Code is data.

32-bit Only? Really?

Even though the source for Rebol 3 has been released, I decided to download version 2 since that is more stable. First obstacle: I'm running on 64-bit Linux and there are only 32-bit downloads. I'm running multi-arch, but had to install 127 MB of packages to get the 32-bit version of libxaw7 so the (tiny) Rebol runtime would run. Here's the full list of depends for the 32-bit runtime:

linux-gate.so.1
libX11.so.6
libXext.so.6
libXt.so.6
libXaw.so.7
libXmu.so.6
libstdc++.so.6
libfreetype.so.6
libm.so.6
libdl.so.2
libgcc_s.so.1
libc.so.6
libxcb.so.1
libSM.so.6
libICE.so.6
libXpm.so.4
ld-linux.so.2
libz.so.1
libXau.so.6
libXdmcp.so.6
libuuid.so.1

There's also the issue of fonts. On Debian, get xfonts-100dpi and xfonts-75dpi installed and then restart X. Otherwise you'll get some cryptic errors that tell you very little about what you need to do to fix the problem.

Bootstrapping

After getting Rebol 2 up and running, I mainly wanted to get the source release for Rebol 3 compiled. After all, if the language weren't open-source, I wouldn't even be looking at it. I build software all the time, so I thought it was worth a shot. To build Rebol, you need to have all the dependencies in place, but you also need a working copy of Rebol on your system, since the build process uses Rebol to build Rebol. This involves a sort of strange dance where you copy the runtime into the make directory and call it r3-make and then run make prep to get the build process rolling. This is all outlined on the GitHub page for R3, though it simply fails to work on my machine. I keep getting the mysterious error:

** Script Error: This script needs View 2.100.100 or better to run correctly
** Near: do/args script system/script/args

The makefile is calling out to a series of Rebol scripts. For example, make-headers.r specifies that it needs version 2.100.100 of Rebol with

Needs: 2.100.100

on line 13. I've been using REBOL/View 2.7.8, though, which under semantic versioning, comes before 2.100, which would indicate that you need Rebol 3 to build Rebol 3, since 2.7.8 appears to be the latest available build of Rebol 2. One of the biggest disappointments of this error is that there's no stack trace, so I can't jump directly into the file where the check is failing and ferret out the cause. I've come to expect much better error handling from production-grade languages than Rebol seems to be exhibiting in this instance. It also seems to have a habit of clearing the terminal before printing the error, making a bit more difficult to see where it the makefile the issue arose.

It turns out that the issue manifests itself when the following command is run;

./r3-make -qs ../src/tools/make-headers.r

Given that I don't have R3 in binary form, (I later found out I'd just missed the download for it on the Rebol site), I figure I'll just try to use my old 2.7.8 version. By going through all the tools/*.r files and commenting out the meta information specifying the required Rebol version, I can complete make prep with success. But then make fails:

make r3
make[1]: Entering directory `/home/rpdillon/apps/r3/make'
mkdir -p objs
gcc ../src/core/a-constants.c -c -DTO_LINUX -DREB_API  -O2 -fvisibility=hidden -m32 -I. -I../src/include/ -o objs/a-constants.o
In file included from /usr/include/stdlib.h:25:0,
                 from ../src/include/sys-core.h:53,
                 from ../src/core/a-constants.c:33:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.
make[1]: *** [objs/a-constants.o] Error 1
make[1]: Leaving directory `/home/rpdillon/apps/r3/make'
make: *** [top] Error 2

Probably a missing -dev package for some library. The Rebol build instructions don't really mention anything about dependencies, so I'll have to dig around and see what it needs. After some searching, it turns out to be a x86 library issue again. I resolved it with:

sudo apt-get install libc6-dev-i386

That brought in another 20MB of dependencies. Another try with make worked, and R3 built in 20 seconds on my aging laptop. A simple ./r3 invocation yielded this banner:

**************************************************************************
**                                                                      **
**  REBOL 3.0 [Alpha Test]                                              **
**                                                                      **
**    Copyright: 2012 REBOL Technologies                                **
**               All rights reserved.                                   **
**    Website:   www.REBOL.com                                          **
**                                                                      **
**    Version:   2.101.0.4.4                                            **
**    Platform:  Linux libc6-2-11-x86                                   **
**    Build:     16-Dec-2012/20:46:42                                   **
**    Warning:   For testing purposes only. Use at your own risk.       **
**                                                                      **
**    Language:  none                                                   **
**    Locale:    none                                                   **
**    Home:      ./                                                     **
**                                                                      **
**************************************************************************

Open Source Improvements

It's really good to see Rebol going open source under Apache 2. The kinds of obstacles I ran into getting R3 up and running indicate that the community will have a lot to offer in refining the configuration and building process, especially on 64-bit systems. There are several improvements that could be made that come to mind even though I haven't yet written a line of Rebol yet.

  • Rebol should build cleanly in a native 64-bit environment
  • Passing --help or --version to the Rebol runtime invokes the interpreter; very unconventional and somewhat script-hostile
  • Lack of automake functionality. The now-familiar ./configure && make && sudo make install is nowhere to be found
  • Lack of dependency documentation. Popular distros (Debian derivatives, Fedora derivatives) should be covered in the documentation
  • Getting official packages into the major repostories

The good news is that going open source will fuel exactly these kinds of improvements. It will be exciting to watch the project grow in it's new incarnation. Thanks Carl.