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

hdf5.h: No such file or directory (Ubuntu 15.04) #15

Closed
sid-kap opened this issue Jan 25, 2016 · 6 comments
Closed

hdf5.h: No such file or directory (Ubuntu 15.04) #15

sid-kap opened this issue Jan 25, 2016 · 6 comments

Comments

@sid-kap
Copy link

sid-kap commented Jan 25, 2016

When I try to build bindings-hdf5, I get the following error:

bindings-hdf5-0.1.1: build
Preprocessing library bindings-hdf5-0.1.1...
Types.hsc:1:18: fatal error: hdf5.h: No such file or directory
compilation terminated.
compiling .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Bindings/HDF5/Types_hsc_make.c failed (exit code 1)
command was: /usr/bin/gcc -c .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Bindings/HDF5/Types_hsc_make.c -o .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Bindings/HDF5/Types_hsc_make.o -fno-stack-protector -D__GLASGOW_HASKELL__=710 -Dlinux_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Dlinux_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen -include .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h -I/home/sidharth/.stack/snapshots/x86_64-linux/lts-4.1/7.10.3/lib/x86_64-linux-ghc-7.10.3/bindings-DSL-1.0.23-Es09zjDpTFQCqScuh7qYEQ/include -I/home/sidharth/.stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include -I/home/sidharth/.stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include -I/home/sidharth/.stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3/include -I/home/sidharth/.stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3/include/

--  While building package bindings-hdf5-0.1.1 using:
      /home/sidharth/clones/bindings-dsl/bindings-hdf5/.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 build lib:bindings-hdf5 --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1

I'm using Ubuntu 15.04.
I believe this issue may be related to the following issues: NVIDIA/DIGITS#156, BVLC/caffe#2690, https://groups.google.com/forum/#!topic/caffe-users/cdyqjNpoFRY.
(Apparently, the location of hdf5.h changed in the newest Ubuntu HDF5 packages, which is why the build script can't find the header file.)
It seems like we might need to update bindings-hdf5/configure to look in the right directory for hdf5.h, but I'm not sure exactly how to do this.

Does anyone here know how we can fix this?

@sid-kap
Copy link
Author

sid-kap commented Jan 26, 2016

I fixed it by adding the following to bindings-hdf5.cabal, under library:

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

Should we add this to the repo? That would be useful so that other people using Ubuntu 15.04 can run stack install bindings-hdf5 globally and it would just work, rather than having to manually clone the repo, update the cabal file, and build manually.

@jwiegley
Copy link
Collaborator

The cabal file is really not the place for such system-specific settings. They should become arguments to the stack install command.

@RyanGlScott
Copy link
Contributor

FWIW, I can reproduce the error.

I wonder if it would be a better idea to use pkgconfig-depends: hdf5 instead of a configure script?

@sid-kap
Copy link
Author

sid-kap commented Jan 26, 2016

Out of curiosity, what usually happens in this situation? In my /usr/include directory on my Ubuntu 15.04 machine, I can see many libraries that keep their header files in a directory under /usr/include: X11, boost, cairo, curl, gsl, gtk-3.0, etc. Do people usually have to specify the directory when including these libraries (i.e. #include <cairo/cairo.h>)?

@RyanGlScott
Copy link
Contributor

Er, disregard my advice: it appears that hdf5 does not ship with a .pc file. That is an Ubuntu-ism. (source: https://github.com/mokus0/bindings-hdf5#installation)

@sid-kap
Copy link
Author

sid-kap commented Jan 26, 2016

@RyanGlScott I'm not sure how pkg-config works, but on my (Ubuntu 15.04) machine, pkg-config --libs hdf5 yields

-L/usr/lib/x86_64-linux-gnu/hdf5/serial -lhdf5 

and pkg-config --cflags hdf5 yields

-I/usr/include/hdf5/serial

which looks to me like the desired output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants