Ticket #633 (new defect)

Opened 3 years ago

Last modified 17 months ago

Cabal-1.8.0.2 fails to build packages for hugs: --inplace is not supported with Hugs

Reported by: nomeata Owned by:
Priority: normal Milestone:
Component: Cabal library Version: 1.6.0.1
Severity: normal Keywords:
Cc: debian-haskell@… Difficulty: normal
GHC Version: Platform:

Description

For the Debian packages, we use Cabal to build packages for ghc6 and for hugs. Unfortunately, with Cabal-1.8, the hugs support is broken:

debian/hlibrary.setup configure --hugs --prefix=/usr -v2 --builddir=dist-hugs 
Configuring binary-0.5.0.2...
Flags chosen: applicative-in-base=True, split-base=True,
bytestring-in-base=True
Dependency array -any: using array
Dependency base >1 && <1: using base
Dependency containers -any: using containers
Using Cabal-1.8.0.2 compiled by ghc-6.12
Using compiler: hugs
Using install prefix: /usr
Binaries installed in: /usr/bin
Libraries installed in: /usr/lib/hugs/packages/binary
Private binaries installed in: /usr/libexec
Data files installed in: /usr/share/binary-0.5.0.2
Documentation installed in: /usr/share/doc/binary-0.5.0.2
No alex found
Using ar found on system at: /usr/bin/ar
No c2hs found
Using cpphs version 1.9 found on system at: /usr/bin/cpphs
Using ffihugs found on system at: /usr/bin/ffihugs
Using gcc version 4.4.3 found on system at: /usr/bin/gcc
Using ghc version 6.12.1 found on system at: /usr/bin/ghc
Using ghc-pkg version 6.12.1 found on system at: /usr/bin/ghc-pkg
No greencard found
Using haddock version 2.6.0 found on system at: /usr/bin/haddock
No happy found
No hmake found
Using hsc2hs version 0.67 found on system at: /usr/bin/hsc2hs
Using hscolour version 1.15 found on system at: /usr/bin/HsColour
Using hugs found on system at: /usr/bin/hugs
No jhc found
Using ld found on system at: /usr/bin/ld
No lhc found
No lhc-pkg found
No nhc98 found
No pkg-config found
Using ranlib found on system at: /usr/bin/ranlib
Using strip found on system at: /usr/bin/strip
Using tar found on system at: /bin/tar
debian/hlibrary.setup build --builddir=dist-hugs
Preprocessing library binary-0.5.0.2...
Building binary-0.5.0.2...
Registering binary-0.5.0.2...
hlibrary.setup: --inplace is not supported with Hugs

The reason seems to be the build function in ./Distribution/Simple/Build.hs:

build pkg_descr lbi flags suffixes = do
  let distPref  = fromFlag (buildDistPref flags)
      verbosity = fromFlag (buildVerbosity flags)
  initialBuildSteps distPref pkg_descr lbi verbosity suffixes
  setupMessage verbosity "Building" (packageId pkg_descr)

  internalPackageDB <- createInternalPackageDB distPref

  withLibLBI pkg_descr lbi $ \lib clbi -> do
    info verbosity "Building library..."
    buildLib verbosity pkg_descr lbi lib clbi

    installedPkgInfo <- generateRegistrationInfo verbosity pkg_descr lib
                               lbi clbi True{-inplace-} distPref

    -- Register the library in-place, so exes can depend
    -- on internally defined libraries.
    registerPackage verbosity
      installedPkgInfo pkg_descr lbi True{-inplace-} internalPackageDB

  -- Use the internal package db for the exes.
  let lbi' = lbi { withPackageDB = withPackageDB lbi ++ [internalPackageDB] }

  withExeLBI pkg_descr lbi' $ \exe clbi -> do
    info verbosity $ "Building executable " ++ exeName exe ++ "..."
    buildExe verbosity pkg_descr lbi' exe clbi

Here, the inplace flag is unconditionally set to true. But in ./Distribution/Simple/Register.hs, we have

registerPackageHugs verbosity installedPkgInfo pkg lbi inplace _packageDb = do
  when inplace $ die "--inplace is not supported with Hugs"
  let installDirs = absoluteInstallDirs pkg lbi NoCopyDest
  createDirectoryIfMissingVerbose verbosity True (libdir installDirs)
  writeUTF8File (libdir installDirs </> "package.conf")
                (showInstalledPackageInfo installedPkgInfo)

I’d be grateful for a quick work-around or patch, as this is holding up the transition to ghc 6.12 in Debian.

Change History

Changed 3 years ago by nomeata

The code was last touched by this patch. Simon, did you test your code WRT building with Hugs?

Wed Aug 26 17:51:57 CEST 2009 Simon Marlow <marlowsd@…>

  • Add the ABI hash to the InstalledPackageId? for inplace registrations too Previously, we just added a -inplace suffix, but this will cause problems when developing multiple packages inplace, and then installing them.

Also, there was a round of refactoring: registerPackage now takes the InstalledPackageId? as an argument, and generateRegistrationInfo is exposed for constructing it. This means that callers of registerPackage get to munge the InstalledPackageInfo? before it is registered.

Changed 3 years ago by duncan

  • difficulty changed from unknown to normal

Two solutions, one is to only register inplace when neessary and better to make inplace registration for hugs do something sensible. It's needed in the case of packages with internal dependencies.

Changed 17 months ago by elga

Note: See TracTickets for help on using tickets.