Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack ghci: missing library #1700

Closed
sid-kap opened this issue Jan 26, 2016 · 5 comments
Closed

stack ghci: missing library #1700

sid-kap opened this issue Jan 26, 2016 · 5 comments

Comments

@sid-kap
Copy link
Contributor

sid-kap commented Jan 26, 2016

I am running stack Version 1.0.2, Git revision fa09a98 (3084 commits) x86_64, on Ubuntu 15.04.

When I run stack ghci in my project, I get the following output:

Configuring GHCi with the following packages: bindings-hdf5
GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
[1 of 4] Compiling Bindings.HDF5.Types ( /home/sidharth/clones/bindings-dsl/bindings-hdf5/.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Bindings/HDF5/Types.hs, interpreted )
[2 of 4] Compiling Bindings.HDF5.HighLevelAPI ( /home/sidharth/clones/bindings-dsl/bindings-hdf5/.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Bindings/HDF5/HighLevelAPI.hs, interpreted )

ByteCodeLink: can't find label
During interactive linking, GHCi couldn't find the following symbol:
  H5LTpath_valid
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session.  Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please send a bug report to:
  glasgow-haskell-bugs@haskell.org


<no location info>:
    Could not find module ‘Bindings.HDF5’
    It is a member of the hidden package ‘bindings-hdf5-0.1.1@bindi_D7RrcSnzrhZ9CrrUR1QvzD’.
Leaving GHCi.

This is for the bindings-hdf5 package (https://github.com/jwiegley/bindings-dsl/tree/master/bindings-hdf5). I believe this issue might have something to do with the fact that, on Ubuntu 15.04, the hdf5.h header file (which is included simply as #include <hdf5.h>) is not in any of the default include locations (/usr/include), but in a different location (/usr/include/hdf5/serial). stack build only worked on this project by either adding the line

pkgconfig-depends: hdf5

or

include-dirs: /usr/include/hdf5/serial
extra-lib-dirs: /usr/lib/x86_64-linux-gnu/hdf5/serial

to the cabal file.

I have tried running stack ghci -- -I/usr/include/hdf5/serial -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lhdf5, which generated the output:

The following errors occurred while parsing the build targets:
- Directory not found: -I/usr/include/hdf5/serial
- Directory not found: -L/usr/lib/x86_64-linux-gnu/hdf5/serial
- Directory not found: -lhdf5

Am I approaching this the right way? I think this issue might be similar to #498, but it seems that the fix for #498 is already been merged, so this must be a different problem.

@mgsloan
Copy link
Contributor

mgsloan commented Jan 26, 2016

Hi, thanks for the detailed report! I'm thinking this is likely the same issue as #970 . That is, stack ghci doesn't use the configuration that results from the custom Setup.hs. This theory is supported by the presence of a custom configuration: https://github.com/jwiegley/bindings-dsl/blob/master/bindings-hdf5/Setup.hs

Also related is #1656 , though that's about extra-lib-dirs in the stack.yaml file rather than the cabal file.

So, I think this is pretty well tracked by other tickets, except for one point: that the invocation of ghci does not pay attention to pkgconfig-depends, include-dirs, and extra-lib-dirs in the cabal file. Due to this extra aspect, I'm leaving the ticket open to track it. Perhaps considering these details is irrelevant if the root cause is resolved (using the configured ghc flags).

@mgsloan
Copy link
Contributor

mgsloan commented Jan 28, 2016

A GHC bug which is potentially related: https://ghc.haskell.org/trac/ghc/ticket/11042 Looks like the fix made it into GHC 8

@RyanGlScott
Copy link
Contributor

This just bit me today. I can't stack ghci this project since it relies on pkgconfig-depends to figure out where C dependencies live.

@mgsloan
Copy link
Contributor

mgsloan commented Apr 25, 2016

Resolving this issue could be a simple matter of wrapping up that info as ghci options here

generateBuildInfoOpts
. PRs appreciated!

@mgsloan
Copy link
Contributor

mgsloan commented Mar 24, 2017

I think this may have been resolved for some time, after e11c78c

I can't get those examples to build, so can't test with ghci. Please comment / reopen if not

@mgsloan mgsloan closed this as completed Mar 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants