Results 1 to 3 of 3

Thread: Problem linking hdf5-libs in gfortran on SUSE

  1. #1
    Join Date
    Jan 2015

    Default Problem linking hdf5-libs in gfortran on SUSE

    Dear all,

    I am having troubles linking the libraries lhdf5_fortran and lhdf5 during compilation in a gfortran program. I guess the problem is that the paths of these hdf5-libraries are set differently in SUSE from say, Debian, Ubuntu or MacOS, so the makefile to build I am using can't find the libs. Unfortunately, I cannot find them either, even not when searching for them with the find command. I installed the latest version of hdf5 installed on my system with zypper (not a binary install where I could have chosen a wrong install directory). After searching for quite a while I could locate and in /usr/lib64 but I am not sure whether these are the files I am looking for - specifically, according to the makefile I got I was looking for lhdf5_fortran and lhdf5 without an .so extension. Even if I found the right path of these libs I am not sure how to specify that path in the linking process in gfortran.

    This is how the critical lines in the makefile look (unfortunately written for gfortran on MacOS, not SUSE):

    FLAGS = -O3 -lhdf5_fortran -lhdf5 -lz -I/usr/local/Cellar/hdf5/1.8.13/include -fopenmp
    LDFLAGS = -O3 -lhdf5_fortran -lhdf5 -lz -I/usr/local/Cellar/hdf5/1.8.13/include -L/usr/local/Cellar/hdf5/1.8.13/lib -lm

    Compilation error:
    /usr/lib64/gcc/x86_64-suse-linux/5/../../../../x86_64-suse-linux/bin/ld: cannot find -libhdf5_fortran
    /usr/lib64/gcc/x86_64-suse-linux/5/../../../../x86_64-suse-linux/bin/ld: cannot find -libhdf5

    I also don't know what the include directory means - could be the path on a Mac to the hdf5-libs or whatever...

    Searching the hdf5-data-group-website, the web in general and asking the guys who have written the fortran program and makefile how to port that to SUSE didn't get me a single step further to compile that program. After trying to get it running for weeks, this is my last hope that someone of the SUSE-community has experience with hdf5 on SUSE (and some experience with gfortran).

    Thank you very much in advance!!!

    Btw.: I am running Tumbleweed with the latest hdf5-version: hdf5-1.8.16-3.1.x86_64

  2. #2
    Join Date
    Jun 2008
    San Diego, Ca, USA
    Blog Entries

    Default Re: Problem linking hdf5-libs in gfortran on SUSE

    You should provide in your post...

    The package info about your library
    zypper info packagename
    Although the above should be good enough for your post, you might include but should run for your own info anyway the following which describes your package contents
    rpm -ql packagename
    The above should be all that's necessary to know what is installed and where on your system but if you want to verify on your system, I use the "locate" utility which works instantaneously fast compared to slower utilities like find...

    To install locate
    zypper in mlocate
    After installation, although its database updates automatically every 24 hrs, we don't want to wait a day so want to populate the database immediately (or immediately after any significant changes) with the following
    Now, you can "locate" any file or file including a partial path (for instance if you want only binaries prepend "/bin/" to your file name)
    locate filename
    You should also include information about what you are trying to do...
    - If there is a published guide you're following or source like a git project, provide the URL to the guide or project you're following.
    - Oftentimes there is an INSTALL file or other file that describes building your project or source. If this is the case, provide a URL to that file or describe how it can be found (in the package or source?).

    Lastly, it's <critical> that you display the errors you get verbatim. This typically means either extracting the errors from a logfile (or posting the entire logfile to a pastebin and providing a link to that in your Forum post) or copying the error lines out of your windowed console (possible in most openSUSE consoles which are automatically enhanced) using your choice of the following
    1. Highlight the lines to be copied and use the console's Edit menu selections
    2. Highlight the lines to be copied and clicking CTL-SHFT-C
    3. Re-run the command but re-direct console output to file, the following is an example for re-directing make output to a file called "make_log.txt"
    make > make_log.text
    Like any other kind of script, a makefile can be built specific to a specific architecture like MacOS or a specific distro instead of using relative paths. In this case, you either have to modify the makefile yourself or message with the authors of the file/project for modifications.

    Beginner Wiki Quickstart -
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  3. #3
    Join Date
    Jan 2015

    Default Re: Problem linking hdf5-libs in gfortran on SUSE

    locate helped me to find all the necessary library files very quickly. Also the other commands to get the package info turned out to be very helpful!

    Finally I got the fortran code compiled and running by downgrading some packages, it seems I had a mess with various repositories. Once I had the right matching versions of hdf5 and its libs together with debug files correctly installed, the fortran flags worked just fine.

    Your info was very helpful to finally get there! Thank you very much!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts