![在 Arch Linux 上配置构建 GHC 时出错 - “添加符号时出错:错误值”](https://linux22.com/image/1472268/%E5%9C%A8%20Arch%20Linux%20%E4%B8%8A%E9%85%8D%E7%BD%AE%E6%9E%84%E5%BB%BA%20GHC%20%E6%97%B6%E5%87%BA%E9%94%99%20-%20%E2%80%9C%E6%B7%BB%E5%8A%A0%E7%AC%A6%E5%8F%B7%E6%97%B6%E5%87%BA%E9%94%99%EF%BC%9A%E9%94%99%E8%AF%AF%E5%80%BC%E2%80%9D.png)
我正在构建 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)