Question about binary distributions

Ben Gamari ben at well-typed.com
Fri Aug 7 15:15:11 UTC 2020


"Mathieu Boespflug" <m at tweag.io> writes:

> Hi all,
>
> GHC currently has 3 tier-1 platforms: Linux, macOS and Windows. I'll
> focus the dicussion below on these three platforms. The binary
> distributions for Linux and macOS are designed to be unpacked, then
> the user types ./configure && make install. This is not the case for
> Windows.
>
> On all platforms it's possible to create "relocatable" installations,
> such that GHC doesn't really care where it's installed, and commands
> will still work if the install directory changes location on the
> filesystem. So my question is, why do we have a ./configure step on
> Linux and macOS? Why could we not have bindists for all platforms that
> work like the Windows one? I.e. a binary distribution that you just
> unpack, in any directory of your choice, without any configuration or
> installation step.

There are a few reasons:

 * Relocatable GHC builds have only been supported for only a few
   releases now and only under the Hadrian build system, which is not
   currently used to produce our binary distributions (hopefully this
   will change for 9.2).

 * On Windows we have the luxury of having a very well-controlled
   environment as we rely on essentially nothing from the host
   system. We provide our own mingw toolchain, statically link
   against libc, and have no additional dynamic dependencies.

   By contrast, on Linux we have to deal with a much larger
   configuration space:

    * several linkers, each with their own bugs

    * several C compilers, supporting various subsets of functionality
      and quirks (e.g. some distributions enable -pie by default, others
      do not)

    * various LLVM packaging schemes

   Since it would be quite expensive to probe the toolchain
   characteristics on every compiler invocation, we rather do this once
   in the configure script during bindist installation and package the
   result in the installed `settings` file.

 * On Linux we may have additional dynamic dependencies (e.g. libdw,
   numactl) which we check for during configuration time, lest the user
   be faced with an unsightly linker error if they happen to be missing
   a library.

In principle we could perhaps avoid the need for many of these checks
by creating one binary distribution per operating system distribution.
However, we will first need to move to Hadrian to build our binary
distributions.

Cheers,

- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20200807/d8524ffe/attachment.sig>


More information about the ghc-devs mailing list