CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

build CGNS with HDF5

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By t.teschner
  • 1 Post By trushant

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 27, 2018, 17:47
Default build CGNS with HDF5
  #1
Senior Member
 
Tom-Robin Teschner
Join Date: Dec 2011
Location: Cranfield, UK
Posts: 206
Rep Power: 16
t.teschner is on a distinguished road
I noticed that my mesh generator of choice has switched writing CGNS files from ADF to HDF5 to store data. I am not able to change that as it seems in the mesh generator so I have to compile CGNS now with HDF5. I got HDF5 installed and ran make check-install which successfully passed, so I am quite confident that I got HDF5 installed properly.

Now my problems start when trying to compile the CGNS library together with HDF5. Here is what I did so far (I am on ubuntu). Build HDF5 into the default directory (which is inside the parent directory) and then have CGNS point to that location, i.e. I build HDF5 with ./configure, make, make install (make check-install) and then build CGNS with ./configure --with-hdf5=/path/to/hdf5, where /path/to/hdf5 is the top level folder containing the inlcude/ and lib/ directories. I also tried setting the LDFLAGS and LIBS flag as an LDFLAGS="-L/path/to/lib" LIBS="-lhdf5" ./configure, but this didn't work either, in fact, the compilation aborts during configure already.

I also went another direction, compiling hdf5 into my /usr/local (as well as into /usr/local/hdf5) directory, both of which are inside my PATH variable (echo $PATH confirmed this) and then have building CGNS with ./configure --with-hdf5=/usr/local (and also with /usr/local/hdf5), I get the same error as before.

Specifically, when doing the two routes above, ./configure [OPTIONS] executes fine and creates a Makefile. When I do make, I always get an error message when trying to build the cgnstools of the sort:

Code:
gcc -g -O2  -I.. -o cgnslist cgnslist.o getargs.o ../lib/libcgns.a /usr/local/hdf5/lib/libhdf5.a    -lm
/usr/local/hdf5/lib/libhdf5.a(H5PLint.o): In function `H5PL__open':
H5PLint.c:(.text+0x3c3): undefined reference to `dlopen'
H5PLint.c:(.text+0x3dc): undefined reference to `dlsym'
H5PLint.c:(.text+0x442): undefined reference to `dlclose'
H5PLint.c:(.text+0x4a1): undefined reference to `dlerror'
/usr/local/hdf5/lib/libhdf5.a(H5PLint.o): In function `H5PL__close':
H5PLint.c:(.text+0x577): undefined reference to `dlclose'
/usr/local/hdf5/lib/libhdf5.a(H5PLplugin_cache.o): In function `H5PL__find_plugin_in_cache':
H5PLplugin_cache.c:(.text+0x368): undefined reference to `dlsym'
/usr/local/hdf5/lib/libhdf5.a(H5Zdeflate.o): In function `H5Z_filter_deflate':
H5Zdeflate.c:(.text+0x135): undefined reference to `inflateInit_'
H5Zdeflate.c:(.text+0x165): undefined reference to `inflate'
H5Zdeflate.c:(.text+0x188): undefined reference to `inflateEnd'
H5Zdeflate.c:(.text+0x202): undefined reference to `compress2'
H5Zdeflate.c:(.text+0x2ac): undefined reference to `inflateEnd'
H5Zdeflate.c:(.text+0x43a): undefined reference to `inflateEnd'
collect2: error: ld returned 1 exit status
Makefile:25: recipe for target 'cgnslist' failed
make[1]: *** [cgnslist] Error 1
make[1]: Leaving directory '/mnt/c/Users/Tom/Documents/coding/libraries/CGNS-master/src/tools'
Makefile:65: recipe for target 'tools' failed
make: *** [tools] Error 2
Evidently, the linker is having issues locating the library (I confirmed with "ls /usr/local/hdf5/lib/" that libhdf5.a exists). I tried messing with the Makefile to no avail.

Seems like I am missing something but I can't see it at the moment, any suggestions?
t.teschner is offline   Reply With Quote

Old   October 28, 2018, 05:23
Default
  #2
Senior Member
 
Tom-Robin Teschner
Join Date: Dec 2011
Location: Cranfield, UK
Posts: 206
Rep Power: 16
t.teschner is on a distinguished road
well, I managed myself in the end. Just in case somebody has the same problem and arrives at this thread, the error is coming because hdf5 can not find the libraries libld.a and libz.a. So during configuration of CGNS, those libraries need to be past along:

LIBS="-ldl -lz" ./configure --with-hdf5=/path/to/hdf5

In my case, i build hdf5 into /usr/local/hdf5 (./configure --prefix=/usr/local/hdf5) so that the above command becomes LIBS="-ldl -lz" ./configure --with-hdf5=/usr/local/hdf5

It seems hdf5 already builds libld.a by default, but not libz.a (https://zlib.net/), so I needed to download and build that first. Got there in the end though, it seems that the newest version (as of now) changed a bit in that some libraries need to be explicitly linked (http://hdf-forum.184993.n3.nabble.co...td4026300.html)
flotus1 likes this.
t.teschner is offline   Reply With Quote

Old   January 31, 2019, 15:17
Default
  #3
New Member
 
Trushant Patel
Join Date: Feb 2017
Posts: 4
Rep Power: 9
trushant is on a distinguished road
Thank you! I was having the same problem, and this worked for me!!

Thanks,
Trushant Patel
t.teschner likes this.
trushant is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
change CGNS export from hdf5 to adf t.teschner Pointwise & Gridgen 5 November 2, 2018 09:04
cgns & hdf5 pankos Main CFD Forum 0 September 25, 2017 09:45
HDF5 or ADF? nba1942 Pointwise & Gridgen 2 July 16, 2015 12:19
Building from Source on Windows using Cygwin64 ericthefatguy SU2 2 May 12, 2015 18:23
How could I use CGNS with HDF5 codezy SU2 1 April 8, 2014 02:26


All times are GMT -4. The time now is 21:47.