undefined reference during linking with 1.8.9

Hello,

I try to use HDF under Cygwin. I have downloaded HDF 5 version 1.8.9, run configure, make, make install and now I try to link my program.
The make call builds only *.a files and I get the linker error:

/cygdrive/c/opt/library/hdf/5-1.8.9/lib/libhdf5_cpp.a(H5File.o):H5File.cpp:(.tex
t+0x2026): undefined reference to `_H5Rget_obj_type1'

/cygdrive/c/opt/library/hdf/5-1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o):H5CommonFG.c
pp:(.text+0x576): undefined reference to `_H5Dcreate2'

/cygdrive/c/opt/library/hdf/5-1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o):H5CommonFG.c
pp:(.text+0x6fd): undefined reference to `_H5Dopen2'

/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: /cygdrive/c
/opt/library/hdf/5-1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o): bad reloc address 0x4
in section `.rdata$_ZTVN2H58CommonFGE[vtable for H5::CommonFG]'

On the linker command I have added the -lhdf5 and -lhdf5_cpp, the same calls under Linux and OSX works and the make script creates also dynamic libraries (*.so and *.dylib).

Can me anybody help to solve the problem?

Thanks

Phil

Hello,

I try to use HDF under Cygwin. I have downloaded HDF 5 version 1.8.9, run configure, make, make install and now I try to link my program.
The make call builds only *.a files and I get the linker error:

hdf5-1.8.9 is already available as cygwin package, any reason
to not use it ?

/cygdrive/c/opt/library/hdf/5-1.8.9/lib/libhdf5_cpp.a(H5File.o):H5File.cpp:(.tex
t+0x2026): undefined reference to `_H5Rget_obj_type1'

/cygdrive/c/opt/library/hdf/5-1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o):H5CommonFG.c
pp:(.text+0x576): undefined reference to `_H5Dcreate2'

/cygdrive/c/opt/library/hdf/5-1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o):H5CommonFG.c
pp:(.text+0x6fd): undefined reference to `_H5Dopen2'

/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: /cygdrive/c
/opt/library/hdf/5-1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o): bad reloc address 0x4
in section `.rdata$_ZTVN2H58CommonFGE[vtable for H5::CommonFG]'

On the linker command I have added the -lhdf5 and -lhdf5_cpp, the same calls under

Linux and OSX works and the make script creates also dynamic libraries (*.so and *.dylib).

Can me anybody help to solve the problem?

Thanks

Phil

undefined reference on windows platforms can be caused by the
order of linking, can you show the linking command ?

Regards
Marco

···

On 6/23/2012 9:31 PM, Kraus Philipp wrote:

Hi Phil,

Please try putting -lhdf5_cpp and -lhdf5 in this order, if you haven't.

Binh-Minh

···

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-
bounces@hdfgroup.org] On Behalf Of Kraus Philipp
Sent: Saturday, June 23, 2012 3:31 PM
To: HDF Discussion List Users
Subject: [Hdf-forum] undefined reference during linking with 1.8.9

Hello,

I try to use HDF under Cygwin. I have downloaded HDF 5 version 1.8.9, run
configure, make, make install and now I try to link my program.
The make call builds only *.a files and I get the linker error:

/cygdrive/c/opt/library/hdf/5-
1.8.9/lib/libhdf5_cpp.a(H5File.o):H5File.cpp:(.tex
t+0x2026): undefined reference to `_H5Rget_obj_type1'

/cygdrive/c/opt/library/hdf/5-
1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o):H5CommonFG.c
pp:(.text+0x576): undefined reference to `_H5Dcreate2'

/cygdrive/c/opt/library/hdf/5-
1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o):H5CommonFG.c
pp:(.text+0x6fd): undefined reference to `_H5Dopen2'

/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld:
/cygdrive/c
/opt/library/hdf/5-1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o): bad reloc address
0x4
in section `.rdata$_ZTVN2H58CommonFGE[vtable for H5::CommonFG]'

On the linker command I have added the -lhdf5 and -lhdf5_cpp, the same
calls under Linux and OSX works and the make script creates also dynamic
libraries (*.so and *.dylib).

Can me anybody help to solve the problem?

Thanks

Phil

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

--
Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.0/1778 - Release Date: 11/9/2008
2:14 PM

Currently, I think that configure will not build shared libs on cygwin, and should display a message. So first be sure that you are building static.

Allen

···

On Saturday, June 23, 2012 10:50:11 PM marco atzeri wrote:

On 6/23/2012 9:31 PM, Kraus Philipp wrote:
> Hello,
>
> I try to use HDF under Cygwin. I have downloaded HDF 5 version 1.8.9, run configure, make, make install and now I try to link my program.
> The make call builds only *.a files and I get the linker error:

hdf5-1.8.9 is already available as cygwin package, any reason
to not use it ?

>
> /cygdrive/c/opt/library/hdf/5-1.8.9/lib/libhdf5_cpp.a(H5File.o):H5File.cpp:(.tex
> t+0x2026): undefined reference to `_H5Rget_obj_type1'
>
> /cygdrive/c/opt/library/hdf/5-1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o):H5CommonFG.c
> pp:(.text+0x576): undefined reference to `_H5Dcreate2'
>
> /cygdrive/c/opt/library/hdf/5-1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o):H5CommonFG.c
> pp:(.text+0x6fd): undefined reference to `_H5Dopen2'
>
> /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: /cygdrive/c
> /opt/library/hdf/5-1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o): bad reloc address 0x4
> in section `.rdata$_ZTVN2H58CommonFGE[vtable for H5::CommonFG]'
>
> On the linker command I have added the -lhdf5 and -lhdf5_cpp, the same calls under

Linux and OSX works and the make script creates also dynamic libraries
(*.so and *.dylib).

>
> Can me anybody help to solve the problem?
>
> Thanks
>
> Phil
>

undefined reference on windows platforms can be caused by the
order of linking, can you show the linking command ?

Regards
Marco

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

Hi Allen

as package maintainer for cygwin, I can assure you that shared
libs on cygwin are possible and are available by long time:

http://cygwin.com/ml/cygwin-announce/2008-06/msg00006.html
http://cygwin.com/ml/cygwin-announce/2012-05/msg00028.html

I think Kraus should use the available package, instead
of building the package by himself

Regards
Marco

···

On 6/25/2012 3:21 PM, Allen D Byrne wrote:

Currently, I think that configure will not build shared libs on cygwin, and should display a message.

> So first be sure that you are building static.

Allen

Marco,

I agree with you. I just don't remember if the script was updated.
I need to double check the published configure script though, I am always willing to consider patches to the make systems.

Allen

···

On Monday, June 25, 2012 03:34:20 PM marco atzeri wrote:

On 6/25/2012 3:21 PM, Allen D Byrne wrote:
> Currently, I think that configure will not build shared libs on cygwin, and should display a message.
> So first be sure that you are building static.
>
> Allen
>
Hi Allen

as package maintainer for cygwin, I can assure you that shared
libs on cygwin are possible and are available by long time:

http://cygwin.com/ml/cygwin-announce/2008-06/msg00006.html
http://cygwin.com/ml/cygwin-announce/2012-05/msg00028.html

I think Kraus should use the available package, instead
of building the package by himself

Regards
Marco

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

Hi Allen
starting from version 1.8.8, I have no need to patch the source anymore.

The cygwin binary package is build with

···

On 6/25/2012 4:23 PM, Allen D Byrne wrote:

Marco,

I agree with you. I just don't remember if the script was updated.
I need to double check the published configure script though, I am always willing to consider patches to the make systems.

Allen
On Monday, June 25, 2012 03:34:20 PM marco atzeri wrote:

On 6/25/2012 3:21 PM, Allen D Byrne wrote:

Currently, I think that configure will not build shared libs on cygwin, and should display a message.

  > So first be sure that you are building static.

Allen

Hi Allen

as package maintainer for cygwin, I can assure you that shared
libs on cygwin are possible and are available by long time:

http://cygwin.com/ml/cygwin-announce/2008-06/msg00006.html
http://cygwin.com/ml/cygwin-announce/2012-05/msg00028.html

I think Kraus should use the available package, instead
of building the package by himself

Regards
Marco

--------------------------------------------------------------
autoreconf
configure --with-zlib \
           --with-gnu-ld \
           --enable-shared \
           --enable-threadsafe \
           --with-pthread \
           LDFLAGS=-no-undefined
# hack to bypass wrong libtool detection
sed -e "1,100s/^build_libtool_libs=no/build_libtool_libs=yes/" -i libtool
make
--------------------------------------------------------------

I am not sure if "LDFLAGS=-no-undefined" is still needed or
is an heritage of the past. Same for the libtool hack

No time for experiments in these days

Regards
Marco