HDF5 and MinGW

Hi,

I was using HDF5 API on Visual Studio C++ and it worked fine.
I now try to compile a new tutorial project under Eclipse/MinGW and I get
the following issue :

/HDF5/1.8.7/include/H5public.h:133:13: error: conflicting declaration
'typedef int ssize_t'
lib/gcc/mingw32/4.5.2/../../../../include/sys/types.h:118:18: error:
'ssize_t' has a previous declaration as 'typedef _ssize_t ssize_t'/

Do you know if there's a mean to configure HDF5 or Eclipse/MinGW to work
together ?

Thanks,

Yves

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/HDF5-and-MinGW-tp3393676p3393676.html
Sent from the hdf-forum mailing list archive at Nabble.com.

Try the following to see if it works:

Set #define H5_SIZEOF_SSIZE_T to 1 at H5pubconf.h

--pc

···

On 10/4/2011 10:43 AM, rogez wrote:

Hi,

I was using HDF5 API on Visual Studio C++ and it worked fine.
I now try to compile a new tutorial project under Eclipse/MinGW and I get
the following issue :

/HDF5/1.8.7/include/H5public.h:133:13: error: conflicting declaration
'typedef int ssize_t'
lib/gcc/mingw32/4.5.2/../../../../include/sys/types.h:118:18: error:
'ssize_t' has a previous declaration as 'typedef _ssize_t ssize_t'/

Do you know if there's a mean to configure HDF5 or Eclipse/MinGW to work
together ?

Thanks,

Yves

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/HDF5-and-MinGW-tp3393676p3393676.html
Sent from the hdf-forum mailing list archive at Nabble.com.

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

I was just looking at that and here is the block of code in question:

/* Define the ssize_t type if it not is defined */
#if H5_SIZEOF_SSIZE_T==0
/* Undefine this size, we will re-define it in one of the sections below */
#undef H5_SIZEOF_SSIZE_T
#if H5_SIZEOF_SIZE_T==H5_SIZEOF_INT
typedef int ssize_t;
# define H5_SIZEOF_SSIZE_T H5_SIZEOF_INT
#elif H5_SIZEOF_SIZE_T==H5_SIZEOF_LONG
typedef long ssize_t;
# define H5_SIZEOF_SSIZE_T H5_SIZEOF_LONG
#elif H5_SIZEOF_SIZE_T==H5_SIZEOF_LONG_LONG
typedef long long ssize_t;
# define H5_SIZEOF_SSIZE_T H5_SIZEOF_LONG_LONG
#else /* Can't find matching type for ssize_t */
# error "nothing appropriate for ssize_t"
#endif
#endif

The question is why is H5_SIZEOF_SSIZE_T getting set to 0 on MinGW? Does the test fail for some reason on MinGW?

rogez: How did you get the HDF5 library that you are using? Did you compile it yourself? If so how did you "configure" the HDF5 source? With CMake or with the ./configure?

Thanks

···

___________________________________________________________
Mike Jackson Principal Software Engineer
BlueQuartz Software Dayton, Ohio
mike.jackson@bluequartz.net www.bluequartz.net

On Oct 4, 2011, at 11:57 AM, Peter Cao wrote:

Try the following to see if it works:

Set #define H5_SIZEOF_SSIZE_T to 1 at H5pubconf.h

--pc

On 10/4/2011 10:43 AM, rogez wrote:

Hi,

I was using HDF5 API on Visual Studio C++ and it worked fine.
I now try to compile a new tutorial project under Eclipse/MinGW and I get
the following issue :

/HDF5/1.8.7/include/H5public.h:133:13: error: conflicting declaration
'typedef int ssize_t'
lib/gcc/mingw32/4.5.2/../../../../include/sys/types.h:118:18: error:
'ssize_t' has a previous declaration as 'typedef _ssize_t ssize_t'/

Do you know if there's a mean to configure HDF5 or Eclipse/MinGW to work
together ?

Thanks,

Yves

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/HDF5-and-MinGW-tp3393676p3393676.html
Sent from the hdf-forum mailing list archive at Nabble.com.

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

_______________________________________________
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 your quick answers. I'm out of the office at that time but I
will test these things tomorow.

Just to reply to Mike, I didn't compiled HDF5 from sources. I'm on Windows
XP 32 bits and I retrieved the HDF5-1.8.7_CMake_x86_shared.zip file for
win32. Maybe it is not the right one for use with MinGW ?

Yves

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/HDF5-and-MinGW-tp3393676p3394068.html
Sent from the hdf-forum mailing list archive at Nabble.com.

Correct. For MinGW you will need to compile your own version. Those are for Visual Studio only from my estimation.

···

___________________________________________________________
Mike Jackson Principal Software Engineer
BlueQuartz Software Dayton, Ohio
mike.jackson@bluequartz.net www.bluequartz.net

On Oct 4, 2011, at 1:58 PM, rogez wrote:

Thank you for your quick answers. I'm out of the office at that time but I
will test these things tomorow.

Just to reply to Mike, I didn't compiled HDF5 from sources. I'm on Windows
XP 32 bits and I retrieved the HDF5-1.8.7_CMake_x86_shared.zip file for
win32. Maybe it is not the right one for use with MinGW ?

Yves

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/HDF5-and-MinGW-tp3393676p3394068.html
Sent from the hdf-forum mailing list archive at Nabble.com.

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

I've used the MSVC binaries with MinGW in the past without problems. DLL's are binary
compatible as long as they are just C, as is the case with HDF5 (it would not work with
the HDF5 C++ API). However, I'm now also compiling HDF5 with mingw, attached is the
config file that I use with MinGW 32 bit. It is for HDF5 1.8.2, 1.8.7 should be at
least very similar. The compilation flags I use for compiling using mingw32 are:

-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_POSIX_SOURCE -D_BSD_SOURCE \
-UH5_DEBUG_API -D_HDF5DLL_

  Werner

H5pubconf-mingw.h (20.1 KB)

···

On Tue, 04 Oct 2011 20:06:04 +0200, Michael Jackson <mike.jackson@bluequartz.net> wrote:

Correct. For MinGW you will need to compile your own version. Those are for Visual Studio only from my estimation.
___________________________________________________________
Mike Jackson Principal Software Engineer
BlueQuartz Software Dayton, Ohio
mike.jackson@bluequartz.net www.bluequartz.net

On Oct 4, 2011, at 1:58 PM, rogez wrote:

Thank you for your quick answers. I'm out of the office at that time but I
will test these things tomorow.

Just to reply to Mike, I didn't compiled HDF5 from sources. I'm on Windows
XP 32 bits and I retrieved the HDF5-1.8.7_CMake_x86_shared.zip file for
win32. Maybe it is not the right one for use with MinGW ?

Yves

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/HDF5-and-MinGW-tp3393676p3394068.html
Sent from the hdf-forum mailing list archive at Nabble.com.

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

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

--
___________________________________________________________________________
Dr. Werner Benger Visualization Research
Laboratory for Creative Arts and Technology (LCAT)
Center for Computation & Technology at Louisiana State University (CCT/LSU)
211 Johnston Hall, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809 Fax.: +1 225 578-5362

Thanks you very much,

I replaced the h5pubconf.h file with the one you provided and the type
redefinition issue disappeared.

I now get an "undefined reference to "H5Fcreate()"". I'm sure that my
include paths are good but as you said before, my project is set as a C++
one, so it may be the reason for this issue, I presume.

I will probably retry later to run HDF5 over Eclipse/MinGW and C++ (I will
take time to recompile HDF5, but I cannot do that for now). I have to
produce a little sample code which I will develop under VS C++, as a
temporary solution.

(I posted two other questions in the forum which hasn't get solutions, could
you please have a quick look at that ?)

Best regards,

Yves

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/HDF5-and-MinGW-tp3393676p3395787.html
Sent from the hdf-forum mailing list archive at Nabble.com.

Use on MinGW still requires fixing H5pubconf.h after configure in the latest
release. Could autoconf setup be configured to build the H5pubconf.h file
correctly on MinGW? That would be super nice.

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/HDF5-and-MinGW-tp3393676p3723396.html
Sent from the hdf-forum mailing list archive at Nabble.com.

All the HDF5 functions would be declared as "extern C", so it should not
matter if you compile them as C++ or C. Are you compiling as DLL or as
static library? There are different prefixes (windows declspec) depending
on compilier flags, you will need different settings for compiling a DLL
or a static library.

Mostly, HDF5 can be compiled as just a set of C/C++ sources, but there is
this one file that is generated dynamically using H5detect, which is required
to be built as binary first and creates a C code itself that needs to be
part of the library.

  Werner

···

On Wed, 05 Oct 2011 09:22:18 +0200, rogez <yves.rogez@obs.ujf-grenoble.fr> wrote:

Thanks you very much,

I replaced the h5pubconf.h file with the one you provided and the type
redefinition issue disappeared.

I now get an "undefined reference to "H5Fcreate()"". I'm sure that my
include paths are good but as you said before, my project is set as a C++
one, so it may be the reason for this issue, I presume.

I will probably retry later to run HDF5 over Eclipse/MinGW and C++ (I will
take time to recompile HDF5, but I cannot do that for now). I have to
produce a little sample code which I will develop under VS C++, as a
temporary solution.

(I posted two other questions in the forum which hasn't get solutions, could
you please have a quick look at that ?)

Best regards,

Yves

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/HDF5-and-MinGW-tp3393676p3395787.html
Sent from the hdf-forum mailing list archive at Nabble.com.

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

--
___________________________________________________________________________
Dr. Werner Benger Visualization Research
Laboratory for Creative Arts and Technology (LCAT)
Center for Computation & Technology at Louisiana State University (CCT/LSU)
211 Johnston Hall, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809 Fax.: +1 225 578-5362

Hi,

As another user I see this too yet I've got the windows specific settings I need. Depends on which IDE you use but I prefer setting these because I avoid autotools entirely.

I'm using NetBeans (expect Eclipse to be similar) with mingw64 tool collection to set up a netbeans project where it makes all the make files and configurations (can then build with just make if desired) by pointing the project's source to the hdf5 source and headers. When upgrading check for any new settings and update this project. This has been very workable and for me avoids adding a bunch of commands and linux portaging including autotools.

···

On 02/07/2012 01:27 PM, dmergens wrote:

Use on MinGW still requires fixing H5pubconf.h after configure in the latest
release. Could autoconf setup be configured to build the H5pubconf.h file
correctly on MinGW? That would be super nice.

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/HDF5-and-MinGW-tp3393676p3723396.html
Sent from the hdf-forum mailing list archive at Nabble.com.

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

Oups, my apologies, I forgot to change the lib entry from hdf5_cppdll to
hdf5dll when trying to use the C functions.

So HDF5-C works perfectly with Eclipse/MinGW.

Many thanks for your support.

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/HDF5-and-MinGW-tp3393676p3395867.html
Sent from the hdf-forum mailing list archive at Nabble.com.