在 Arch Linux 上配置构建 GHC 时出错 - “添加符号时出错:错误值”

在 Arch Linux 上配置构建 GHC 时出错 - “添加符号时出错:错误值”

我正在构建 GHC 以获取比 Arch repos 提供的默认安装更多的库,但是我设法对系统做了一些事情,导致初始配置在源的干净副本上失败:

:~/tmp$ tar -xvf ghc-7.10.2-src.tar.xz
...
:~/tmp$ cd ghc-7.10.2
:~/tmp/ghc-7.10.2$ ./configure --prefix=`pwd`/inst
checking for gfind... no
checking for find... /usr/bin/find
checking for sort... /usr/bin/sort
checking for GHC Git commit id... given 0da488c4438d88c9252e0b860426b8e74b5fc9e8
checking for ghc... /usr/local/bin/ghc
checking version of ghc... 7.10.2
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
Build platform inferred as: x86_64-unknown-linux
Host platform inferred as: x86_64-unknown-linux
Target platform inferred as: x86_64-unknown-linux
GHC build  : x86_64-unknown-linux
GHC host   : x86_64-unknown-linux
GHC target : x86_64-unknown-linux
configure: Building in-tree ghc-pwd
/usr/bin/ld: utils/ghc-pwd/dist-boot/Main.o: relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC
utils/ghc-pwd/dist-boot/Main.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
configure: error: Building ghc-pwd failed

我能对系统做什么?我只记得sudo make install在构建一次后做了一个(在决定要像上面的命令行那样进行用户空间安装之前),但错误是一个ld错误而不是一个ghc错误...

答案1

我只是在寻找/usr/local/lib需要/usr/local/bin清除ghc的东西,但看起来make install这里实际安装了一些东西:

/usr/local/haskell/ghc-7.10.2-x86_64

删除此目录并重新安装 repo 版本后ghc,配置错误消失。对我来说,找到此目录的一个有用命令是:

sudo updatedb && (locate ghc | cut -f1-4 -d'/' | sort | uniq)

相关内容