guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Removing compilers that cannot be bootstrapped


From: Ricardo Wurmus
Subject: Re: Removing compilers that cannot be bootstrapped
Date: Sat, 26 Mar 2016 09:12:52 +0100
User-agent: mu4e 0.9.13; emacs 24.5.1

Chris Marusich <address@hidden> writes:

> Leo Famulari <address@hidden> writes:
>
>> `wget https://blob` doesn't count as reproducible :)
>
> Very true.
>
> Self-hosting compilers are a cute trick, but they're a far cry from
> being reproducible.  They're just inscrutable binary blobs.  If we want
> true reproducibility from the bottom up, then it seems like the only way
> to do it is via a strategy like the following:
>
> 1) Write the simplest possible program (or collection of programs) in
> the simplest possible machine code.  This program serves only one
> purpose: to enable you to write more code at a higher level of
> abstraction.  It is effectively a compiler for a very primitive
> language, but the language it compiles will be one layer of abstraction
> above machine code, which is a step in the right direction.  This first
> program must be a "binary blob", since we cannot rely on any existing
> tools to build it.  It must be simple enough that someone can read and
> understand it using e.g. a hex editor, provided that they have access to
> the right reference materials.  Since this program exists only as
> machine code, it must be documented thoroughly to make it easier to
> understand.
>
> 2) Write source code which, when compiled using the compiler/toolchain
> From the previous step, produces a new compiler/toolchain that will
> allow you to write more expressive source code at a higher layer of
> abstraction.
>
> 3) Repeat step (2) as many times as necessary to produce a compiler that
> is capable of compiling GCC from source.
>
> 4) Use the compiler from (3) to compile GCC from source.
>
> 5) Use the GCC from (4) to compile the rest of the world from source.
>
> If we want to free ourselves from reliance on inscrutable binary blobs,
> isn't something like that the only way?

GCC itself is not sufficient to build many compilers.  For GHC, for
example, you need a Haskell compiler such as GHC.  I looked at nhc98 and
other defunct Haskell compilers, but they all have a bootstrapping step
that either requires a Haskell compiler or building from generated C
sources.

In the case of Haskell I think it would make sense to try to figure out
how to bootstrap with Hugs, a Haskell interpreter, or with Yale Haskell,
which I’m trying to port to Guile.

It is probably easier for us to try to write primitive compilers in
Guile than to start from scratch each time.  Then the only blob we need
to figure out how to bootstrap would be Guile itself.

~~ Ricardo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]