Haskell、FreeBSD、Stack、happy:如果构建工具(在我的例子中是 `happy-1.19.5`)安装失败怎么办?

Haskell, FreeBSD, Stack, happy: What can one do if a build-tool (in my case `happy-1.19.5`) is failing installation?

这些是我得到的链接器错误:

happy-1.19.5: configure
cpphs-1.20.2: download
th-reify-many-0.1.6: download
time-qq-0.0.1.0: download
th-reify-many-0.1.6: configure
th-reify-many-0.1.6: build
time-qq-0.0.1.0: configure
time-qq-0.0.1.0: build
cpphs-1.20.2: configure
th-reify-many-0.1.6: copy/register
time-qq-0.0.1.0: copy/register
cpphs-1.20.2: build
cpphs-1.20.2: copy/register
Progress: 4/9
--  While building package happy-1.19.5 using:
      /usr/local/bin/ghc --make -odir /tmp/stack1466/happy-1.19.5/.stack-work/dist/x86_64-freebsd/Cabal-1.22.4.0/setup -hidir /tmp/stack1466/happy-1.19.5/.stack-work/dist/x86_64-freebsd/Cabal-1.22.4.0/setup
 -i -i. -package=Cabal-1.22.4.0 -clear-package-db -global-package-db -package-db=/root/.stack/snapshots/x86_64-freebsd/lts-7.14/7.10.2/pkgdb /tmp/stack1466/happy-1.19.5/Setup.lhs -o /tmp/stack1466/happy-1.1
9.5/.stack-work/dist/x86_64-freebsd/Cabal-1.22.4.0/setup/setup
    Process exited with code: ExitFailure 1
    Logs have been written to: /root/project-name/.stack-work/logs/happy-1.19.5.log

    [1 of 1] Compiling Main             ( /tmp/stack1466/happy-1.19.5/Setup.lhs, /tmp/stack1466/happy-1.19.5/.stack-work/dist/x86_64-freebsd/Cabal-1.22.4.0/setup/Main.o )

    /tmp/stack1466/happy-1.19.5/Setup.lhs:20:1: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:21:1: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:22:1: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:68:1: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:74:1: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:81:19: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:82:23: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:83:26: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:84:26: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:85:30: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:86:33: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:87:32: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:88:36: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:89:39: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:94:14: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:99:13: Warning: Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:100:17: Warning:
        Tab character

    /tmp/stack1466/happy-1.19.5/Setup.lhs:101:23: Warning:
        Tab character

    Linking /tmp/stack1466/happy-1.19.5/.stack-work/dist/x86_64-freebsd/Cabal-1.22.4.0/setup/setup ...
    /usr/local/lib/ghc-7.10.2/unix_A3WgcI5QiHK4PDo4jSYdwQ/libHSunix-2.7.1.0-A3WgcI5QiHK4PDo4jSYdwQ.a(HsUnix.o): In function `__hsunix_rtldNext':
    HsUnix.c:(.text+0x80): multiple definition of `__hsunix_rtldNext'
    /root/.stack/snapshots/x86_64-freebsd/lts-7.14/7.10.2/lib/x86_64-freebsd-ghc-7.10.2/unix-2.7.2.0-3psvMyG1UoBJLXj9bF7fFS/libHSunix-2.7.2.0-3psvMyG1UoBJLXj9bF7fFS.a(HsUnix.o):(.text+0x0): first defined here
    /usr/local/lib/ghc-7.10.2/unix_A3WgcI5QiHK4PDo4jSYdwQ/libHSunix-2.7.1.0-A3WgcI5QiHK4PDo4jSYdwQ.a(HsUnix.o): In function `__hsunix_rtldDefault':
    HsUnix.c:(.text+0x90): multiple definition of `__hsunix_rtldDefault'
    /root/.stack/snapshots/x86_64-freebsd/lts-7.14/7.10.2/lib/x86_64-freebsd-ghc-7.10.2/unix-2.7.2.0-3psvMyG1UoBJLXj9bF7fFS/libHSunix-2.7.2.0-3psvMyG1UoBJLXj9bF7fFS.a(HsUnix.o):(.text+0x10): first defined here
    /usr/local/lib/ghc-7.10.2/unix_A3WgcI5QiHK4PDo4jSYdwQ/libHSunix-2.7.1.0-A3WgcI5QiHK4PDo4jSYdwQ.a(HsUnix.o): In function `__hsunix_ptsname':
    HsUnix.c:(.text+0x130): multiple definition of `__hsunix_ptsname'
    /root/.stack/snapshots/x86_64-freebsd/lts-7.14/7.10.2/lib/x86_64-freebsd-ghc-7.10.2/unix-2.7.2.0-3psvMyG1UoBJLXj9bF7fFS/libHSunix-2.7.2.0-3psvMyG1UoBJLXj9bF7fFS.a(HsUnix.o):(.text+0x20): first defined here
    /usr/local/lib/ghc-7.10.2/unix_A3WgcI5QiHK4PDo4jSYdwQ/libHSunix-2.7.1.0-A3WgcI5QiHK4PDo4jSYdwQ.a(HsUnix.o): In function `__hsunix_grantpt':
    HsUnix.c:(.text+0x140): multiple definition of `__hsunix_grantpt'
    /root/.stack/snapshots/x86_64-freebsd/lts-7.14/7.10.2/lib/x86_64-freebsd-ghc-7.10.2/unix-2.7.2.0-3psvMyG1UoBJLXj9bF7fFS/libHSunix-2.7.2.0-3psvMyG1UoBJLXj9bF7fFS.a(HsUnix.o):(.text+0x30): first defined here
    /usr/local/lib/ghc-7.10.2/unix_A3WgcI5QiHK4PDo4jSYdwQ/libHSunix-2.7.1.0-A3WgcI5QiHK4PDo4jSYdwQ.a(HsUnix.o): In function `__hsunix_unlockpt':
    HsUnix.c:(.text+0x150): multiple definition of `__hsunix_unlockpt'
    /root/.stack/snapshots/x86_64-freebsd/lts-7.14/7.10.2/lib/x86_64-freebsd-ghc-7.10.2/unix-2.7.2.0-3psvMyG1UoBJLXj9bF7fFS/libHSunix-2.7.2.0-3psvMyG1UoBJLXj9bF7fFS.a(HsUnix.o):(.text+0x40): first defined here
    /usr/local/lib/ghc-7.10.2/unix_A3WgcI5QiHK4PDo4jSYdwQ/libHSunix-2.7.1.0-A3WgcI5QiHK4PDo4jSYdwQ.a(HsUnix.o): In function `__hsunix_push_module':
    HsUnix.c:(.text+0x160): multiple definition of `__hsunix_push_module'
    /root/.stack/snapshots/x86_64-freebsd/lts-7.14/7.10.2/lib/x86_64-freebsd-ghc-7.10.2/unix-2.7.2.0-3psvMyG1UoBJLXj9bF7fFS/libHSunix-2.7.2.0-3psvMyG1UoBJLXj9bF7fFS.a(HsUnix.o):(.text+0x50): first defined here
    collect2: error: ld returned 1 exit status

其他

我正在考虑的选项:

  1. 找出链接器错误的原因。也许很容易修复。也许在 Whosebug 上询问一下。 ;) 知道它是关于什么的吗?

  2. 试着找出我项目的哪个依赖使用了Happy,看看我是否可以不用它。我试图通过 stack list-dependencies --depth=100stack dot --external but neither of those helped me unfortunately.
    来解决这个问题 我如何找出我的哪些直接依赖项(可能是间接依赖项)?

  3. 尝试说服 stack 使用我能够通过 pkg install hs-happy 获得的系统范围内可用的 happy 二进制文件。我该怎么做?

  4. 从 linux 交叉编译 FreeBSD。如果我有一个交叉编译器,我是否正确地怀疑这可能不是问题?不管怎样,设置一个 linux->FreeBSD 交叉编译器会不会很困难?我该怎么做呢?

  5. 尝试摆脱对 FreeBSD 的依赖。不幸的是,我的托管服务提供商目前只支持 FreeBSD,而且出于其他原因(物有所值及其相关理念)我真的很喜欢它们。也许,如果一切都失败了,你能告诉我你的 Haskell 项目最喜欢哪个 Linux 托管服务提供商吗?

我怀疑选项 #1 或 #3 可能是最轻松的。
或者你们还有其他想法吗?

感谢@user2407038 中的指点和@Sibi 的评论,我设法从 1.0.1 升级到堆栈 1.4.0 和 stack setup 一个独立的 GHC。

happy 安装后很顺利,现在一切正常。