nh2/call-haskell-from-anything

Build failure on GHC 7.10.3

abooij opened this issue · 10 comments

$ stack build
call-haskell-from-anything-1.0.1.0: configure
Configuring call-haskell-from-anything-1.0.1.0...
Determining GHC version: 7.10.3
setup: Missing dependency on a foreign library:
* Missing C library: HSrts-ghc7.10.3
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.

--  While building package call-haskell-from-anything-1.0.1.0 using:
      /tmp/call-haskell-from-anything/.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 configure --with-ghc=/usr/bin/ghc --with-ghc-pkg=/usr/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/auke/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/pkgdb --package-db=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/pkgdb --libdir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/lib --bindir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/bin --datadir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/share --libexecdir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/libexec --sysconfdir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/etc --docdir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/doc/call-haskell-from-anything-1.0.1.0 --htmldir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/doc/call-haskell-from-anything-1.0.1.0 --haddockdir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/doc/call-haskell-from-anything-1.0.1.0 --dependency=base=base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d --dependency=bytestring=bytestring-0.10.6.0-c60f4c543b22c7f7293a06ae48820437 --dependency=msgpack=msgpack-1.0.0-35bd85d7f20379ce49d93358b7384422 --dependency=mtl=mtl-2.2.1-3af90341e75ee52dfc4e3143b4e5d219 --dependency=template-haskell=template-haskell-2.10.0.0-3c4cb52230f347282af9b2817f013181 --dependency=vector=vector-0.11.0.0-299aefb173ce5a731565d31f609a0cfd --enable-tests --enable-benchmarks
    Process exited with code: ExitFailure 1

A simple (sandboxed) cabal build fails on a first run, and succeeds on a second.

(cabal install fails, even on second try: it seems to run a clean build, which apparently doesn't work)

Seems similar to commercialhaskell/stack#1520

Do you have a system install of ghc? It's possible that doing stack setup --no-system-ghc followed by stack build --no-system-ghc might do the trick.

$ stack setup --no-system-ghc
stack will use a locally installed GHC
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec
$ stack path
global-stack-root: /home/auke/.stack
project-root: /tmp/call-haskell-from-anything
config-location: /tmp/call-haskell-from-anything/stack.yaml
bin-path: /home/auke/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/auke/.local/bin:/home/auke/.cabal/bin:/home/auke/dev/agda_sandbox/.cabal-sandbox/bin:./.cabal-sandbox/bin:../.cabal-sandbox/bin
ghc-paths: /home/auke/.stack/programs/x86_64-linux
local-bin-path: /home/auke/.local/bin
extra-include-dirs: 
extra-library-dirs: 
snapshot-pkg-db: /home/auke/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/pkgdb
local-pkg-db: /tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/pkgdb
global-pkg-db: /usr/lib/ghc-7.10.3/package.conf.d
ghc-package-path: /tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/pkgdb:/home/auke/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/pkgdb:/usr/lib/ghc-7.10.3/package.conf.d
snapshot-install-root: /home/auke/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3
local-install-root: /tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3
snapshot-doc-root: /home/auke/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/doc
local-doc-root: /tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/doc
dist-dir: .stack-work/dist/x86_64-linux/Cabal-1.22.5.0
local-hpc-root: /tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/hpc
$ stack build --no-system-ghc
call-haskell-from-anything-1.0.1.0: configure
Configuring call-haskell-from-anything-1.0.1.0...
Determining GHC version: 7.10.3
setup: Missing dependency on a foreign library:
* Missing C library: HSrts-ghc7.10.3
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.

--  While building package call-haskell-from-anything-1.0.1.0 using:
      /tmp/call-haskell-from-anything/.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 configure --with-ghc=/home/auke/.stack/programs/x86_64-linux/ghc-7.10.3/bin/ghc --with-ghc-pkg=/home/auke/.stack/programs/x86_64-linux/ghc-7.10.3/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/auke/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/pkgdb --package-db=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/pkgdb --libdir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/lib --bindir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/bin --datadir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/share --libexecdir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/libexec --sysconfdir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/etc --docdir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/doc/call-haskell-from-anything-1.0.1.0 --htmldir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/doc/call-haskell-from-anything-1.0.1.0 --haddockdir=/tmp/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/doc/call-haskell-from-anything-1.0.1.0 --dependency=base=base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d --dependency=bytestring=bytestring-0.10.6.0-9a873bcf33d6ce2fd2698ce69e2c1c66 --dependency=msgpack=msgpack-1.0.0-2b637136678add26d712aa9036257898 --dependency=mtl=mtl-2.2.1-3af90341e75ee52dfc4e3143b4e5d219 --dependency=template-haskell=template-haskell-2.10.0.0-3c4cb52230f347282af9b2817f013181 --dependency=vector=vector-0.11.0.0-299aefb173ce5a731565d31f609a0cfd --enable-tests --enable-benchmarks
    Process exited with code: ExitFailure 1
nh2 commented

@abooij Which operating system?

In the working case (I just ran it on Ubuntu), it should look like this:

➤ git clone git@github.com:nh2/call-haskell-from-anything.git
➤ cd call-haskell-from-anything/
➤ stack build
data-binary-ieee754-0.4.4: download
data-binary-ieee754-0.4.4: configure
data-binary-ieee754-0.4.4: build
data-binary-ieee754-0.4.4: copy/register
msgpack-1.0.0: download
msgpack-1.0.0: configure
msgpack-1.0.0: build
msgpack-1.0.0: copy/register
call-haskell-from-anything-1.0.1.0: configure
[1 of 1] Compiling Main             ( /home/niklas/src/call-haskell-from-anything/Setup.hs, /home/niklas/src/call-haskell-from-anything/.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/setup/Main.o )
Linking /home/niklas/src/call-haskell-from-anything/.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/setup/setup ...
Configuring call-haskell-from-anything-1.0.1.0...
Determining GHC version: 7.10.3
call-haskell-from-anything-1.0.1.0: build
Preprocessing library call-haskell-from-anything-1.0.1.0...
[1 of 4] Compiling FFI.Anything.TypeUncurry.DataKinds ( src/FFI/Anything/TypeUncurry/DataKinds.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/FFI/Anything/TypeUncurry/DataKinds.o )
[2 of 4] Compiling FFI.Anything.TypeUncurry ( src/FFI/Anything/TypeUncurry.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/FFI/Anything/TypeUncurry.o )
[3 of 4] Compiling FFI.Anything.TypeUncurry.Msgpack ( src/FFI/Anything/TypeUncurry/Msgpack.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/FFI/Anything/TypeUncurry/Msgpack.o )
[4 of 4] Compiling FFI.Anything.TH  ( src/FFI/Anything/TH.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/FFI/Anything/TH.o )
In-place registering call-haskell-from-anything-1.0.1.0...
Preprocessing executable 'call-haskell-from-anything.so' for
call-haskell-from-anything-1.0.1.0...
[1 of 1] Compiling Test1            ( test/Test1.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/call-haskell-from-anything.so/call-haskell-from-anything.so-tmp/Test1.o )
Linking a.out ...
Linking .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/call-haskell-from-anything.so/call-haskell-from-anything.so ...
call-haskell-from-anything-1.0.1.0: copy/register
Installing library in
/home/niklas/src/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/lib/x86_64-linux-ghc-7.10.3/call-haskell-from-anything-1.0.1.0-2DUYg7GpL7pI2TMsl8SVv5
Installing executable(s) in
/home/niklas/src/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/bin
Registering call-haskell-from-anything-1.0.1.0...
Completed 3 action(s).

My stack path:

global-stack-root: /home/niklas/.stack
project-root: /home/niklas/src/call-haskell-from-anything
config-location: /home/niklas/src/call-haskell-from-anything/stack.yaml
bin-path: /home/niklas/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/bin:/home/niklas/.stack/programs/x86_64-linux/ghc-7.10.3/bin:/home/niklas/bin:/home/niklas/opt/ghc-7.8/bin:/home/niklas/.fzf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
ghc-paths: /home/niklas/.stack/programs/x86_64-linux
local-bin-path: /home/niklas/.local/bin
extra-include-dirs: 
extra-library-dirs: 
snapshot-pkg-db: /home/niklas/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/pkgdb
local-pkg-db: /home/niklas/src/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/pkgdb
global-pkg-db: /home/niklas/.stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3/package.conf.d
ghc-package-path: /home/niklas/src/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/pkgdb:/home/niklas/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/pkgdb:/home/niklas/.stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3/package.conf.d
snapshot-install-root: /home/niklas/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3
local-install-root: /home/niklas/src/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3
snapshot-doc-root: /home/niklas/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/doc
local-doc-root: /home/niklas/src/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/doc
dist-dir: .stack-work/dist/x86_64-linux/Cabal-1.22.5.0
local-hpc-root: /home/niklas/src/call-haskell-from-anything/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/hpc

This in on Arch Linux. It also happens after uninstalling the global ghc and cabal (and removing ~/.stack).

While I realize this may be a bit troublesome to try out, it'd be interesting if a system installed ghc worked instead.

  1. Make stack think it doesn't have a local install:

mv /home/auke/.stack/programs/x86_64-linux/ghc-7.10.3.installed /home/auke/.stack/programs/x86_64-linux/ghc-7.10.3.installed-old

  1. Install 7.10.3 via pacman or manually

  2. See if the same issue happens

That was the setup in the original post - same issue it seems.

Actually, the workaround linked in the first post of @mgsloan works for me.

Feel free to close this, since it's a stack bug more than a call-haskell-from-anything-bug.

Hey guys,

I am getting the same problem. Gentoo linux here, using system-installed ghc (via portage, package-manager).
I've got the library at:
/usr/lib64/ghc-7.10.3/rts/libHSrts-ghc7.10.3.so

Where does the build script expect it to be? I could symlink it to the expected location, but where?

I tried the suggested solution suggested by the cabal script:
" If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is."

$ cabal configure --extra-lib-dirs=/usr/lib64/ghc-7.10.3/rts/libHSrts-ghc7.10.3.so
Resolving dependencies...
Configuring call-haskell-from-anything-1.0.1.0...
Determining GHC version: 7.10.3
cabal: Missing dependency on a foreign library:
* Missing C library: /usr/lib64/ghc-7.10.3/rts/libHSrts-ghc7.10.3.so
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.

and

$ cabal install --extra-lib-dirs=/usr/lib64/ghc-7.10.3/rts/libHSrts-ghc7.10.3.so
Resolving dependencies...
Configuring call-haskell-from-anything-1.0.1.0...
Failed to install call-haskell-from-anything-1.0.1.0
Build log ( /home/madjestic/.cabal/logs/call-haskell-from-anything-1.0.1.0.log ):
Configuring call-haskell-from-anything-1.0.1.0...
Determining GHC version: 7.10.3
setup-Configure-Cabal-1.22.8.0-x86_64-linux-ghc-7.10.3: Missing dependency on
a foreign library:
* Missing C library: /usr/lib64/ghc-7.10.3/rts/libHSrts-ghc7.10.3.so
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
cabal: Error: some packages failed to install:
call-haskell-from-anything-1.0.1.0 failed during the configure step. The
exception was:
ExitFailure 1

But that does not seem to work...

Cheers,
Vlad

nh2 commented

@madjestic I'm quite sure extra-lib-dirs should take a directory, not the full path to the .so file - can you try witht the parent directory and report back? Thanks!

Hey,
Sorry for a delay:

can you try witht the parent directory and report back?

do you mean cabal install --extra-lib-dirs=/usr/lib64/ghc-7.10.3/rts/ ?

In that case:

$ locate libHSrts-ghc7.10.3.so
/usr/lib64/ghc-7.10.3/rts/libHSrts-ghc7.10.3.so
$ cabal install --extra-lib-dirs=/usr/lib64/ghc-7.10.3/rts/
Resolving dependencies...
Configuring call-haskell-from-anything-1.0.1.0...
Failed to install call-haskell-from-anything-1.0.1.0
Build log ( /home/madjestic/.cabal/logs/call-haskell-from-anything-1.0.1.0.log ):
Configuring call-haskell-from-anything-1.0.1.0...
Determining GHC version: 7.10.3
setup-Configure-Cabal-1.22.8.0-x86_64-linux-ghc-7.10.3: Missing dependency on
a foreign library:
* Missing C library: libHSrts-ghc7.10.3
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
cabal: Error: some packages failed to install:
call-haskell-from-anything-1.0.1.0 failed during the configure step. The
exception was:
ExitFailure 1