0
votes

I'm trying to compile haskell ghc from source. I try to configure my cabal config from different folder than /usr/. From the start it always succeed in building any package.

At some point (after installing package cabal-install), I change my config for cabal to include another "library-dirs". Then, something wrong happens (probably because wrong string to be inserted in field "library-dirs" in cabal config). So, I try to reconfigure my cabal config file again (I even delete the config file and try to clean the ghc package cache) and comment field "library-dirs" options but it still fails. I also already tried to remove the cabal package directory (a directory where cabal save the cache about the packages).

This is the output when using "ghc-pkg check" :

Warning: library-dirs: {stripped} doesn't exist or isn't a directory

This is the output right now when I building package using cabal or manually from Setup.hs :

sudo -E  cabal --config-file=/opt/haskell/config/config install hashable -O2  --global --flags="-fllvm" --prefix=/opt/haskell 2>error --upgrade-dependencies --reinstall
Resolving dependencies...
Configuring hashable-1.2.1.0...
Building hashable-1.2.1.0...
Failed to install hashable-1.2.1.0
Last 10 lines of the build log ( /{stripped}/hashable-1.2.1.0.log ):

Data/Hashable/Class.hs:100:15: Warning:
    Literal 15868100553162883236 is out of the Int range -9223372036854775808..9223372036854775807
[2 of 3] Compiling Data.Hashable.Generic ( Data/Hashable/Generic.hs, dist/build/Data/Hashable/Generic.o )

Data/Hashable/Generic.hs:20:1: Warning:
    The import of ‛Bits’ from module ‛Data.Bits’ is redundant
[3 of 3] Compiling Data.Hashable    ( Data/Hashable.hs, dist/build/Data/Hashable.o )
/usr/bin/ld: cannot find  {stripped}: No such file or directory
collect2: error: ld returned 1 exit status

This is the cabal config file : (any default values are stripped)

remote-repo: hackage.haskell.org:http://hackage.haskell.org/packages/archive
remote-repo-cache: /opt/haskell/cabal
world-file: /opt/haskell/cabal/world
extra-prog-path: /opt/haskell/cabal/bin
build-summary: /opt/haskell/cabal/logs/build.log
remote-build-reporting: anonymous
jobs: $ncpus

install-dirs global
  prefix: /opt/haskell/

Can anybody help me or guide me ? Or at least tell me where ghc are actually save the information of "library-dirs" configuration for an uninstalled package ?

cabal -V
cabal-install version 1.18.0.2
using version 1.18.1.3 of the Cabal library 

ghc -v
The Glorious Glasgow Haskell Compilation System, version 7.9.20140206

Thank you.

1

1 Answers

0
votes

I believe this might be due to the fact that each package contains the full path to the location when it was first created. Look into. .ghc/YOUR_PLATFORM/package.conf.d(for me, it's .ghc/x86_64-darwin-7.6.3/package.conf.d). You'll see a lot of .conf files, and each will contain hardcoded paths:

[...]
import-dirs: /Users/pejvan/Library/Haskell/ghc-7.6.3/lib/pandoc-types-1.12.3.3/lib
library-dirs: /Users/pejvan/Library/Haskell/ghc-7.6.3/lib/pandoc-types-1.12.3.3/lib
[...]
haddock-interfaces: /Users/pejvan/Library/Haskell/ghc-7.6.3/lib/pandoc-types-1.12.3.3/doc/html/pandoc-types.haddock
haddock-html: /Users/pejvan/Library/Haskell/ghc-7.6.3/lib/pandoc-types-1.12.3.3/doc/html

You can either manually update the files for the contents to point to the right location or write a script which would do it for you.

Then you need to update the package.cache files (might require a sudo here and there):

pejvan$ ghc-pkg recache

pejvan$ ghc-pkg recache --user

Finally, check that everything is now fine: pejvan$ ghc-pkg check