3

New user to Ubuntu (running 16.04) here. I need to use HDF5, more specifically: I need ld -lhdf5 be able to run without error.

As far as I can tell, what should work is running sudo apt-get install libhdf5-dev. This generates the folder at /usr/include/hdf5/ as expected. However when I run:
ld -lhdf5
I get:
ld: cannot find -lhdf5
When I run:
ld -lhdf5 --verbose
I get as last few lines:

==================================================
attempt to open //usr/local/lib/x86_64-linux-gnu/libhdf5.so failed
attempt to open //usr/local/lib/x86_64-linux-gnu/libhdf5.a failed
attempt to open //lib/x86_64-linux-gnu/libhdf5.so failed
attempt to open //lib/x86_64-linux-gnu/libhdf5.a failed
attempt to open //usr/lib/x86_64-linux-gnu/libhdf5.so failed
attempt to open //usr/lib/x86_64-linux-gnu/libhdf5.a failed
attempt to open //usr/local/lib64/libhdf5.so failed
attempt to open //usr/local/lib64/libhdf5.a failed
attempt to open //lib64/libhdf5.so failed
attempt to open //lib64/libhdf5.a failed
attempt to open //usr/lib64/libhdf5.so failed
attempt to open //usr/lib64/libhdf5.a failed
attempt to open //usr/local/lib/libhdf5.so failed
attempt to open //usr/local/lib/libhdf5.a failed
attempt to open //lib/libhdf5.so failed
attempt to open //lib/libhdf5.a failed
attempt to open //usr/lib/libhdf5.so failed
attempt to open //usr/lib/libhdf5.a failed
attempt to open //usr/x86_64-linux-gnu/lib64/libhdf5.so failed
attempt to open //usr/x86_64-linux-gnu/lib64/libhdf5.a failed
attempt to open //usr/x86_64-linux-gnu/lib/libhdf5.so failed
attempt to open //usr/x86_64-linux-gnu/lib/libhdf5.a failed
ld: cannot find -lhdf5

None of these places contain ideed this file or something similar. Can anyone help me where it should be?

4
  • You might have to run 'sudo apt-get install libhdf5' to install the library itself. The -dev package is, to my knowlegde, only the header-files. – Soren A Jan 10 '17 at 14:00
  • It's going to depend on your Ubuntu version I think: newer versions use an explicit serial subdirectory IIRC. Regardless you can do dpkg -L libhdf5-dev. Or see the file list at File list of package libhdf5-dev in xenial of architecture amd64 – steeldriver Jan 10 '17 at 14:21
  • When I run sudo apt-get install libhdf5, I get E: Unable to locate package libhdf5. Did I make a mistake? – dimpol Jan 10 '17 at 14:42
  • 1
    Ah thanks, it was in: /usr/lib/x86_64-linux-gnu/hdf5/serial/. If you add the part about dpkg -L libhdf5-dev as an answer, I will accept it. – dimpol Jan 10 '17 at 14:44
4

The location of the particular library lies in running

dpkg -L libhdf5-dev

which for my installation lies in

/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.