compile on CentOS with hdf5-1.6.10

Dear All,

I have encountered a compiling problem with HDF5-1.6.10 on CentOS Linux. I am a novice with installation/compilation of HDF5 library on Linux and would appreciate anyone to point out possible loopholes.

I simply got the binary *_5-1.6.10-linux-x86_64-static.tar.gz_* and "tar xvf" to a local directory. Then I tried to compile one example as

$g++ -I../../include create.cpp -L../../lib -lhdf5_cpp

and received a long list of error messages listed below. It appears to be a linking problem as the code compiles. I also tried the following command and received the similar linking error.

$g++ -I../../include create.cpp -L../../lib -L/usr/lib64 -lhdf5_cpp -lz

Thank you for any feedback in advance.

···

===========================================
/tmp/ccgpNQEE.o: In function `main':
create.cpp:(.text+0x1cf): undefined reference to `H5check_version'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::getMajorString(H5E_major_t) const':
H5Exception.cpp:(.text+0xfb): undefined reference to `H5Eget_major'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::getMinorString(H5E_minor_t) const':
H5Exception.cpp:(.text+0x12b): undefined reference to `H5Eget_minor'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::printError(_IO_FILE*) const':
H5Exception.cpp:(.text+0xe37): undefined reference to `H5Eprint'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::walkErrorStack(H5E_direction_t, int (*)(int, H5E_error_t*, void*), void*)'\
:
H5Exception.cpp:(.text+0xfc4): undefined reference to `H5Ewalk'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::clearErrorStack()':
H5Exception.cpp:(.text+0x1154): undefined reference to `H5Eclear'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::getAutoPrint(int (*&)(void*), void**)':

--
Sincerely yours,

Kevin Guangran Zhu (PhD Candidate)
Computational Electromagnetics Lab
McGill University
Montreal, Canada
Tel: 1-514-398-1533

Dear Guangran,

You need to link with the HDF5 C library too. Please add -lhdf5 after -lhdf5_cpp.

You may also use h5c++ script (found in the bin directory of the download distribution) as following

h5c++ create.cpp

In order to use compiler script h5c++, you will need to modify the script (it is a text file) to point to the directory where HDF5 libraries are installed on your system. (We are working on improving our binaries distributions, but at this moment, script modification is required, sorry ;-( )

Elena

···

On Feb 8, 2010, at 11:06 PM, Guangran Zhu wrote:

Dear All,

I have encountered a compiling problem with HDF5-1.6.10 on CentOS Linux. I am a novice with installation/compilation of HDF5 library on Linux and would appreciate anyone to point out possible loopholes.

I simply got the binary *_5-1.6.10-linux-x86_64-static.tar.gz_* and "tar xvf" to a local directory. Then I tried to compile one example as

$g++ -I../../include create.cpp -L../../lib -lhdf5_cpp

and received a long list of error messages listed below. It appears to be a linking problem as the code compiles. I also tried the following command and received the similar linking error.

$g++ -I../../include create.cpp -L../../lib -L/usr/lib64 -lhdf5_cpp -lz

Thank you for any feedback in advance.

===========================================
/tmp/ccgpNQEE.o: In function `main':
create.cpp:(.text+0x1cf): undefined reference to `H5check_version'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::getMajorString(H5E_major_t) const':
H5Exception.cpp:(.text+0xfb): undefined reference to `H5Eget_major'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::getMinorString(H5E_minor_t) const':
H5Exception.cpp:(.text+0x12b): undefined reference to `H5Eget_minor'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::printError(_IO_FILE*) const':
H5Exception.cpp:(.text+0xe37): undefined reference to `H5Eprint'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::walkErrorStack(H5E_direction_t, int (*)(int, H5E_error_t*, void*), void*)'\
:
H5Exception.cpp:(.text+0xfc4): undefined reference to `H5Ewalk'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::clearErrorStack()':
H5Exception.cpp:(.text+0x1154): undefined reference to `H5Eclear'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::getAutoPrint(int (*&)(void*), void**)':

--
Sincerely yours,

Kevin Guangran Zhu (PhD Candidate)
Computational Electromagnetics Lab
McGill University
Montreal, Canada
Tel: 1-514-398-1533

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Thank you for helping out. I used to work with hdf5-1.6.5, which solely needs the lhdf5_cpp. That solves the problem.

I could compile on CentOS with the follow command in case anyone is interested:

g++ -I../../include create.cpp -L../../lib -L/home/kevin.zhu/szip2.0-amd-enc/lib -lhdf5_cpp -lhdf5 -lsz -lz

Elena Pourmal wrote:

···

Dear Guangran,

You need to link with the HDF5 C library too. Please add -lhdf5 after -lhdf5_cpp.

You may also use h5c++ script (found in the bin directory of the download distribution) as following

h5c++ create.cpp

In order to use compiler script h5c++, you will need to modify the script (it is a text file) to point to the directory where HDF5 libraries are installed on your system. (We are working on improving our binaries distributions, but at this moment, script modification is required, sorry ;-( )

Elena

On Feb 8, 2010, at 11:06 PM, Guangran Zhu wrote:

Dear All,

I have encountered a compiling problem with HDF5-1.6.10 on CentOS Linux. I am a novice with installation/compilation of HDF5 library on Linux and would appreciate anyone to point out possible loopholes.

I simply got the binary *_5-1.6.10-linux-x86_64-static.tar.gz_* and "tar xvf" to a local directory. Then I tried to compile one example as

$g++ -I../../include create.cpp -L../../lib -lhdf5_cpp

and received a long list of error messages listed below. It appears to be a linking problem as the code compiles. I also tried the following command and received the similar linking error.

$g++ -I../../include create.cpp -L../../lib -L/usr/lib64 -lhdf5_cpp -lz

Thank you for any feedback in advance.

===========================================
/tmp/ccgpNQEE.o: In function `main':
create.cpp:(.text+0x1cf): undefined reference to `H5check_version'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::getMajorString(H5E_major_t) const':
H5Exception.cpp:(.text+0xfb): undefined reference to `H5Eget_major'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::getMinorString(H5E_minor_t) const':
H5Exception.cpp:(.text+0x12b): undefined reference to `H5Eget_minor'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::printError(_IO_FILE*) const':
H5Exception.cpp:(.text+0xe37): undefined reference to `H5Eprint'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::walkErrorStack(H5E_direction_t, int (*)(int, H5E_error_t*, void*), void*)'\
:
H5Exception.cpp:(.text+0xfc4): undefined reference to `H5Ewalk'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::clearErrorStack()':
H5Exception.cpp:(.text+0x1154): undefined reference to `H5Eclear'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::getAutoPrint(int (*&)(void*), void**)':

--
Sincerely yours,

Kevin Guangran Zhu (PhD Candidate)
Computational Electromagnetics Lab
McGill University
Montreal, Canada
Tel: 1-514-398-1533

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

--
Sincerely yours,

Kevin Guangran Zhu (PhD Candidate)
Computational Electromagnetics Lab
McGill University
Montreal, Canada
Tel: 1-514-398-1533

Glad it worked!

Thank you for helping out. I used to work with hdf5-1.6.5, which solely needs the lhdf5_cpp. That solves the problem.

Impossible :slight_smile: You probably had hdf5 library somewhere in your path.

Elena

···

On Feb 9, 2010, at 11:31 PM, Guangran Zhu wrote:

I could compile on CentOS with the follow command in case anyone is interested:

g++ -I../../include create.cpp -L../../lib -L/home/kevin.zhu/szip2.0-amd-enc/lib -lhdf5_cpp -lhdf5 -lsz -lz

Elena Pourmal wrote:

Dear Guangran,
You need to link with the HDF5 C library too. Please add -lhdf5 after -lhdf5_cpp.
You may also use h5c++ script (found in the bin directory of the download distribution) as following
h5c++ create.cpp
In order to use compiler script h5c++, you will need to modify the script (it is a text file) to point to the directory where HDF5 libraries are installed on your system. (We are working on improving our binaries distributions, but at this moment, script modification is required, sorry ;-( )
Elena
On Feb 8, 2010, at 11:06 PM, Guangran Zhu wrote:

Dear All,

I have encountered a compiling problem with HDF5-1.6.10 on CentOS Linux. I am a novice with installation/compilation of HDF5 library on Linux and would appreciate anyone to point out possible loopholes.

I simply got the binary *_5-1.6.10-linux-x86_64-static.tar.gz_* and "tar xvf" to a local directory. Then I tried to compile one example as

$g++ -I../../include create.cpp -L../../lib -lhdf5_cpp

and received a long list of error messages listed below. It appears to be a linking problem as the code compiles. I also tried the following command and received the similar linking error.

$g++ -I../../include create.cpp -L../../lib -L/usr/lib64 -lhdf5_cpp -lz

Thank you for any feedback in advance.

===========================================
/tmp/ccgpNQEE.o: In function `main':
create.cpp:(.text+0x1cf): undefined reference to `H5check_version'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::getMajorString(H5E_major_t) const':
H5Exception.cpp:(.text+0xfb): undefined reference to `H5Eget_major'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::getMinorString(H5E_minor_t) const':
H5Exception.cpp:(.text+0x12b): undefined reference to `H5Eget_minor'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::printError(_IO_FILE*) const':
H5Exception.cpp:(.text+0xe37): undefined reference to `H5Eprint'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::walkErrorStack(H5E_direction_t, int (*)(int, H5E_error_t*, void*), void*)'\
:
H5Exception.cpp:(.text+0xfc4): undefined reference to `H5Ewalk'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::clearErrorStack()':
H5Exception.cpp:(.text+0x1154): undefined reference to `H5Eclear'
../../lib/libhdf5_cpp.a(H5Exception.o): In function `H5::Exception::getAutoPrint(int (*&)(void*), void**)':

--
Sincerely yours,

Kevin Guangran Zhu (PhD Candidate)
Computational Electromagnetics Lab
McGill University
Montreal, Canada
Tel: 1-514-398-1533

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

--
Sincerely yours,

Kevin Guangran Zhu (PhD Candidate)
Computational Electromagnetics Lab
McGill University
Montreal, Canada
Tel: 1-514-398-1533