136
137
Note that the "./Setup.sh" command requires a compiler that supports
137
138
the "-M" option for generating dependencies. Normally this step is
138
139
executed on a GNU/Linux system.
141
The above should suffice for building from the CVS sources when some
142
binary release corresponding to the CVS sources has been successfully
143
obtained, unpacked and confirmed to run without errors. When not,
144
some modest manual configuration is called for. The next few sections
145
address this eventuality, why it might arise and how to overcome it.
147
Building from source on unix systems - ``The Hard Way''
148
====================================
150
These more detailed build instructions cover the case where no binary
151
release corresponding to the CVS sources runs successfully on your
152
system or none can be installed in the usual system-wide location(s).
154
If you don't care to understand the underlying issues, skip ahead to
155
the next section, which is a step-by-step ground-up methodology for
156
installing MIT/GNU Scheme from scratch from the CVS sources. If
157
anything goes wrong in that effort, however, you may need to return
158
here to understand what went wrong and what might be tried to fix it.
163
So why does MIT/GNU Scheme fail to install without the corresponding
164
binary release first being installed? (And how do you overcome that?)
166
In short, to transition a pristine checked out CVS source tree
167
installation from the ``maintainer-clean'' CVS build state into the
168
``distribution'' build state, the "./Setup.sh" uses MIT/GNU Scheme
169
itself to grovel over the Scheme sources to build up Scheme system
170
file dependencies and other distribution-specific configuration data.
172
This means that in order to invoke "./Setup.sh" successfully, you must
173
first already have some runnable version of MIT/GNU Scheme available.
178
So why might a binary release distribution fail to run on your system?
180
This may occur if your system's dynamic library modules (like `glibc')
181
do not match those against which the binary release was built or if
182
you simply do not have permission to install software packages in the
183
usual place(s) on your system.
185
It also may arise if the installed version of MIT/GNU Scheme on your
186
system does not match the version you are trying to build from the CVS
187
sources but you cannot (or prefer not to) uninstall it and replace it
188
with the matching version (as when release 7.6 is installed but you're
189
trying to build 7.7 sources while you or others on your system still
190
depend on the older version being installed for other projects, etc.).
195
A few simple environment variable settings are normally sufficient to
196
work around these difficulties but on rare occasion some more serious
197
manual preparations will be required. Specifically, if you cannot
198
successfully run _any_ MIT/GNU Scheme binaries then you will need to
199
skip to the next section first: ``MIT/GNU Scheme Tabula Rasa''.
201
Before delving into details, some high-level explanation is in order.
206
The CVS sources ship in `maintainer-clean' configuration. This means
207
that no generated "Makefile" nor "configure" files are present nor are
208
any C or Scheme compiled files. Additionally, various infrastructure
209
symbolic links used to identify the operating system and/or family of
210
microprocessor are not yet in place in the CVS tree build directory.
212
The combination of invoking "./Setup.sh" followed by "configure"
213
addresses these, as described in the build transition table in the
216
Alas, going from the "CVS" build state to the "distribution" build
217
state requires running a general tool over various file configuration
218
tables to set up various file dependency lists and system-dependent
219
Makefile directives and so forth. As you may have already guessed,
220
the general tool used to do this in the MIT/GNU Scheme CVS tree is
221
MIT/GNU Scheme itself.
223
Naturally, this results in a bit of a chicken-and-egg puzzle.
228
In a nutshell, both the "./Setup.sh" command and the "make" invocation
229
prescribed earlier require the availability of: 1) _some_ executable
230
MIT/GNU Scheme ``microcode'' file (usually named "scheme"), as well as
231
2) the base companion MIT/GNU Scheme microcode table ("utabmd.bin")
232
and run-time band for that microcode release. (named "runtime.com").
234
Moreover, in the case of the "make" invocation, we also require an
235
MIT/GNU Scheme run-time compiler band ("compiler.com" or "all.com")
236
containing the MIT/GNU Scheme native compiler so it can compile the
237
run-time system. Otherwise, the entire system run-time would be
238
running interpreter-only (including the compiler itself). Although
239
that may be a necessary evil on a platform for which the compiler has
240
not yet been ported (like on an EDSAC or an FTL nano-processor based
241
system), the default "make" directive assumes you want to compile the
242
run-time library and tools (including the MIT Scheme compiler itself).
247
Due to various release (in)compatibility issues--- such as re-named
248
internal system procedures, the hygienic macro system re-write, or
249
re-factored interfaces on internal system modules--- it is not
250
normally possible to build a given release (say, 7.7) from sources by
251
using an incompatible installed release (say, 7.6).
253
It is, however, often possible to build MIT/GNU Scheme from the ground
254
up from the sources even when the corresponding binaries are not fully
257
Naturally, this process is a bit delicate. It does require that
258
_some_ binary release has at least been obtained and unpacked, even if
259
the binary executable cannot be run (e.g., due to dynamic library
260
incompatibilities and the like, such as `glibc' versions, &c.) and
261
even if you do not have file system permissions to install software in
262
the usual system-wide locations (like `/usr/local/' or `/usr/share/').
264
The details of this modestly complicated process follow.
266
Building from source on unix systems - Not using an installed Scheme
267
====================================
269
There are two classes of complication that may occur when trying to
270
build MIT/GNU Scheme from scratch:
272
If you can obtain, unpack and successfully run some binary release
273
of MIT/GNU Scheme but you cannot install it in the usual place
274
then you may be able to do a ``warm'' build.
276
If, however, no obtainable binary MIT/GNU Scheme release package
277
successfully runs on your system--- e.g., due to their having
278
been built with dynamic libraries (like `glibc') that do not
279
match your particular system installation--- then a relatively
280
simple microcode ``cold'' build is required first.
282
Since a ``warm'' build is probably more common, we describe it first.
283
We're optimistic that way.
286
``Warm'' build using matching binary and source releases
287
--------------------------------------------------------
289
[0]. Obtain the appropriate binary release for the source you have.
291
The first step is to obtain the base "runtime.com" and "all.com"
292
run-time bands, the "scheme" executable (``microcode'') that
293
corresponds to the release we wish to build from the CVS sources,
294
and the microcode table ("utabmd.bin") and sundry other MIT/GNU
295
Scheme library support files (in `lib/mit-scheme/').
297
For instance, if the CVS sources are for the Scheme release 7.7.1
298
branch, then you require `mit-scheme-7.7.1-<cpu>-<ostype>.tar.gz'
301
If the "scheme" executable (``microcode'') from these obtained
302
binaries cannot run successfully on your system, you must resort
303
to the ``cold'' build procedure detailed below.
305
The next step diagnoses if that is the case for your system.
307
[1]. Verify that the binary release runs on your system.
309
Binary releases contain: 1) a `bin/' directory containing the
310
executable ``microcode'' (usually named "scheme"), and: 2) a
311
`lib/mit-scheme/' directory containing the run-time bands for
312
that microcode (along with some other goodies). You should
313
verify that these microcode and run-time binaries run on your
314
system before going any further.
316
You do that as follows...
319
First, assume the unpacked `bin' and `lib' directories are both
320
immediate subdirectories of a directory whose absolute pathname
321
is defined by the environment variable MITSCHEME_BOOTSTRAP_DIR.
323
This is mainly for expository convenience and purity of essence.
325
For example, type something like one of the following into your
326
interactive shell, depending on which shell you use and where you
327
placed the untar'd binaries:
330
export MITSCHEME_BOOTSTRAP_DIR="$HOME/testing/scheme-7.7.1"
332
export MITSCHEME_MICROCODE_DIR = \
333
"${MITSCHEME_BOOTSTRAP_DIR}/bin"
335
export MITSCHEME_EXECUTABLE = \
336
"${MITSCHEME_MICROCODE_DIR}/scheme"
339
setenv MITSCHEME_BOOTSTRAP_DIR "$HOME/testing/scheme-7.7.1"
341
setenv MITSCHEME_MICROCODE_DIR \
342
"${MITSCHEME_BOOTSTRAP_DIR}/bin"
344
setenv MITSCHEME_EXECUTABLE \
345
"${MITSCHEME_MICROCODE_DIR}/scheme"
347
Please note that none of these bindings end in a `/' character.
349
These are just convenience variables we define to help clarify
350
the following presentation. You may name them whatever you like
351
or simply type in full absolute file pathnames in place of their
352
appearances in what follows. Season to taste.
355
Next, you must define the standard internally-referenced Scheme
356
environment variable MITSCHEME_LIBRARY_PATH to point to the
357
`lib/mit-scheme/' subdirectory of the binary release directory,
358
for example, by typing something like one of the following:
361
export MITSCHEME_LIBRARY_PATH = \
362
"${MITSCHEME_BOOTSTRAP_DIR}/lib/mit-scheme"
364
setenv MITSCHEME_LIBRARY_PATH \
365
"${MITSCHEME_BOOTSTRAP_DIR}/lib/mit-scheme"
367
Please note that these bindings do not end in a `/' character.
369
This environment variable is _not_ merely for convenience: it
370
is a built-in environment variable that Scheme probes on entry.
371
It is how we tell the microcode where to find its companion
372
run-time bands and support files when they are not yet installed.
375
Last, you are now prepared to verify that this binary release
376
runs correctly on your system by typing the following at your
377
interactive shell prompt:
379
${MITSCHEME_EXECUTABLE} -no-init-file
381
The `-no-init-file' is to avoid incompatibility distractions in
382
case you have a "$HOME/.scheme.init" file for some other release.
384
[Footnote: Future releases may eventually require two leading
385
dashes (as `--no-init-file') but, for backward compatibility, one
386
dash is maximally compatible for now. Similarly throughout the
387
rest of this discussion, we will always show one-dash argument
388
``switches''. Use two-dash switches if this causes any obvious
389
problems here in the future.]
391
If you encounter an error message complaining about a library not
392
being found, you cannot use this binary ``microcode'' on your
393
system. You may try again with a different binary release or you
394
can embrace fate and resort to a ``cold'' build (see below).
396
Once loaded, try evaluating something trivial (like: 0 or #t
397
followed by carriage [RETURN] or [ENTER]) to verify that it has
398
loaded successfully and can evaluate constants.
400
Then try something like: (* 5 4 3 2 1) then maybe: (pp pp)
401
for laughs, and maybe: (gc-flip 0) for kicks. Finally, quit by
404
These simple tests verify, respectively, that the microcode can
405
load, that the microcode and the run-time band are compatible,
406
that the library path points to compiler-compatible debugging
407
info files--- in case anything goes wrong down stream, it helps
408
to see what--- and, finally, that the band's heap is stable.
410
If this generates an error about an incompatibility between the
411
microcode and runtime then double check your work above since the
412
microcode and runtime directories shipped in a binary release are
413
always compatible. One telltale of this problem is when Scheme
414
crashes with a segmentation fault (SIGSEGV) within the critical
415
section of the garbage collection daemon.
417
Assuming the above has all succeeded, you may now begin the warm
418
build process proper, which is only a slight generalization of
419
that described in the multi-stage build transition table earlier.
422
This concludes Step [1] (``Verify that the binary release runs.'').
424
Once it has been verified that the microcode runs and that the
425
run-time library is consistent with it, you are prepared to start the
426
CVS build's bootstrapping process. The adventure continues!
428
[2]. Run "./Setup.sh" from the CVS `src' dir using bootstrap binaries.
432
First, you must define a new shell environment variable used to
433
bootstrap the build process, since MIT/GNU Scheme uses a few
434
Scheme scripts and shell scripts during the `Setup.sh' and `make'
435
processes to lift itself up by its bootstraps. Specifically, you
439
export SCHEME_LARGE = \
440
"${MITSCHEME_EXECUTABLE} -large -no-init-file"
442
setenv SCHEME_LARGE \
443
"${MITSCHEME_EXECUTABLE} -large -no-init-file"
445
This tells the build scripts where the "scheme" executable file
446
lives and how to invoke it with a large heap size. If it is not
447
defined, the build scripts will use the first "scheme" found in
448
your shell execution path (shell variable PATH) instead.
450
Setting the SCHEME_LARGE environment variable gives us control
451
over which "scheme" to use without having to perturb the normal
452
PATH setting or, worse, squirreling things away early in your
453
normal PATH search sequence.
455
This new environment variable is used only by the build scripts:
456
please do not confuse it with the normal MIT/GNU Scheme built-in
457
environment variables named MITSCHEME_LARGE_(CONSTANT|HEAP|STACK)
458
which are run-time, not build-time, configuration parameters.
460
With this defined appropriately, invoking "./Setup.sh" should
461
succeed. Look carefully at the output it generates to verify
462
that it succeeded in generating the microcode Makefiles. I.e.,
463
the call to `generate-makefile' should not have yielded an error.
465
If this fails then the binaries you're using are not compatible
466
with the CVS sources you are trying to build. If you are using
467
the current stable binary release with the current CVS tree then
468
please send a bug report via the Project GNU bug tracking system
469
for MIT/GNU Scheme [ http://www.gnu.org/software/mit-scheme/ ] as
470
this might reflect an incompatibility in the development branch.
472
[3]. Run "./configure" from the CVS `src' directory.
474
This does not require a Scheme executable so it should always
475
succeed. If not, please send a bug report as described in the
478
[4]. Invoke "make" from the CVS `src' dir using newly built microcode.
482
Now you must define a small set of shell environment variables
483
used to bootstrap the Scheme run-time compilation process.
484
Specifically, you must define (while positioned within the CVS
488
export MITSCHEME_LIBRARY_PATH = \
489
"${MITSCHEME_BOOTSTRAP_DIR}/lib/mit-scheme"
491
export SCHEME_LARGE = \
492
"${PWD}/microcode/scheme -large -heap 4000 -no-init-file"
494
export SCHEME_COMPILER = \
495
"${PWD}/microcode/scheme -compiler -heap 4000 -no-init-file"
498
setenv MITSCHEME_LIBRARY_PATH \
499
"${MITSCHEME_BOOTSTRAP_DIR}/lib/mit-scheme"
501
setenv SCHEME_LARGE \
502
"${PWD}/microcode/scheme -large -heap 4000 -no-init-file"
504
setenv SCHEME_COMPILER \
505
"${PWD}/microcode/scheme -compiler -heap 4000 -no-init-file"
507
Please note that this uses the bootstrap binary run-time files
508
(as before) but with the newly generated microcode produced by
509
compiling the CVS sources in the `src/microcode/' directory _and_
510
with a Scheme heap size large enough to handle the entire build.
512
This works because the run-time bands do not depend on dynamic
513
system libraries (like `glibc') or other low-level bits and
514
pieces. Specifically, run-time bands must be compatible with
515
the underlying microcode versions atop which they run but the
516
run-time bands do not link directly into the microcode file (nor
517
vice versa) so they are functionally coupled but not bit-wise
518
coupled nor directly linked at the object code level. This is
519
the purpose of the "utabmd.bin" file in `lib/'.
521
Together, these tell the build scripts where the new CVS "scheme"
522
microcode file will be made, how to invoke it with a very large
523
heap size and/or with the native code compiler loaded (both with
524
sufficient heap space to compile the entire CVS `src/runtime/'
525
contents), and where to find compatible run-time and compiler
526
bands to use while compiling this new CVS run-time and again
527
while loading then dumping various pre-defined collections of
528
these newly compiled run-time files constituting the various
529
run-time ``bands'' built in the CVS `lib/' subdirectory.
531
Finally, please note that "make" will compile the entire run-time
532
library, compiler sources, and other auxiliary Scheme modules.
534
This takes a fairly long time and produces a copious amount of
535
output chatter. It may be wise, therefore, to copy its output
536
and error streams into a files that can be inspected afterward to
537
look for any non-fatal warnings or non-show-stopping errors that
538
may nonetheless be symptomatic of problems that might bite later.
539
Using your shell's output redirection compatibilities or piping
540
the output(s) through the unix `tee' utility should prove useful.
542
[5]. Cleaning up loose ends... and maybe installing your new build.
547
If you would now like to install this newly built MIT/GNU Scheme
548
as the system-wide default, type the following:
552
Afterward, before proceeding, take care to clean up the various
553
shell environment variables used during the directed build.
555
Depending on which interactive shell you use, do one of these
556
(but _only_ if you typed `make install' above):
559
unset MITSCHEME_BOOTSTRAP_DIR
560
unset MITSCHEME_MICROCODE_DIR
561
unset MITSCHEME_EXECUTABLE
562
unset MITSCHEME_LIBRARY_PATH
564
unset SCHEME_COMPILER
567
unsetenv MITSCHEME_BOOTSTRAP_DIR
568
unsetenv MITSCHEME_MICROCODE_DIR
569
unsetenv MITSCHEME_EXECUTABLE
570
unsetenv MITSCHEME_LIBRARY_PATH
571
unsetenv SCHEME_LARGE
572
unsetenv SCHEME_COMPILER
574
[5b]._________________
577
If, rather than installing the newly built MIT/GNU Scheme, you
578
prefer to use it in place (or somewhere else), be sure to adjust
579
the various environment variables accordingly.
581
In particular, take special care to snap MITSCHEME_LIBRARY_PATH
582
to point to your newly compiled library (with no trailing `/'):
585
export MITSCHEME_LIBRARY_PATH = "${PWD}/lib"
587
setenv MITSCHEME_LIBRARY_PATH "${PWD}/lib"
589
Note, however, that in order to invoke your new Scheme microcode,
590
your will have to use either its absolute pathname, a relative
591
path name relative to what working directory you are in when you
592
invoke it, or else invoke it as $SCHEME_LARGE or $SCHEME_COMPILER
593
(thereby continuing to use the environment variables established
594
to finish the build). You may also choose to install symbolic
595
links in your exec PATH to point it or other such shenanigans.
597
Good luck and happy hacking!
599
Building from source on unix systems - ``MIT/GNU Scheme Tabula Rasa''
600
====================================
602
Context: A ``binary'' release includes only: 1) a `bin/' directory
603
containing the MIT/GNU Scheme ``microcode'' executable(s),
604
and: 2) the `lib/mit-scheme/' directory containing the
605
MIT/GNU Scheme ``runtime'' bands, debugging info, and such
606
that correspond to that version of the companion microcode.
607
Binary releases do not contain source code files.
609
Fact: Although the ``runtime'' files are system-independent, the
610
microcode file(s) are linked against dynamic OS libraries.
611
This means that a binary microcode release may fail to run
612
on your specific machine if it has missing or incompatible
613
dynamic libraries installed (like, in `/usr/include/').
615
Question: What can you do when the "scheme" microcode from a binary
616
release cannot be run on your system, perhaps due to old
617
or missing or incompatible dynamic system libraries, etc.?
619
Answer: Build the (C-based) "scheme" microcode from the separately
620
distributed CPU+OS-specific source distribution. Afterward
621
you can use this new locally-built microcode in combination
622
with the corresponding binary release's run-time library.
624
Insight: The key trick idea is that any given version of the MIT/GNU
625
Scheme runtime library is built to run atop a corresponding
626
release of the MIT/GNU Scheme microcode but they are only
627
functionally coupled, not low-level bit-wise coupled at the
628
link layer or any such nightmare. This means you can brew
629
your own custom executable microcode specific to your CPU
630
and OS configuration from the ``ucode'' source distribution
631
and it will still work with the pre-compiled binary release
632
of the matching runtime library from the binary releases.
633
(By the way, this flexible linkage is accomplished courtesy
634
of the "utabmd.bin" file in `lib/'. Thank you, "utabmd"!)
636
Details: Following is a bit more context and detail followed by the
637
instructions for building just the MIT/GNU Scheme microcode
638
file(s) from sources, step by step. You may prefer to skip
639
directly to the enumerated step-by-step instructions if you
640
don't care about the gory details of what you're doing or
641
why. Ignorance = Bliss.
643
The following describes how to build a compatible microcode for the
644
binary release corresponding to the CVS sources. In order to be
645
explicit, it presumes that the target binary release is Release 7.7.1
646
on an Intel x86 compatible system running GNU/Linux. Adjust what
647
follows appropriately for other releases, CPUs and/or unix variants.
649
For example, one might reasonably prefer to bootstrap from the most
650
recent "snapshot" instead of the most recent "stable" release, in
651
which case one would replace `mit-scheme-7.7.1' below with something
652
like `mit-scheme-20060414' [http://www.gnu.org/software/mit-scheme/].
654
This also presumes that your goal is merely to build a given binary
655
release's microcode file(s) locally, not to install them system wide.
656
To that end, it does not contain the usual Step #6: make install
657
from the normal build state transition ritual.
659
The idea is to build the microcode corresponding to the target binary
660
release, doing so manually and separately from both the CVS tree and
661
the binary release tree. This task is accomplished by downloading,
662
unpacking and building the target microcode from (non-CVS) sources
663
then copying the resulting microcode into your unpacked binary release
664
directory structure, replacing the non-runnable microcode file(s) with
665
the manually built ones built specially for your system.
667
Once done, the resulting patched binary release directory can be used
668
as in a normal ``warm'' build from CVS sources. In other words, at
669
the end of the following action list, go to step [1] (not [0]) of the
670
``warm'' build instructions and proceed from there as usual.
674
``Cold'' build using non-matching binary and CVS source releases
675
----------------------------------------------------------------
677
[Adapted from: http://www.gnu.org/software/mit-scheme/other-unix.html]
679
1. Download the standard binary package for your release, CPU & unix
680
(e.g., mit-scheme-7.7.1-ix86-gnu-linux.tar.gz) and the sources
681
(e.g., mit-scheme-7.7.1-src-ucode.tar.gz). The _full_ sources
682
(e.g., mit-scheme-7.7.1-src.tar.gz) also works but that's overkill.
684
2. Unpack the source package and `cd' to it's `src/microcode/' subdir:
686
tar xzf mit-scheme-7.7.1-src-ucode.tar.gz
688
cd scheme-7.7.1/src/microcode/
690
3. Configure the microcode directory (from `src/microcode/'):
694
By having downloaded the microcode source distribution for a
695
specific MIT/GNU Scheme release, CPU and unix variant, we avoid the
696
need to run "src/Setup.sh" to go from the "CVS" build state to the
697
"distribution" build state. (Once fully built, our resulting local
698
microcode can then be used to advance the CVS source directory from
699
its unpacked "CVS" state to its "distribution" state in order to
700
proceed building the full MIT/GNU Scheme system. This buys us the
701
needed bootstrapping leverage to proceed where we might otherwise
702
have failed due to lack of a compatible binary microcode release.)
704
4. Compile the program (from `src/microcode/'):
708
Note that, being in the unpacked `src/microcode/' directory, only
709
the microcode is built, not any run-time or compiler or other
710
files, so not bootstrapping MIT/GNU Scheme is needed (yet). To
711
wit, those parts of the total CVS build that would have required a
712
bootstrapping MIT/GNU Scheme are sidestepped here since: 1) the
713
microcode table set up is anticipated in the release+CPU+unix-
714
specific source distribution, and: 2) the microcode-only "make"
715
invocation terminates without going on to try to compile any
716
run-time or other Scheme files. In short, building the microcode
717
entails only compiling C code, not mucking about with Scheme code.
719
5. Unpack the standard binary package (if you hadn't already done so
720
in the ``warm'' build step #0 above) and copy your newly built
721
microcode executables into it:
725
tar xzf mit-scheme-7.7.1-ix86-gnu-linux.tar.gz # If not already
727
cp -fp scheme-7.7.1/src/microcode/scheme bin/.
728
cp -fp scheme-7.7.1/src/microcode/bchscheme bin/.
730
Clobbering/replacing the copies of the binary release microcode
731
file(s) shouldn't disturb you since, presumably, the main reason
732
you resorted to a ``cold'' build in the first place is that the
733
normal binary release microcode wouldn't run anyway (or at least
734
wasn't as obsessively tuned to your exact system as you imagine
735
you'd like it to be).
737
Now proceed from step #1 (not #0) of the ``warm'' build instructions
738
above to finish building from the CVS sources.