[Haskell-cafe] Cabal lib (Setup.hs), --package-db, --enable-shared,
haskell platform
Albert Y.C.Lai
trebla at vex.net
Sat Jul 17 15:30:16 EDT 2010
I accidentally found a rarely encountered omission in Cabal (the lib, because
via Setup.hs) by building Haskell Platform as shared libs from source.
It is rare because you have to use both --enabled-shared and
--package-db=blah together to run into it. --package-db=blah is already rare
enough (probably only Haskell Platform's build script uses it); --enable-shared
is my addition to make it even rarer.
(Also I have only tried this on linux x86 32-bit.)
Following the essence of scripts/build.sh plus my own --enable-shared:
Create an empty lookaside package database with:
echo '[]' > /tmp/lookaside
Install a package X that depends only on base (say), ask for shared libs,
register in /tmp/lookaside only:
./Setup configure --package-db=/tmp/lookaside \
--ghc-pkg-option=--package-conf=/tmp/lookaside \
--enable-shared
./Setup build
./Setup register --inplace
Install another package Y that depends on base and X only (say), ask for shared
libs. There is a problem now related to X known to /tmp/lookaside only, but not
known to the global or the user database:
./Setup configure --package-db=/tmp/lookaside \
--ghc-pkg-option=--package-conf=/tmp/lookaside \
--enable-shared
./Setup build -v2
Now it bombs. As the verbose build messages show, there is no problem creating
the static *.a version; it bombs when creating the shared *.so version, and it
is because it can't find X, and it is because -package-conf=/tmp/lookaside is
not given to ghc at the *.so stage. (Though, the *.dyn_o stage works correctly.)
My current fix is:
./Setup configure --package-db=/tmp/lookaside \
--ghc-pkg-option=--package-conf=/tmp/lookaside \
--ghc-option=-package-conf=/tmp/lookaside \
--enable-shared
I surely hope we no longer need --ghc-pkg-option and --ghc-option in a week! :)
More information about the Haskell-Cafe
mailing list