relocatable packages: GHC_PACKAGE_PATH and package.conf

Tim Cuthbertson tim at gfxmonk.net
Mon May 28 14:36:52 CEST 2012


Hi all,

I'm trying to build a relocatable package using cabal, and running
into some difficulties.
I've created / used the following script to attempt to create a
relocatable package:
https://github.com/gfxmonk/0compile-cabal-build/blob/2cf4a08b146333d9292f6f8fd38431dd5c5c80f1/cabal-build


When this is done I have something that looks like it should work, and
has an inline package.conf. But when I run the following:

-----------------------------------------------
$ export GHC_PACKAGE_PATH="/home/tim/dev/haskell/third-party/haskell-ansi-terminal/haskell-ansi-terminal-linux-x86_64/package.conf:"
$ ghc-pkg check
There are problems in package ansi-terminal-0.5.5:
 import-dirs: ${pkgroot}/lib is a relative path
 library-dirs: ${pkgroot}/lib is a relative path
 file System/Console/ANSI.hi is missing
 file System/Console/ANSI/Unix.hi is missing
 file System/Console/ANSI/Common.hi is missing
 cannot find libHSansi-terminal-0.5.5.a on library path

The following packages are broken, either because they have a problem
listed above, or because they depend on a broken package.
ansi-terminal-0.5.5
-----------------------------------------------

So it looks like:
 - I need to set more environment variabes so that ghc can find the
parts of the package (e.g libHSansi-terminal-0.5.5.a). Unfortunately,
I don't know what "library path" refers to in the above message (I
tried $LD_LIBRARY_PATH and $LIB_PATH to no avail).
 - ghc doesn't seem to support ${pkgroot} prefixes. I thought it did,
but I'm new to this so I may be misunderstanding where they can be
used.

Can anyone suggest what I might need to fix (either in the
package.conf or in my environment variables) to get this working?

I've uploaded my package.conf here, apologies for the lack of formatting:
https://gist.github.com/59a0d3e69751c3932579



Additionally, the paths that come out of cabal build have the compiler
name and version hard coded, e.g lib/packagename/ghc-7.0.4/*. Is there
any way to configure how this path is constructed to get rid of the
ghd-7.0.4 part?

If I need to add $DISTDIR/ansi-terminal-0.5.5/ghc-7.0.4/ to a library
path, it would be much easier to declare that if it didn't depend on
the version of GHC used. Assume that since I'm building a standalone
package, there is no problem with collisions (packages for other
versions of GHC or other compilers would have a different $PREFIX).

I'd really like to get relocatable packages working, so any help or
guidance would be appreciated.

Cheers,
 - Tim.



More information about the Glasgow-haskell-users mailing list