Opened 7 years ago

Closed 6 years ago

#54210 closed defect (duplicate)

HDF5 library mismatch at runtime

Reported by: aaschwanden (Andy Aschwanden) Owned by: seanfarley (Sean Farley)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: jswhit (Jeff Whitaker), Dave-Allured (Dave Allured)
Port: py-netcdf4

Description

Hi,

I'm just re-installed macports from scratch, including ports hdf5 (needed by e.g. gdal) and hdf5-18 (needed by netcdf).

Installing py27-netcdf4 works fine but when running python code that uses the netCDF4python module, I always get a seg fault, see below. (The same happens when installing netcdf4python by hand ("USE_SETUPCFG=0 CC=mpicc CXX=mpicxx HDF5_DIR=/opt/local/lib/hdf5-18 HDF5_INCDIR=/opt/local/lib/hdf5-18/include/ HDF5_LIBDIR=/opt/local/lib/hdf5-18/lib/ python setup.py install --user"). Could this be a runtime issue?

Note:

export LD_LIBRARY_PATH=/opt/local/lib/hdf5-18/lib:$LD_LIBRARY_PATH

did not solve the problem. Any thoughts?

Warning! ***HDF5 library version mismatched error***
The HDF5 header files used to compile this application do not match
the version used by the HDF5 library to which this application is linked.
Data corruption or segmentation faults may occur if the application continues.
This can happen when an application was compiled by one version of HDF5 but
linked with a different version of static or shared HDF5 library.
You should recompile the application or check your shared library related
settings such as 'LD_LIBRARY_PATH'.
You can, at your own risk, disable this warning by setting the environment
variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.
Setting it to 2 or higher will suppress the warning messages totally.
Headers are 1.8.18, library is 1.10.0
	    SUMMARY OF THE HDF5 CONFIGURATION
	    =================================

General Information:
-------------------
                   HDF5 Version: 1.10.0-patch1
                  Configured on: Sun May 21 09:37:49 CEST 2017
                  Configured by: macports@storstrommen.local
                    Host system: x86_64-apple-darwin16.5.0
              Uname information: Darwin storstrommen.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
                       Byte sex: little-endian
             Installation point: /opt/local

Compiling Options:
------------------
                     Build Mode: production
              Debugging Symbols: no
                        Asserts: no
                      Profiling: no
             Optimization Level: high

Linking Options:
----------------
                      Libraries: static, shared
  Statically Linked Executables: 
                        LDFLAGS: -L/opt/local/lib -Wl,-headerpad_max_install_names 
                     H5_LDFLAGS: 
                     AM_LDFLAGS: 
                Extra libraries: -lz -ldl -lm 
                       Archiver: ar
                         Ranlib: ranlib

Languages:
----------
                              C: yes
                     C Compiler: /opt/local/bin/mpicc-mpich-mp
                       CPPFLAGS: -I/opt/local/include
                    H5_CPPFLAGS:   -DNDEBUG -UH5_DEBUG_API
                    AM_CPPFLAGS: 
                        C Flags: -pipe -Os 
                     H5 C Flags:    
                     AM C Flags: 
               Shared C Library: yes
               Static C Library: yes


                        Fortran: no

                            C++: yes
                   C++ Compiler: /opt/local/bin/mpicxx-mpich-mp
                      C++ Flags: -pipe -Os 
                   H5 C++ Flags:    
                   AM C++ Flags: 
             Shared C++ Library: yes
             Static C++ Library: yes

                           Java: no


Features:
---------
                  Parallel HDF5: yes
             High-level library: yes
                   Threadsafety: no
            Default API mapping: v110
 With deprecated public symbols: yes
         I/O filters (external): deflate(zlib)
                            MPE: 
                     Direct VFD: no
                        dmalloc: no
 Packages w/ extra debug output: none
                    API tracing: no
           Using memory checker: no
Memory allocation sanity checks: no
            Metadata trace file: no
         Function stack tracing: no
      Strict file format checks: no
   Optimization instrumentation: no
Bye...

Change History (11)

comment:1 Changed 7 years ago by mf2k (Frank Schima)

Cc: jswhit added; sean@… removed
Owner: set to seanfarley
Port: py-netcdf4 added; py27-netcdf4 removed
Status: newassigned

comment:2 Changed 7 years ago by Dave-Allured (Dave Allured)

Cc: Dave-Allured added

comment:3 Changed 7 years ago by seanfarley (Sean Farley)

I didn't get a crash but I did see that the wrong library was picked up. It looks like this is a problem for any port that uses nc-config:

` nc-config --libs -L/opt/local/lib -lnetcdf -lhdf5_hl -lhdf5 -ldl -lm -lz -lcurl `

I think the solution would be the same as you did here. I'd like netcdf to use hdf5, though. I'll ask the port maintainer.

comment:4 Changed 7 years ago by Dave-Allured (Dave Allured)

See #54177 (netcdf @4.4.1: update to 4.4.1.1). This ticket also attempts to switch the Netcdf dependency on hdf5-18 back to the normal hdf5. This should be the cleanest long term fix for this particular library mismatch.

comment:5 Changed 7 years ago by tenomoto (Takeshi Enomoto)

In b2956549e2c1f60021f85be8f94fb761c49b676a/macports-ports:

py-netcdf4: update to 1.2.9. add support for python36. link against hdf5 rather than hdf5-18. Closing #54210

comment:6 Changed 7 years ago by seanfarley (Sean Farley)

Resolution: fixed
Status: assignedclosed

Seems this had the wrong syntax for closing the ticket. Closing now.

comment:7 Changed 6 years ago by mankoff (Ken Mankoff)

Resolution: fixed
Status: closedreopened

I think this may need to be re-opened. After a recent upgrade I am getting the same error.

sudo port uninstall gdal hdf4 hdf5 grass7 qgis netcdf nco ncview liblas py27-gdal postgis2
sudo port clean gdal hdf4 hdf5 grass7 qgis netcdf nco ncview liblas py27-gdal postgis2
sudo port install hdf5
sudo port install nco
ncdump test.nc

results in:

Warning! ***HDF5 library version mismatched error***
The HDF5 header files used to compile this application do not match
the version used by the HDF5 library to which this application is linked.
Data corruption or segmentation faults may occur if the application continues.
This can happen when an application was compiled by one version of HDF5 but
linked with a different version of static or shared HDF5 library.
You should recompile the application or check your shared library related
settings such as 'LD_LIBRARY_PATH'.
You can, at your own risk, disable this warning by setting the environment
variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.
Setting it to 2 or higher will suppress the warning messages totally.
Headers are 1.10.1, library is 1.10.2
	    SUMMARY OF THE HDF5 CONFIGURATION
	    =================================

General Information:
-------------------
                   HDF5 Version: 1.10.2
                  Configured on: Sun Apr  8 19:57:52 UTC 2018
                  Configured by: macports@sierra.internal.macports.net
                    Host system: x86_64-apple-darwin16.7.0
              Uname information: Darwin sierra.internal.macports.net 16.7.0 Darwin Kernel Version 16.7.0: Thu Jan 11 22:59:40 PST 2018; root:xnu-3789.73.8~1/RELEASE_X86_64 x86_64
                       Byte sex: little-endian
             Installation point: /opt/local

Compiling Options:
------------------
                     Build Mode: production
              Debugging Symbols: no
                        Asserts: no
                      Profiling: no
             Optimization Level: high

Linking Options:
----------------
                      Libraries: static, shared
  Statically Linked Executables: 
                        LDFLAGS: -L/opt/local/lib -Wl,-headerpad_max_install_names 
                     H5_LDFLAGS: 
                     AM_LDFLAGS: 
                Extra libraries: -lz -ldl -lm 
                       Archiver: ar
                       AR_FLAGS: cr
                         Ranlib: ranlib

Languages:
----------
                              C: yes
                     C Compiler: /usr/bin/clang
                       CPPFLAGS: -I/opt/local/include
                    H5_CPPFLAGS:   -DNDEBUG -UH5_DEBUG_API
                    AM_CPPFLAGS: 
                        C Flags: -pipe -Os 
                     H5 C Flags:     
                     AM C Flags: 
               Shared C Library: yes
               Static C Library: yes


                        Fortran: no

                            C++: yes
                   C++ Compiler: /usr/bin/clang++
                      C++ Flags: -pipe -Os -stdlib=libc++ 
                   H5 C++ Flags:    
                   AM C++ Flags: 
             Shared C++ Library: yes
             Static C++ Library: yes

                           Java: no


Features:
---------
                  Parallel HDF5: no
             High-level library: yes
                   Threadsafety: no
            Default API mapping: v110
 With deprecated public symbols: yes
         I/O filters (external): deflate(zlib)
                            MPE: no
                     Direct VFD: no
                        dmalloc: no
 Packages w/ extra debug output: none
                    API tracing: no
           Using memory checker: no
Memory allocation sanity checks: no
            Metadata trace file: no
         Function stack tracing: no
      Strict file format checks: no
   Optimization instrumentation: no
Bye...
Abort trap: 6
$ port installed | grep -E "netcdf|hdf|grass|gdal|nco"
  hdf5 @1.10.2_0+cxx+hl (active)
  nco @4.6.6_4+accelerate (active)
  netcdf @4.4.1.1_1+dap+netcdf4 (active)

comment:8 Changed 6 years ago by mankoff (Ken Mankoff)

A work-around: If I install netcdf with hdf4 it works (although it still requires hdf5 as a dependency)

sudo port install netcdf +hdf4

comment:9 Changed 6 years ago by Dave-Allured (Dave Allured)

Another workaround, uninstall and reinstall netcdf using port -s:

https://trac.macports.org/ticket/56312#comment:13

comment:10 Changed 6 years ago by Dave-Allured (Dave Allured)

Please close this reopened ticket. It duplicates new ticket #56312.

comment:11 Changed 6 years ago by mf2k (Frank Schima)

Resolution: duplicate
Status: reopenedclosed
Note: See TracTickets for help on using tickets.