hdf5/openmpi c++ linking

Dear all,

The following problem shows up when linking a code with both open-mpi and hdf5 with c++ bindings on. The problem occurs both on mac and linux (tested on ubuntu).
The failing tested combinations are:
openmpi 1.7.3 with hdf5 1.8.12
openmpi 1.7.2 with hdf5 1.8.1

Here’s the simple code, that doesn’t have any hdf5

···

---------------------------
#include "mpi.h"

int main(int argc, char* argv[])
{
    MPI_Init(&argc, &argv);
    MPI_Finalize();
    return 0;
}

—————————————

Now I link and run it as follows with CXX being clang or g++
$CXX a.cpp -o a -lhdf5 -lmpi -lmpi_cxx
./a

This runs and exits without problems

However, compiling with hdf5_cpp
$CXX a.cpp -o b -lhdf5 -lmpi -lmpi_cxx -lhdf5_cpp
./b
fails and raises an error
-------------------
[phys-100-120:31011] *** Process received signal ***
[phys-100-120:31011] Signal: Segmentation fault: 11 (11)
[phys-100-120:31011] Signal code: Address not mapped (1)
[phys-100-120:31011] Failing at address: 0x1040a8e72
[phys-100-120:31011] [ 0] 2 libsystem_platform.dylib 0x00007fff8f7a35aa _sigtramp + 26
[phys-100-120:31011] [ 1] 3 ??? 0x0000000000000000 0x0 + 0
[phys-100-120:31011] [ 2] 4 libsystem_c.dylib 0x00007fff904efbb7 getenv + 29
[phys-100-120:31011] [ 3] 5 libhdf5.8.dylib 0x0000000103d1c29b H5_init_library + 407
[phys-100-120:31011] [ 4] 6 libhdf5.8.dylib 0x0000000103dde6f1 H5Iget_type + 37
[phys-100-120:31011] [ 5] 7 libhdf5_cpp.8.dylib 0x0000000104043fc3 _ZN2H511IdComponent10p_valid_idEi + 15
[phys-100-120:31011] [ 6] 8 libhdf5_cpp.8.dylib 0x0000000104048ab8 _ZN2H58PropList5closeEv + 24
[phys-100-120:31011] [ 7] 9 libhdf5_cpp.8.dylib 0x00000001040497fd _ZN2H58PropListD2Ev + 31
[phys-100-120:31011] [ 8] 10 libsystem_c.dylib 0x00007fff904ef841 __cxa_finalize + 177
[phys-100-120:31011] [ 9] 11 libsystem_c.dylib 0x00007fff904efaec exit + 22
[phys-100-120:31011] [10] 12 libdyld.dylib 0x00007fff97d54604 start + 8
[phys-100-120:31011] [11] 13 ??? 0x0000000000000001 0x0 + 1
[phys-100-120:31011] *** End of error message ***
Segmentation fault: 11
———————————
with backtrace

(gdb) backtrace
#0 0x00007fff904efb45 in ?? ()
#1 0x00000001001e9306 in ?? ()
#2 0x00007fff5fbff570 in ?? ()
#3 0x00007fff904efbb7 in ?? ()
#4 0x7c00233130f42e16 in ?? ()
#5 0x00000001001e91e0 in ?? ()
#6 0x00007fff5fbff5a0 in ?? ()
#7 0x000000010002029b in ?? ()
#8 0x0000000000000000 in ?? ()

Putting export HDF5_DEBUG=“” circumvents the problem, but clearly doesn’t solve it. Note that the problem doesn’t show up when linking with mpich.

See https://github.com/TRIQS/triqs/issues/43 and https://github.com/TRIQS/triqs/issues/57 for reference.

Hello Andrey,

Have you tried to change the order of the libraries?

$CXX a.cpp -o b -lhdf5_cpp -lhdf5 -lmpi -lmpi_cxx

Elena

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Jan 28, 2014, at 10:40 AM, Andrey Antipov <andrey.e.antipov@gmail.com> wrote:

Dear all,

The following problem shows up when linking a code with both open-mpi and hdf5 with c++ bindings on. The problem occurs both on mac and linux (tested on ubuntu).
The failing tested combinations are:
openmpi 1.7.3 with hdf5 1.8.12
openmpi 1.7.2 with hdf5 1.8.1

Here’s the simple code, that doesn’t have any hdf5

---------------------------
#include "mpi.h"

int main(int argc, char* argv[])
{
   MPI_Init(&argc, &argv);
   MPI_Finalize();
   return 0;
}

—————————————

Now I link and run it as follows with CXX being clang or g++
$CXX a.cpp -o a -lhdf5 -lmpi -lmpi_cxx
./a

This runs and exits without problems

However, compiling with hdf5_cpp
$CXX a.cpp -o b -lhdf5 -lmpi -lmpi_cxx -lhdf5_cpp
./b
fails and raises an error
-------------------
[phys-100-120:31011] *** Process received signal ***
[phys-100-120:31011] Signal: Segmentation fault: 11 (11)
[phys-100-120:31011] Signal code: Address not mapped (1)
[phys-100-120:31011] Failing at address: 0x1040a8e72
[phys-100-120:31011] [ 0] 2 libsystem_platform.dylib 0x00007fff8f7a35aa _sigtramp + 26
[phys-100-120:31011] [ 1] 3 ??? 0x0000000000000000 0x0 + 0
[phys-100-120:31011] [ 2] 4 libsystem_c.dylib 0x00007fff904efbb7 getenv + 29
[phys-100-120:31011] [ 3] 5 libhdf5.8.dylib 0x0000000103d1c29b H5_init_library + 407
[phys-100-120:31011] [ 4] 6 libhdf5.8.dylib 0x0000000103dde6f1 H5Iget_type + 37
[phys-100-120:31011] [ 5] 7 libhdf5_cpp.8.dylib 0x0000000104043fc3 _ZN2H511IdComponent10p_valid_idEi + 15
[phys-100-120:31011] [ 6] 8 libhdf5_cpp.8.dylib 0x0000000104048ab8 _ZN2H58PropList5closeEv + 24
[phys-100-120:31011] [ 7] 9 libhdf5_cpp.8.dylib 0x00000001040497fd _ZN2H58PropListD2Ev + 31
[phys-100-120:31011] [ 8] 10 libsystem_c.dylib 0x00007fff904ef841 __cxa_finalize + 177
[phys-100-120:31011] [ 9] 11 libsystem_c.dylib 0x00007fff904efaec exit + 22
[phys-100-120:31011] [10] 12 libdyld.dylib 0x00007fff97d54604 start + 8
[phys-100-120:31011] [11] 13 ??? 0x0000000000000001 0x0 + 1
[phys-100-120:31011] *** End of error message ***
Segmentation fault: 11
———————————
with backtrace

(gdb) backtrace
#0 0x00007fff904efb45 in ?? ()
#1 0x00000001001e9306 in ?? ()
#2 0x00007fff5fbff570 in ?? ()
#3 0x00007fff904efbb7 in ?? ()
#4 0x7c00233130f42e16 in ?? ()
#5 0x00000001001e91e0 in ?? ()
#6 0x00007fff5fbff5a0 in ?? ()
#7 0x000000010002029b in ?? ()
#8 0x0000000000000000 in ?? ()

Putting export HDF5_DEBUG=“” circumvents the problem, but clearly doesn’t solve it. Note that the problem doesn’t show up when linking with mpich.

See https://github.com/TRIQS/triqs/issues/43 and https://github.com/TRIQS/triqs/issues/57 for reference.
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org