commercialhaskell / commercialhaskell/stack

-fPIC errors with --profile on Arch Linux

Open
#3,877 5 comments 0 reactions 0 assignees View on GitHub
component: arch-linux
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

### General summary/comments (optional)

This is likely related to #3518 and #3409 etc. But while users seem to have resolved those issues for GHC 8.2.2 and up, I see the same (or a similar) issue when using the --profile flag. Building without --profile works fine.

### Steps to reproduce

`stack build --profile --system-ghc` (with Arch `ghc-static` package)
or
`stack build --profile`

### Expected

The project should build without errors and with profiling data.

### Actual

Linking fails with thousands of errors like these:
```
$ stack build --profile --system-ghc

> Linking .stack-work/dist/x86_64-linux/Cabal-2.0.1.0/build/voyhask-ffi/libvoyhask-ffi.so.4 ...
> /usr/bin/ld.gold: error: .stack-work/dist/x86_64-linux/Cabal-2.0.1.0/build/voyhask-ffi/voyhask-ffi-tmp/DateUtil.p_o: requires dynamic R_X86_64_PC32 reloc against 'stg_ap_p_fast' which may overflow at runtime; recompile with -fPIC
> /usr/bin/ld.gold: error: .stack-work/dist/x86_64-linux/Cabal-2.0.1.0/build/voyhask-ffi/voyhask-ffi-tmp/LazyBear/Class.p_o: requires dynamic R_X86_64_PC32 reloc against 'stg_ap_0_fast' which may overflow at runtime; recompile with -fPIC
> /usr/bin/ld.gold: error: .stack-work/dist/x86_64-linux/Cabal-2.0.1.0/build/voyhask-ffi/voyhask-ffi-tmp/LazyBear/Series.p_o: requires dynamic R_X86_64_PC32 reloc against 'stg_sel_1_upd_info' which may overflow at runtime; recompile with -fPIC
> /usr/bin/ld.gold: error: .stack-work/dist/x86_64-linux/Cabal-2.0.1.0/build/voyhask-ffi/voyhask-ffi-tmp/LazyBear/DynamicFrame.p_o: requires dynamic R_X86_64_PC32 reloc against 'stg_sel_1_upd_info' which may overflow at runtime; recompile with -fPIC
> /usr/bin/ld.gold: error: .stack-work/dist/x86_64-linux/Cabal-2.0.1.0/build/voyhask-ffi/voyhask-ffi-tmp/Voyager/Common.p_o: requires dynamic R_X86_64_PC32 reloc against 'stg_ap_p_fast' which may overflow at runtime; recompile with -fPIC
> ...
> /usr/bin/ld.gold: error: /usr/lib/ghc-8.2.2/base-4.10.1.0/libHSbase-4.10.1.0_p.a(Semigroup.p_o): requires unsupported dynamic reloc 11; recompile with -fPIC
> /usr/bin/ld.gold: error: /usr/lib/ghc-8.2.2/base-4.10.1.0/libHSbase-4.10.1.0_p.a(Semigroup.p_o): requires unsupported dynamic reloc 11; recompile with -fPIC
> /usr/bin/ld.gold: error: /usr/lib/ghc-8.2.2/base-4.10.1.0/libHSbase-4.10.1.0_p.a(Semigroup.p_o): requires unsupported dynamic reloc 11; recompile with -fPIC
> /usr/bin/ld.gold: error: /usr/lib/ghc-8.2.2/base-4.10.1.0/libHSbase-4.10.1.0_p.a(Semigroup.p_o): requires unsupported dynamic reloc 11; recompile with -fPIC
>
```

### Stack version

I have tried both 1.6.3 and the latest git master.

```
$ stack --version
Version 1.7.0, Git revision cd7ed8f44ea0ac0809ebc9125a05b0b7273765e9 (5683 commits) x86_64 hpack-0.21.2
```

### Method of installation

I have tried:
- The official binaries
- The main Arch repository -- the `stack` and `stack-bin` packages

I have also tried various builds of GHC 8.2.2 (stack installed builds with ghc-build and tinfo6; as well as the `ghc` and `ghc-static` builds from the Arch packages). All exhibit this problem.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.