Building and installing packages
Mon, 30 Apr 2001 16:47:05 +0100
This is a multi-part message in MIME format.
> Currently the fptools build system is a little bit inflexible in its
> handling of packages. There are at least the following problems:
> 1) It's too monolithic, e.g. fptools/ghc/driver/PackageSrc.hs must
> know about *all* packages in fptools/hslibs. Things get even
> trickier when e.g. I want to split up my OpenGL package into a
> package "OpenGL", containing the GL core, and a package "GLUT"
> containing a simple toolkit, *which needs package "OpenGL"*.
> Centralized knowledge about dependencies might be OK=20
> for standard
> libs, but not for a library like this. A situation like=20
> this will
> (hopefully!) become more common, given the lively discussions on
> the library list.
Agreed, and fixing this has been pending for a long time (you may
remember we discussed this a while back - see the attached message).
But looking at the larger picture, the problem is particularly hairy
because of the requirement to separate build and install-time. One
approach is to say "ok, everything we depend on must be identical
between the build machine and the target machine", which works for
systems with a package manager because we can enumerate the dependencies
When we're not using a package manager, the only reasonable approach is
not to have any dependencies at all: which is why we ship with a static
libgmp.a in a binary distribution, and for 5.00.1 we're also going to
ship binary dists without readline support in GHCi (this won't affect
RPMs, of course).
These two approaches I can get my head around. However, you're talking
about something in between: allowing certain dependencies to change or
move around between build time and install time. If we're going to
allow this (and I'm not convinced we should), then we need to be
extremely careful and document exactly what's allowed to change.
> 2) "ghc-pkg -l"'s output is plainly wrong: I don't have a package
> win32 or com installed on my Linux box, although=20
> ghc-pkg tells me
Yup, I'll fix this.
> 3) Is the comma-separated output a good thing? Re-using it in
> e.g. shell scripts would be much easier if it was a=20
> single package
> name per line.
I'll change it as you suggest, if there are no objections?
> 4) Why is the gmp package not "inlined" into the rts package?
No particular reason, it just seemed cleaner that way.
> 5) The distinction between the compile-time and runtime environment
> is blurred, e.g. for a given (C) library there could be=20
> library names and paths on the box where hslibs are=20
> built and the
> box where GHC/hslibs is installed later. Some packages=20
> will surely
> need help from autoconf at install time.
> 6) What has become of the plans to make relocateable RPMs=20
> It's a quite important feature, esp. when there is the=20
> need for a
> multi-stage bootstrap.
It's certainly possible, but I'm no RPM expert. Check out the way we
build binary distributions: we ship a copy of pkgconf (the compiled
PackageSrc.hs) in the tarball, and run it to generate a package.conf at
> To remedy this situation, PackageSrc should be nuked=20
> completely and the
> following steps should be done for *each* package:
> 1) Determine things needed for compilation like #include=20
> paths, names
> of #include files, etc. Although I don't have an example yet,
> this might involve help from autoconf. Most dependencies,
> e.g. other packages, are probably static, but one never knows...
> 2) Use the information from step 1 to build the package.=20
> This step is
> of course absent during installation where we already have a
> compiled package.
> 3) Determine things needed for installation like paths and names of
> libraries needed for linking with the current package. This
> definitely needs help from autoconf (e.g.: Where are=20
> the X11 libs
> located? Should we link with libMesa or libGL? ...)
> 4) Use the information from step 1 and 3 to add the package to the
> given GHC (inplace or "real" one).
Ok, I'm agreed that we definitely need to nuke PackageSrc.hs and have
each package register itself. However, I'm still uneasy about
separating (1) and (3). Let's take your examples: if the X11 libs move,
that shouldn't be a problem, as long as they're still for the same
version of X11. libMesa and libGL are a special case: presumably these
are designed so that if you compile against one, you can link to the
other one. But that's certainly not true for most shared libraries -
our recent experiences with glibc show that even a minor version bump
can cause problems.
X-MimeOLE: Produced By Microsoft Exchange V6.0.4688.0
Received: from mail2.microsoft.com (INET-VRS-02 [126.96.36.199]) by 157.microsoft.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2651.58) id P26H7P67; Mon, 21 Aug 2000 04:23:01 -0700
Received: from 188.8.131.52 by mail2.microsoft.com (InterScan E-Mail VirusWall NT); Mon, 21 Aug 2000 04:22:58 -0700 (Pacific Daylight Time)
Received: by www.haskell.org (Postfix) id 3396E101E; Mon, 21 Aug 2000 07:22:57 -0400 (EDT)
Subject: RE: Package trouble
Date: Mon, 21 Aug 2000 11:45:11 +0100
Thread-Topic: Package trouble
From: "Simon Marlow" <email@example.com>
To: "Sven Panne" <Sven.Panne@informatik.uni-muenchen.de>,
> I've just started adding my HOpenGL stuff into hslibs and immediately
> stumbled over some rather technical details in the driver and the
> package system:
> * The User's Guide talks about a GHC version number as the second
> element of a packages configuration triple, but the driver only
> expects a pair without it. I'm not sure if either the=20
> docs or the=20
> driver should be fixed.
I originally intended to add this, and then wondered whether it was
a good idea or not. You currently can't use a library built by a
version of the compiler, because the .hi file versioning stops you. I
suppose the currently system allows you to install a bogus package (i.e.
that you can't use), but the version number in the package config would
pretty weak safety net.
Unless anyone argues strongly in favour of having a version number in
package config, I'll update the documentation to remove it.
> * checkConfigAccess in the driver is a nice idea, but totally
> useless in *nix reality due to the completely underspecified
> permission handling in module Directory. Checking if the owner
> has write access is not the right thing to do, as package.conf is
> hopefully not owned by a mere mortal (i.e. user).
I don't understand this comment: surely checking for write access to the
package config file is the right thing to do? If the config file is
by root, then you need to be root to overwrite it. If on your Win2k
you are one of the list of users in the ACL allowed to update the
config, then checking for write access will tell you that.
> Whoever reads
> this: Please nuke this poor permission handling interface from
> Directory for Haskell-2! It's not the least common denominator of
> file systems, it's simply underspecified and confusing. Modern
> OSes have different categories of users, ACLs, etc. Simply
> ignoring this fact doesn't help here.
> * HOpenGL will be split into 2 packages: `OpenGL' and `GLUT', with
> the latter depending on the former, but currently the build
> system seems unable to handle this in any other way than
> hardwiring this into a large set of known packages. This=20
> can't be=20
> done for OpenGL/GLUT, see next item
Ok, there's currently a gaping hole in the package support - namely how
installation works. =20
For a binary distribtuion, the paths in the package configuration need
adjusted depending on where the packages are actually installed. The
correct way to do this would seem to be
- install the basic compiler tools and package libraries
- autoconf to generate the individual package configs
for each package from templates,
- ghc --add-package for each of the packages.
For an RPM which has paths hardcoded in, the second step can be omitted.
For "make install", we begin with an empty package configuration and
package in hslibs should do its own "ghc --add-package".
For building the package config for ghc-inplace, perhaps this can be
"make boot" time.
The basic idea is to remove all the hslibs from PackageSrc.hs (leaving
the rts, gmp, and std packages), with each hslib registering itself at
certain points in the compilation cycle. How does that sound?
> * I vaguely remember a discussion about when and how to do package
> configuration for Manuel's GTK stuff, but forgot the details. The
> story for HOpenGL is as follows: The correct include paths for
> compilation and libs for linking could be detected by some
> autoconf magic, but doing this before the package's compilation
> is not enough/wrong: Due to inlining, the include paths on the
> system where the packages are *installed* are needed, too, and
> knowing how to link OpenGL apps on the building system is
> completely wrong. OK, now there's an official OpenGL ABI effort,
> but I don't want to depend on that, and future packages=20
> will have=20
> similar problems. How should we handle this? Distribute=20
> scripts with packages, which write the package configuration
> files? Currently I can't see another way. :-(
Yes, that seems to be the only way to do it.