在Archlinux上`stack build`失败,`/ usr / bin / ld:最终连接失败' [英] `stack build` failed with `/usr/bin/ld: final link failed` on Archlinux
问题描述
我试图使用 req
包( http://hackage.haskell.org/package/req )在一个Haskell项目中,使用堆栈。
到目前为止,我已经完成了 stack new my-project
, stack setup ,
stack build
和 stack exec my-project-exe
一切正常。
已添加 req <
名称:my-project
版本:0.1.0.0 code>到cabal文件就像这样:
简介:您的软件包的简短描述
主页:https://github.com/githubuser/#readme
许可证:BSD3
许可证文件:LICENSE
作者:作者姓名
维护者:example@example.com
版权:2017作者姓名
类别:Web
build-type:简单
extra-source-files :README.md
cabal-version: > = 1.10
library
hs-source-dirs:src
exposed-modules:Lib
build-depends:base> = 4.7 &安培;&安培; < 5
,req - 这就是我添加的行
default-language:Haskell2010
可执行文件my-project-exe
hs-source-dirs:app
main-is:Main.hs
ghc-options:-threaded -rtsopts -with-rtsopts = -N
build-depends:base
,my-project
default-language:Haskell2010
测试套件my-project-test
类型:exitcode-stdio-1.0
hs-source-dirs:test
main-is :Spec.hs
build-depends:base
,my-project
ghc-options:-threaded -rtsopts -with-rtsopts = -N
default-language:Haskell2010
源代码库头
类型:git
位置:https://github.com/githubuser/my-project
最后,将req自述文件中的示例剪切并粘贴到 src / Lib.hs
中,更改函数名称如下所示:
{ - #LANGUAGE OverloadedStrings# - }
{ - #OPTIONS_GHC -fno-warn-orphans# - }
模块Lib
(someFunc
)其中
导入Control.Exception(throwIO)
导入Network.HTTP.Req
导入Data.Aeson
- 只需在您的应用程序
中将您的monad堆栈作为MonadHttp实例并开始发出请求,即可享受自动连接共享。
实例MonadHttp IO其中
handleHttpException = throwIO
someFunc :: IO()
someFunc = do
let payload = object
[foo。=(10 :: Int)
,bar。=(20 :: Int)]
- 一种功能,功能强大且灵活。
r< - req POST - 方法
(httpshttpbin.org/:post) - 通过构造URL安全URL
(ReqBodyJson负载) - 使用内置选项或添加自己的
jsonResponse - 指定如何解释响应
mempty - 查询参数,标题,显式端口号等
print(responseBody r :: Value)
现在 stack build
出错:
%>堆栈构建
basement-0.0.4:配置
basement-0.0.4:构建
zlib-0.6.1.2:配置
aeson-1.1.2.0:下载
zlib-0.6.1.2:构建
network-2.6.3.2:配置
th-lift-instances-0.1.11:下载
aeson-1.1.2.0:配置
aeson- 1.1.2.0:build
th-lift-instances-0.1.11:configure
th-lift-instances-0.1.11:build
th-lift-instances-0.1.11:copy / register
aeson-1.1.2.0:复制/注册
进度:5/28
- 使用时:
/ tmp / stack7830 / network构建包网络-2.6.3.2 -2.6.3.2 / .stack-work / dist / x86_64-linux-tinfo6-nopie / Cabal-1.24.2.0 / setup / setup --builddir = .stack-work / dist / x86_64-linux-tinfo6-nopie / Cabal- 1.24.2.0 configure --with-ghc = / home / liam / .stack / programs / x86_64-linux / ghc-tinfo6 -nopie-8.0.2 / bin / ghc --with-ghc-pkg = / home / liam / .stack / programs / x86_64-linux / ghc-tinfo6-nopie-8.0.2 / bin / ghc-pkg --user --package -db = clear --package-db = global --package-db = / home /利安/ .STACK /快照/ x86_64的-Linux的tinfo6-nopie / LTS-9.14 / 8。 0.2 / pkgdb --libdir = / home / liam / .stack / snapshots / x86_64-linux-tinfo6-nopie / lts-9.14 / 8.0.2 / lib --bindir = / home / liam / .stack / snapshots / x86_64- linux-tinfo6-nopie / lts-9.14 / 8.0.2 / bin --datadir = / home / liam / .stack / snapshots / x86_64-linux-tinfo6-nopie / lts-9.14 / 8.0.2 / share --libexecdir = /home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/libexec --sysconfdir = / home / liam / .stack / snapshots / x86_64-linux-tinfo6-nopie / lts -9.14 / 8.0.2 / etc --docdir = / home / liam / .stack / snapshots / x86_64-linux-tinfo6-nopie / lts-9.14 / 8.0.2 / doc / network-2.6.3.2 --htmldir = / home / liam / .stack / snapshots / x86_64-linux-tinfo6-nopie / lts-9.14 / 8.0.2 / doc / network-2.6.3.2 --haddockdir = / home / liam / .stack / snapshots / x86_64-linux- tinfo6-nopie / lts-9.14 / 8.0.2 / doc / network-2.6.3.2 --dependency = base = base-4.9.1.0 --dependency = bytestring = bytestring-0.10.8.1 --dependency = unix = unix-2.7 .2.1
用代码退出的进程:ExitFailure 1
已将日志写入:/home/liam/code/forecast-compare/.stack-work/logs/network-2.6.3.2.log
[1的2]编译主(/tmp/stack7830/network-2.6.3.2/Setup.hs,/tmp/stack7830/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6 -nopie / Cabal-1.24.2.0 / setup / Main.o)
[2的2]编译StackSetupShim(/home/liam/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs,/ tmp / stack7830 / network-2.6.3.2 / .stack-work / dist / x86_64-linux-tinfo6-nopie / Cabal-1.24.2.0 / setup / StackSetupShim.o)
链接/tmp/stack7830/network-2.6 .3.2 / .stack-work / dist / x86_64-linux-tinfo6-nopie / Cabal-1.24.2.0 / setup / setup ...
配置network-2.6.3.2 ...
configure:WARNING :无法识别的选项:--with-compiler
检查编译系统类型... x86_64-pc-linux-gnu
检查主机系统类型... x86_64-pc-linux-gnu
检查对于gcc ... / usr / bin / gcc
检查C编译器是否工作...是
检查C编译器的默认输出文件名... a.out
检查后缀可执行文件...
检查我们是否交叉编译...配置:错误:在`/tmp/stack7830/network-2.6.3.2'中:
configure:error:无法运行C编译的程序。
如果你想交叉编译,使用`--host'。
查看`config.log'以获取更多详细信息
- 使用以下命令构建包zlib-0.6.1.2:
/home/liam/.stack/setup -exe-cache / x86_64-linux-tinfo6-nopie / Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir = .stack-work / dist / x86_64-linux-tinfo6-nopie / Cabal-1.24.2.0 build - -ghc-options-ddump-hi -ddump-to-file
用代码退出进程:ExitFailure 1
已将日志写入:/home/liam/code/forecast-compare/.stack -work / logs / zlib-0.6.1.2.log
配置zlib-0.6.1.2 ...
构建zlib-0.6.1.2 ...
预处理库zlib- 0.6.1.2 ...
/ usr / bin / ld:.stack-work / dist / x86_64-linux-tinfo6-nopie / Cabal-1.24.2.0 / build / Codec / Compression / Zlib / Stream_hsc_make.o:在创建共享对象时,无法使用针对`.rodata'的重定位R_X86_64_32;使用-fPIC
/ usr / bin / ld重新编译:最终链接失败:输出上的非代表性部分
collect2:错误:ld返回1退出状态
链接.stack-work / dist / x86_64- linux-tinfo6-nopie / Cabal-1.24.2.0 / build / Codec / Compression / Zlib / Stream_hsc_make.o失败(退出代码1)
命令为:/ usr / bin / gcc .stack-work / dist / x86_64 -linux-tinfo6-nopie / Cabal-1.24.2.0 / build / Codec / Compression / Zlib / Stream_hsc_make.o .stack-work / dist / x86_64-linux-tinfo6-nopie / Cabal-1.24.2.0 / build /编解码器/压缩/Zlib/Stream_hsc_utils.o -o .stack-work / dist / x86_64-linux-tinfo6-nopie / Cabal-1.24.2.0 / build / Codec / Compression / Zlib / Stream_hsc_make -fno-PIE -fno-stack-protector -lz -L / home / liam / .stack / programs / x86_64-linux / ghc-tinfo6-nopie-8.0.2 / lib / ghc-8.0.2 / bytestring-0.10.8.1 -Wl,-R,/ home / liam / .stack / programs / x86_64-linux / ghc-tinfo6-nopie-8.0.2 / lib / ghc-8.0.2 / bytestring-0.10.8.1 -L / home / liam / .stack / programs / x86_64-linux / ghc- tinfo6-nopie-8.0.2 / lib / ghc-8.0.2 / deepseq-1.4.2.0 -W1,-R,/ home / liam / .stack /programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/deepseq-1.4.2.0 -L / home / liam / .stack / programs / x86_64-linux / ghc-tinfo6- nopie-8.0.2 / lib / ghc-8.0.2 / array-0.5.1.1 -Wl,-R,/ home / liam / .stack / programs / x86_64-linux / ghc-tinfo6-nopie-8.0.2 / lib /ghc-8.0.2/array-0.5.1.1 -L / home / liam / .stack / programs / x86_64-linux / ghc-tinfo6-nopie-8.0.2 / lib / ghc-8.0.2 / base-4.9。 1.0 -Wl,-R,/ home / liam / .stack / programs / x86_64-linux / ghc-tinfo6-nopie-8.0.2 / lib / ghc-8.0.2 / base-4.9.1.0 -L / home / liam /.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -Wl,-R,/ home / liam / .stack / programs /x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -lgmp -L / home / liam / .stack / programs / x86_64-linux / ghc- tinfo6-nopie-8.0.2 / lib / ghc-8.0.2 / ghc-prim-0.5.0.0 -Wl,-R,/ home / liam / .stack / programs / x86_64-linux / ghc-tinfo6-nopie-8.0 .2 / lib / ghc-8.0.2 / ghc-prim-0.5.0.0 -L / home / liam / .stack / programs / x86_64-linux / ghc-tinfo6-nopie-8.0.2 / lib / ghc-8.0。 2 / rts -Wl,-R,/ home / liam / .stack / programs / x86_64-linux / ghc-tinf o6-nopie-8.0.2 / lib / ghc-8.0.2 / rts -lm -lrt -ldl -lpthread
- 在使用以下命令构建包地下室-0.0.4时:
/home/liam/.stack/setup-exe-cache/x86_64-linux-tinfo6-nopie/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir = .stack-work / dist / x86_64-linux -tinfo6-nopie / Cabal-1.24.2.0 build --ghc-options-ddump -h -i -ddump-to-file
用代码退出进程:ExitFailure 1
已将日志写入:/ home / liam / code / forecast-compare / .stack-work / logs / basement-0.0.4.log
配置地下室-0.0.4 ...
建立地下室-0.0。 4 ...
预处理库地址-0.4 ...
/ usr / bin / ld:.stack-work / dist / x86_64-linux-tinfo6-nopie / Cabal-1.24.2.0 / build / Basement / Terminal / Size_hsc_make.o:在创建共享对象时,无法使用针对`.rodata'的重定位R_X86_64_32;使用-fPIC
/ usr / bin / ld重新编译:最终链接失败:输出上的非代表性部分
collect2:错误:ld返回1退出状态
链接.stack-work / dist / x86_64- linux-tinfo6-nopie / Cabal-1.24.2.0 / build / Basement / Terminal / Size_hsc_make.o失败(退出代码1)
命令是:/ usr / bin / gcc .stack-work / dist / x86_64-linux -tinfo6-nopie / Cabal-1.24.2.0 / build / Basement / Terminal / Size_hsc_make.o .stack-work / dist / x86_64-linux-tinfo6-nopie / Cabal-1.24.2.0 / build / Basement / Terminal / Size_hsc_utils.o -o .stack-work / dist / x86_64-linux-tinfo6-nopie / Cabal-1.24.2.0 / build / Basement / Terminal / Size_hsc_make -fno-PIE -fno-stack-protector -L / home / liam / .stack /程序/ x86_64-linux / ghc-tinfo6-nopie-8.0.2 / lib / ghc-8.0.2 / base-4.9.1.0 -Wl,-R,/ home / liam / .stack / programs / x86_64-linux / ghc -tinfo6-nopie-8.0.2 / lib / ghc-8.0.2 / base-4.9.1.0 -L / home / liam / .stack / programs / x86_64-linux / ghc-tinfo6-nopie-8.0.2 / lib / ghc-8.0.2 / integer-gmp-1.0.0.1 -Wl,-R,/ home / liam / .stack / programs / x86_64-linux / ghc-tinfo6-nopie-8。 0.2 / lib / ghc-8.0.2 / integer-gmp-1.0.0.1 -lgmp -L / home / liam / .stack / programs / x86_64-linux / ghc-tinfo6-nopie-8.0.2 / lib / ghc-8.0 .2 / ghc-prim-0.5.0.0 -Wl,-R,/ home / liam / .stack / programs / x86_64-linux / ghc-tinfo6-nopie-8.0.2 / lib / ghc-8.0.2 / ghc- prim-0.5.0.0 -L / home / liam / .stack / programs / x86_64-linux / ghc-tinfo6-nopie-8.0.2 / lib / ghc-8.0.2 / rts -Wl,-R,/ home / liam /.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -lm -lrt -ldl -lpthread
非常感谢任何帮助!
此问题已被困扰Arch Linux的用户数月。它似乎与ncurses库有关,可能是由于Arch Linux动态链接Haskell包,而大多数(所有?)其他发行版都使用静态链接。
当前变通办法包括为堆栈ghc版本使用 ghc-build:nopie
选项,并安装 ncurses5-compat-libs
来自AUR。
如果你希望全局设置它,你可以在〜/ .stack / config.yaml
中设置它,所以它适用于你用堆栈构建的所有项目。
一份错误报告目前正在此处,有关相关讨论可以在拱形论坛上找到或 s钉住github 。
I'm trying to use the req
package (http://hackage.haskell.org/package/req) in a Haskell project, with stack.
So far, I've done stack new my-project
, stack setup
, stack build
and stack exec my-project-exe
all fine.
Have added req
to the cabal file like so:
name: my-project
version: 0.1.0.0
synopsis: Short description of your package
homepage: https://github.com/githubuser/#readme
license: BSD3
license-file: LICENSE
author: Author name here
maintainer: example@example.com
copyright: 2017 Author name here
category: Web
build-type: Simple
extra-source-files: README.md
cabal-version: >=1.10
library
hs-source-dirs: src
exposed-modules: Lib
build-depends: base >= 4.7 && < 5
, req -- THIS IS THE LINE IVE ADDED
default-language: Haskell2010
executable my-project-exe
hs-source-dirs: app
main-is: Main.hs
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends: base
, my-project
default-language: Haskell2010
test-suite my-project-test
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Spec.hs
build-depends: base
, my-project
ghc-options: -threaded -rtsopts -with-rtsopts=-N
default-language: Haskell2010
source-repository head
type: git
location: https://github.com/githubuser/my-project
And finally, cut and paste the example from the req readme into src/Lib.hs
, changing the function name like so:
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Lib
( someFunc
) where
import Control.Exception (throwIO)
import Network.HTTP.Req
import Data.Aeson
-- Just make your monad stack an instance of MonadHttp in your application
-- and start making requests, enjoy automatic connection sharing.
instance MonadHttp IO where
handleHttpException = throwIO
someFunc :: IO ()
someFunc = do
let payload = object
[ "foo" .= (10 :: Int)
, "bar" .= (20 :: Int) ]
-- One function, full power and flexibility.
r <- req POST -- method
(https "httpbin.org" /: "post") -- safe by construction URL
(ReqBodyJson payload) -- use built-in options or add your own
jsonResponse -- specify how to interpret response
mempty -- query params, headers, explicit port number, etc.
print (responseBody r :: Value)
And now stack build
is erroring:
%> stack build
basement-0.0.4: configure
basement-0.0.4: build
zlib-0.6.1.2: configure
aeson-1.1.2.0: download
zlib-0.6.1.2: build
network-2.6.3.2: configure
th-lift-instances-0.1.11: download
aeson-1.1.2.0: configure
aeson-1.1.2.0: build
th-lift-instances-0.1.11: configure
th-lift-instances-0.1.11: build
th-lift-instances-0.1.11: copy/register
aeson-1.1.2.0: copy/register
Progress: 5/28
-- While building package network-2.6.3.2 using:
/tmp/stack7830/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0 configure --with-ghc=/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/bin/ghc --with-ghc-pkg=/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/pkgdb --libdir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/lib --bindir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/bin --datadir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/share --libexecdir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/libexec --sysconfdir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/etc --docdir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/doc/network-2.6.3.2 --htmldir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/doc/network-2.6.3.2 --haddockdir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/doc/network-2.6.3.2 --dependency=base=base-4.9.1.0 --dependency=bytestring=bytestring-0.10.8.1 --dependency=unix=unix-2.7.2.1
Process exited with code: ExitFailure 1
Logs have been written to: /home/liam/code/forecast-compare/.stack-work/logs/network-2.6.3.2.log
[1 of 2] Compiling Main ( /tmp/stack7830/network-2.6.3.2/Setup.hs, /tmp/stack7830/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/Main.o )
[2 of 2] Compiling StackSetupShim ( /home/liam/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /tmp/stack7830/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/StackSetupShim.o )
Linking /tmp/stack7830/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/setup ...
Configuring network-2.6.3.2...
configure: WARNING: unrecognized options: --with-compiler
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... /usr/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/tmp/stack7830/network-2.6.3.2':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
-- While building package zlib-0.6.1.2 using:
/home/liam/.stack/setup-exe-cache/x86_64-linux-tinfo6-nopie/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0 build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: /home/liam/code/forecast-compare/.stack-work/logs/zlib-0.6.1.2.log
Configuring zlib-0.6.1.2...
Building zlib-0.6.1.2...
Preprocessing library zlib-0.6.1.2...
/usr/bin/ld: .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Codec/Compression/Zlib/Stream_hsc_make.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
linking .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Codec/Compression/Zlib/Stream_hsc_make.o failed (exit code 1)
command was: /usr/bin/gcc .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Codec/Compression/Zlib/Stream_hsc_make.o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Codec/Compression/Zlib/Stream_hsc_utils.o -o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Codec/Compression/Zlib/Stream_hsc_make -fno-PIE -fno-stack-protector -lz -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/bytestring-0.10.8.1 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/bytestring-0.10.8.1 -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/deepseq-1.4.2.0 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/deepseq-1.4.2.0 -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/array-0.5.1.1 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/array-0.5.1.1 -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/base-4.9.1.0 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/base-4.9.1.0 -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -lgmp -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/ghc-prim-0.5.0.0 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/ghc-prim-0.5.0.0 -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -lm -lrt -ldl -lpthread
-- While building package basement-0.0.4 using:
/home/liam/.stack/setup-exe-cache/x86_64-linux-tinfo6-nopie/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0 build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: /home/liam/code/forecast-compare/.stack-work/logs/basement-0.0.4.log
Configuring basement-0.0.4...
Building basement-0.0.4...
Preprocessing library basement-0.0.4...
/usr/bin/ld: .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Basement/Terminal/Size_hsc_make.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
linking .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Basement/Terminal/Size_hsc_make.o failed (exit code 1)
command was: /usr/bin/gcc .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Basement/Terminal/Size_hsc_make.o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Basement/Terminal/Size_hsc_utils.o -o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Basement/Terminal/Size_hsc_make -fno-PIE -fno-stack-protector -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/base-4.9.1.0 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/base-4.9.1.0 -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -lgmp -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/ghc-prim-0.5.0.0 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/ghc-prim-0.5.0.0 -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -lm -lrt -ldl -lpthread
Any help much appreciated!
This issue has been plaguing users of Arch Linux for a few months. It appears to be related to the ncurses library, and possibly due to Arch Linux dynamically linking Haskell packages, whilst most (all?) other distros use static linking.
The current work around involves using the ghc-build: nopie
option for the stack ghc version, and installing ncurses5-compat-libs
from the AUR.
If you wish to set this globally, you can set it in your ~/.stack/config.yaml
, so it applies to all projects you build with stack.
A bug report is currently open here, and some related discussion can be found on the arch forums or the stack github.
这篇关于在Archlinux上`stack build`失败,`/ usr / bin / ld:最终连接失败'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!