tweag / HaskellR

The full power of R in Haskell.

Home Page:https://tweag.github.io/HaskellR

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installation issue with `inline-r` when using `stack --nix build`

freckletonj opened this issue · comments

When trying stack --nix build It makes it through all sorts of tests, and fails right at the end on inline-r.

I'm on Ubuntu 16.04 with the latest Stack

stack --version
Version 1.6.1, Git revision f25811329bbc40b0c21053a8160c56f923e1201b (5435 commits) x86_64 hpack-0.20.0

The error:

$ stack --nix build
inline-r-0.9.0.2: build (lib)
ihaskell-0.9.0.1: download
ihaskell-0.9.0.1: configure
ihaskell-0.9.0.1: build
ihaskell-0.9.0.1: copy/register
Log files have been written to: /home/xxxxx/HaskellR/.stack-work/logs/
Progress: 2/5
--  While building custom Setup.hs for package inline-r-0.9.0.2 using:
      /home/xxxxx/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0 build lib:inline-r --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/xxxxx/HaskellR/.stack-work/logs/inline-r-0.9.0.2.log

    Preprocessing library inline-r-0.9.0.2...
    c2hs: Foreign/R.chi not found in:
    .stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/build
    .

So then I tried with just stack build and it also fails:

[34 of 34] Compiling Language.R.Matcher ( src/Language/R/Matcher.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Language/R/Matcher.o )
Installing library in
/home/xxxxx/HaskellR/.stack-work/install/x86_64-linux/lts-9.3/8.0.2/lib/x86_64-linux-ghc-8.0.2/inline-r-0.9.0.2-GXEXrsxC4K8OTVxhqWwxs
Registering inline-r-0.9.0.2...

--  End of log file: /home/xxxxx/.stack-work/logs/inline-r-0.9.0.2.log

Log files have been written to: /xxxxx/HaskellR/.stack-work/logs/

--  While building custom Setup.hs for package ihaskell-inline-r-0.1.1.0 using:
      /home/xxxxx/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 build lib:ihaskell-inline-r --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/xxxxx/HaskellR/.stack-work/logs/ihaskell-inline-r-0.1.1.0.log

    Configuring ihaskell-inline-r-0.1.1.0...
    Preprocessing library ihaskell-inline-r-0.1.1.0...
    [1 of 1] Compiling IHaskell.Display.InlineR ( src/IHaskell/Display/InlineR.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/IHaskell/Display/InlineR.o )
    /usr/bin/ld: .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/IHaskell/Display/InlineR.dyn_o: relocation R_X86_64_PC32 against symbol `ihaskellzminlinezmrzm0zi1zi1zi0zm9AW8NigQJww4vm7O8jZZTHL_IHaskellziDisplayziInlineR_rprint6_closure' can not be used when making a shared object; recompile with -fPIC
    /usr/bin/ld: final link failed: Bad value
    collect2: error: ld returned 1 exit status
    `gcc' failed in phase `Linker'. (Exit code: 1)

hmmm... I'll update this ticket if I can solve this

I'm excited to try this out!

This carried me over the bump in installing: stack build --ghc-options -optl-fuse-ld=gold

Workarounds for linker issues on some platforms is explained in the FAQ: http://tweag.github.io/HaskellR/docs/faq.html.