The `--ghc-options` for `stack build` were not recognized correctly.
Closed this issue · 1 comments
shin-sakata commented
As shown in the README, if i include the ghc-options in stack.yaml
, i can add It seems to work correctly. It's great, thank you!
stack.yaml
# ....
executables:
example-exe:
main: Main.hs
source-dirs: app
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -static -optl-static -optl-pthread -fPIC # <- HERE!!
dependencies:
- exemple
# ....
build command
$ stack build
But I don't write it in stack.yaml, but rather stack build
If I write GHC-OPTIONS as an argument to the command, it won't work correctly.
stack.yaml
# ....
executables:
example-exe:
main: Main.hs
source-dirs: app
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
# <-DELETE!!!!!
dependencies:
- exemple
# ....
build command
$ stack build --ghc-options="-optl-static -optl-pthread -fPIC"
error
......
/nix/store/xsnq7bhmdhmq096g66z0j50hvj9k2yjx-binutils-2.31.1/bin/ld: /nix/store/j7bg5wq89p3my7shxswkb99sy9hfz11m-ghc-8.8.3/lib/ghc-8.8.3/ghc-prim-0.5.3/libHSghc-prim-0.5.3.a(popcnt.o): relocation R_X86_64_32S against `.rodata.popcount_tab' can not be used when making a shared object; recompile with -fPIC
/nix/store/xsnq7bhmdhmq096g66z0j50hvj9k2yjx-binutils-2.31.1/bin/ld: /nix/store/9qq6y9fm4xj9arxy6izkfs8rkd4xhwyp-gcc-9.3.0/lib/gcc/x86_64-unknown-linux-musl/9.3.0/crtend.o: relocation R_X86_64_32 against `.ctors' can not be used when making a shared object; recompile with -fPIC
/nix/store/xsnq7bhmdhmq096g66z0j50hvj9k2yjx-binutils-2.31.1/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)
-- While building package example-0.1.0.0 using:
/Users/shin/.stack/setup-exe-cache/x86_64-linux-dk85569e7f830e7dc606115fd702e078fb/Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.3 --builddir=.stack-work/dist/x86_64-linux-dk85569e7f830e7dc606115fd702e078fb/Cabal-3.0.1.0 build lib:example exe:exampler-exe --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
make: *** [build] Error 1
I suspect that ghcoptions is not passed correctly.
My workflow would be great if I could pass in arguments, but is this error a specification?
utdemir commented
Hey @shin-sakata , thank you for the report and sorry for not responding to this earlier. Have you found a solution for your problem? If so, can you also share it here in case other people have the same issue too?