【发布时间】:2021-03-08 19:58:53
【问题描述】:
我在多个项目中使用stack,我需要有两种方法来编译它们,一种用于日常开发的“普通”,另一种用于部署。
我使用hpack,我的项目看起来像这样:
name: test
version: 0.1.0
github: "th/ng"
author: "Me"
description: Ok
dependencies:
- base >= 4.7 && < 5
executables:
test-bootstrap:
main: Main.hs
source-dirs: app
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
对于我的部署,我需要将它们配置如下:
executables:
test-bootstrap:
main: Main.hs
source-dirs: app
cc-options: -static
ld-options: -static -pthread
extra-lib-dirs: ./.system-work/lib
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -static
这迫使我使用stack build --docker。
我试图利用stack build --ghc-options "-static"
但我有一个可怕的痕迹:
test > /usr/bin/ld.gold: error: /home/stackage/.stack/programs/x86_64-linux/ghc-8.8.3/lib/ghc-8.8.3/ghc-prim-0.5.3/libHSghc-prim-0.5.3.a(Classes.o): requires unsupported dynamic reloc 11; recompile with -fPIC
有没有办法将cc-options 和ld-options 赋予stack,或者拥有多项目标志?
【问题讨论】:
标签: haskell build compilation haskell-stack