haskellfreebsdhaskell-stackhappy

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


These are the linker errors I get:

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

Misc

Options I'm considering:

  1. Figure out what the linker error is about. Maybe it is easy to fix. Perhaps ask on StackOverflow about it. ;) Any ideas what it is about?

  2. Try to find which dependency of my project is using Happy and see if I can do without it. I tried to go about this via stack list-dependencies --depth=100 and stack dot --external but neither of those helped me unfortunately.
    How could I find out which of my direct dependencies depend on it (likely indirectly)?

  3. Try to persuade stack to use the system-wide available happy binary that I was able to get via pkg install hs-happy. How could I go about this?

  4. Cross compile for FreeBSD from linux. Do I suspect correctly that this would likely not be an issue if I had a cross-compiler? And either way, would it be difficult to set up a linux->FreeBSD cross compiler? How could I go about doing that?

  5. Try to move away from needing FreeBSD. Unfortunately my hosting provider only supports FreeBSD at the moment, and I really like them for other reasons (value for price and their related philosophy). Perhaps, if all else fails, can you tell me what Linux hosting provider is your favorite for your Haskell projects?

I suspect option #1 or #3 might be the most painless.
Or would any of you have other ideas as well?


Solution

  • Thanks to the pointers in @user2407038 and @Sibi 's comments I managed to upgrade to stack 1.4.0 from 1.0.1 and stack setup an isolated GHC.

    happy installed like a charm afterwards, and all is well now.