commercialhaskell / commercialhaskell/stack

stack build --profile linker errors with -debug

Open
#4,970 6 comments 0 reactions 0 assignees View on GitHub
component: build component: profiling further investigation required type: bug
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

### Steps to reproduce
1. stack new
2. add -debug to ghc options executable
3. stack build --profile

[stackerr.zip](https://github.com/commercialhaskell/stack/files/3414011/stackerr.zip)

### Expected

Build success or an error message stating that --profile & -debug are incompatible

### Actual

Linker error starts with
```/usr/bin/ld.gold: error: cannot find -lHSrts_thr_debug_p```

```
-*- mode: compilation; default-directory: "~/stack_err/stackerr/" -*-
Compilation started at Sat Jul 20 22:29:29

stack build --profile
Building all executables for `stackerr' once. After a successful build of all of them, only specified executables will be rebuilt.
stackerr> configure (lib + exe)
Configuring stackerr-0.1.0.0...
stackerr> build (lib + exe)
Preprocessing library for stackerr-0.1.0.0..
Building library for stackerr-0.1.0.0..
[1 of 2] Compiling Lib
[2 of 2] Compiling Paths_stackerr
[1 of 2] Compiling Lib
[2 of 2] Compiling Paths_stackerr
Preprocessing executable 'stackerr-exe' for stackerr-0.1.0.0..
Building executable 'stackerr-exe' for stackerr-0.1.0.0..
[1 of 2] Compiling Main
[2 of 2] Compiling Paths_stackerr
Linking .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/stackerr-exe/stackerr-exe ...
/usr/bin/ld.gold: error: cannot find -lHSrts_thr_debug_p
.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/stackerr-exe/stackerr-exe-tmp/Main.p_o:ghc_5.c:Main_main_info: error: undefined reference to 'era'
.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/stackerr-exe/stackerr-exe-tmp/Main.p_o:ghc_5.c:Main_main_info: error: undefined reference to 'era'
```
Followed by many pages of linker errors

### Stack version

andrew@zarpedon:~/stack_err/stackerr$ stack --version
Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2

### Method of installation
* stack upgrade (from official original install)

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.