FS#54563 - [cabal-install] hackage packages with custom Setup.hs cause linker failure

Attached to Project: Community Packages
Opened by José Manuel Calderón Trilla (jmct) - Friday, 23 June 2017, 21:56 GMT
Last edited by Doug Newgard (Scimmia) - Tuesday, 27 June 2017, 05:18 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To No-one
Architecture x86_64
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No

Details

Description:

This bug seems to only occur on the arch linux version of cabal install. I have confirmed that the same version
of cabal-install works on OS X.

Take for example trying to install the `entropy` package on a fresh install of arch:

```
$ cabal install entropy
Resolving dependencies...
Configuring entropy-0.3.8...
Failed to install entropy-0.3.8
Build log ( /home/vagrant/.cabal/logs/entropy-0.3.8.log ):
cabal: Entering directory '/tmp/cabal-tmp-24768/entropy-0.3.8'
cabal: Leaving directory '/tmp/cabal-tmp-24768/entropy-0.3.8'
cabal: Error: some packages failed to install:
entropy-0.3.8 failed during the configure step. The exception was:
user error ('/usr/bin/ghc' exited with an error:
/usr/bin/ld: cannot find -lHSCabal-1.24.2.0
/usr/bin/ld: cannot find -lHSprocess-1.4.3.0
/usr/bin/ld: cannot find -lHSpretty-1.1.3.3
/usr/bin/ld: cannot find -lHSdirectory-1.3.0.0
/usr/bin/ld: cannot find -lHSunix-2.7.2.1
/usr/bin/ld: cannot find -lHStime-1.6.0.1
/usr/bin/ld: cannot find -lHSfilepath-1.4.1.1
/usr/bin/ld: cannot find -lHSbinary-0.8.3.0
/usr/bin/ld: cannot find -lHScontainers-0.5.7.1
/usr/bin/ld: cannot find -lHSbytestring-0.10.8.1
/usr/bin/ld: cannot find -lHSdeepseq-1.4.2.0
/usr/bin/ld: cannot find -lHSarray-0.5.1.1
/usr/bin/ld: cannot find -lHSbase-4.9.1.0
/usr/bin/ld: cannot find -lHSinteger-gmp-1.0.0.1
/usr/bin/ld: cannot find -lHSghc-prim-0.5.0.0
/usr/bin/ld: cannot find -lHSrts_thr
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
)
```

Additional info:
* 1.24.0.2-1



Steps to reproduce:

Run try to install a package that uses a custom Setup.hs (two examples: entropy, cabal-install)
This task depends upon

Closed by  Doug Newgard (Scimmia)
Tuesday, 27 June 2017, 05:18 GMT
Reason for closing:  Not a bug
Additional comments about closing:  config issue
Comment by José Manuel Calderón Trilla (jmct) - Friday, 23 June 2017, 21:57 GMT
For some additional strangeness: It does not matter the way that I invoke cabal. If I run `cabal get entropy; cd entropy-0.3.8; cabal new-build` the error still occurs.
Comment by Phil Ruffwind (Rufflewind) - Sunday, 25 June 2017, 23:50 GMT
You don't even need to do anything fancy. Just compiling a simple .hs file fails:

$ echo 'main = pure ()' >test.hs
$ /usr/bin/ghc test.hs
[1 of 1] Compiling Main ( test.hs, test.o )
Linking test ...
/usr/bin/ld: cannot find -lHSbase-4.9.1.0
/usr/bin/ld: cannot find -lHSinteger-gmp-1.0.0.1
/usr/bin/ld: cannot find -lHSghc-prim-0.5.0.0
/usr/bin/ld: cannot find -lHSrts
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
Comment by Phil Ruffwind (Rufflewind) - Sunday, 25 June 2017, 23:59 GMT
I've filed a report under GHC: https://bugs.archlinux.org/task/54591

Edit 1:

Workaround: uncomment and add ghc-options: -dynamic to your ~/.cabal/config file.

Edit 2:

#54591 was closed as not-a-bug.

Edit 3:

Found another, more global workaround:

sed -i 's/pc_DYNAMIC_BY_DEFAULT = False/pc_DYNAMIC_BY_DEFAULT = True/' /usr/lib/ghc-8.0.2/platformConstants:

I think this change should be included in the 'ghc' package.
Comment by Hermann Zahnweh (eigengrau) - Monday, 26 June 2017, 13:30 GMT
I wonder if it’s currently possible to do any static builds at all. The boot lib issue can be resolved by installing ghc-static. However, this leaves the haskell-* packages, which also don’t ship with static libs. Now, when trying a static build within a Cabal sandbox, Cabal won’t install any dependencies already registered in the global package database; subsequently, static linking will fail because, while the packages are registered, they’re missing static components.

One can force Cabal/GHC to ignore the global package database, but afaict this won’t help, since this will ignore boot libraries too.

Loading...