Short version: has anybody else built C code with libhdf5 on windows, using GCC/MinGW?
Long version:
Hi all, I figure this has been asked before but I'm having trouble searching the list archives. Please forgive my ignorance!
- I've successfully built HDF5 1.8 from source, on Windows using GCC (specifically, using MingW32 tools).
- The utility apps such as h5import.exe, etc, all seem to be working properly, so I know it at least partially worked.
However, I can't build any code that links to libhdf5.a. The include and lib folders are in the right places as far as I can tell, and the simple C test program *compiles* correctly with references to #include "hdf5.h".
But any attempts to link it result in "undefined reference to 'H5Fcreate'" and any other functions I try to call. It just looks like the library isn't being picked up correctly. Even when I explicitly list the library location and name using -L and -l cmdline parameters, it fails.
So, has anybody else built C code with libhdf5 on windows, using GCC? Looking for any insights into what I'm doing wrong here.
This looks similar to a problem that was just fixed. I'm not familiar with MinGW under Cygwin, but using just Cygwin, the libraries would be named *.lib instead of *.a if a valid fortran compiler was not specified (even when not compiling the fortran interface). You can try renaming the libraries to *.a (assuming they're *.lib now), and if that doesn't work, try installing gfortran and "export FC=gfortran".
I hope this helps,
-Neil
···
On 10/05/2009 12:36 PM, Billy Charlton wrote:
Short version: has anybody else built C code with libhdf5 on windows, using GCC/MinGW?
Long version:
Hi all, I figure this has been asked before but I'm having trouble searching the list archives. Please forgive my ignorance!
- I've successfully built HDF5 1.8 from source, on Windows using GCC (specifically, using MingW32 tools).
- The utility apps such as h5import.exe, etc, all seem to be working properly, so I know it at least partially worked.
However, I can't build any code that links to libhdf5.a. The include and lib folders are in the right places as far as I can tell, and the simple C test program *compiles* correctly with references to #include "hdf5.h".
But any attempts to link it result in "undefined reference to 'H5Fcreate'" and any other functions I try to call. It just looks like the library isn't being picked up correctly. Even when I explicitly list the library location and name using -L and -l cmdline parameters, it fails.
So, has anybody else built C code with libhdf5 on windows, using GCC? Looking for any insights into what I'm doing wrong here.
Thanks for the quick
replies. I’m not using Cygwin at all, this is pure MinGW.
It looks like my build didn’t create a .DLL at all, which might be the
problem – I can live with linking to a shared DLL if I can’t get the
.a file to work. Any idea if there’s a ./configure switch enables the
DLL? Or is this symptomatic of a larger build problem?
Billy
Billy Charlton wrote:
···
Short
version: has anybody else built C code with libhdf5 on windows, using
GCC/MinGW?
Long version:
Hi all, I figure this has been asked before but I’m having trouble
searching the list archives. Please forgive my ignorance!
I’ve successfully built HDF5 1.8 from source, on Windows using GCC
(specifically, using MingW32 tools).
The utility apps such as h5import.exe, etc, all seem to be working
properly, so I know it at least partially worked.
However, I can’t build any code that links to libhdf5.a. The include
and lib folders are in the right places as far as I can tell, and the
simple C test program compiles correctly with references to #include
“hdf5.h”.
But any attempts to link it result in “undefined reference to
‘H5Fcreate’” and any other functions I try to call. It just looks like
the library isn’t being picked up correctly. Even when I explicitly
list the library location and name using -L and -l cmdline parameters,
it fails.
So, has anybody else built C code with libhdf5 on windows, using GCC?
Looking for any insights into what I’m doing wrong here.
Thanks for the quick replies. I'm not using Cygwin at all, this is pure MinGW.
It looks like my build didn't create a .DLL at all, which might be the problem -- I can live with linking to a shared DLL if I can't get the .a file to work. Any idea if there's a ./configure switch enables the DLL? Or is this symptomatic of a larger build problem?
Billy
Billy Charlton wrote:
Short version: has anybody else built C code with libhdf5 on windows, using GCC/MinGW?
Long version:
Hi all, I figure this has been asked before but I'm having trouble searching the list archives. Please forgive my ignorance!
- I've successfully built HDF5 1.8 from source, on Windows using GCC (specifically, using MingW32 tools).
- The utility apps such as h5import.exe, etc, all seem to be working properly, so I know it at least partially worked.
However, I can't build any code that links to libhdf5.a. The include and lib folders are in the right places as far as I can tell, and the simple C test program *compiles* correctly with references to #include "hdf5.h".
But any attempts to link it result in "undefined reference to 'H5Fcreate'" and any other functions I try to call. It just looks like the library isn't being picked up correctly. Even when I explicitly list the library location and name using -L and -l cmdline parameters, it fails.
So, has anybody else built C code with libhdf5 on windows, using GCC? Looking for any insights into what I'm doing wrong here.
plus some more, which might not be relevant for you. I'm using HDF5 @ mingw
on a regular basis without problems (using shared libraries/DLL, not as
static library).
Werner
···
On Mon, 05 Oct 2009 19:36:35 +0200, Billy Charlton <billy.charlton@sfcta.org> wrote:
Short version: has anybody else built C code with libhdf5 on windows,
using GCC/MinGW?
Long version:
Hi all, I figure this has been asked before but I'm having trouble
searching the list archives. Please forgive my ignorance!
- I've successfully built HDF5 1.8 from source, on Windows using GCC
(specifically, using MingW32 tools).
- The utility apps such as h5import.exe, etc, all seem to be working
properly, so I know it at least partially worked.
However, I can't build any code that links to libhdf5.a. The include
and lib folders are in the right places as far as I can tell, and the
simple C test program *compiles* correctly with references to #include
"hdf5.h".
But any attempts to link it result in "undefined reference to
'H5Fcreate'" and any other functions I try to call. It just looks like
the library isn't being picked up correctly. Even when I explicitly
list the library location and name using -L and -l cmdline parameters,
it fails.
So, has anybody else built C code with libhdf5 on windows, using GCC?
Looking for any insights into what I'm doing wrong here.
--
___________________________________________________________________________
Dr. Werner Benger <werner@cct.lsu.edu> Visualization Research
Laboratory for Creative Arts and Technology (LCAT)
Center for Computation & Technology at Louisiana State University (CCT/LSU)
239 Johnston Hall, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809 Fax.: +1 225 578-5362
Hm... mixing mingw and cygwin generally is a bad idea and asks for troubles.
I'd highly recommend to keep those separate. Mingw is binary-compatible with
usual Windows libraries, and one can even just use the HDF5 binary distribution
for Visual C or Intel C from within Mingw. With cygwin, this is not possible.
Werner
···
On Mon, 05 Oct 2009 19:55:03 +0200, Neil Fortner <nfortne2@hdfgroup.org> wrote:
Billy,
This looks similar to a problem that was just fixed. I'm not familiar
with MinGW under Cygwin, but using just Cygwin, the libraries would be
named *.lib instead of *.a if a valid fortran compiler was not specified
(even when not compiling the fortran interface). You can try renaming
the libraries to *.a (assuming they're *.lib now), and if that doesn't
work, try installing gfortran and "export FC=gfortran".
I hope this helps,
-Neil
On 10/05/2009 12:36 PM, Billy Charlton wrote:
Short version: has anybody else built C code with libhdf5 on windows,
using GCC/MinGW?
Long version:
Hi all, I figure this has been asked before but I'm having trouble
searching the list archives. Please forgive my ignorance!
- I've successfully built HDF5 1.8 from source, on Windows using GCC
(specifically, using MingW32 tools).
- The utility apps such as h5import.exe, etc, all seem to be working
properly, so I know it at least partially worked.
However, I can't build any code that links to libhdf5.a. The include
and lib folders are in the right places as far as I can tell, and the
simple C test program *compiles* correctly with references to #include
"hdf5.h".
But any attempts to link it result in "undefined reference to
'H5Fcreate'" and any other functions I try to call. It just looks
like the library isn't being picked up correctly. Even when I
explicitly list the library location and name using -L and -l cmdline
parameters, it fails.
So, has anybody else built C code with libhdf5 on windows, using GCC?
Looking for any insights into what I'm doing wrong here.
--
___________________________________________________________________________
Dr. Werner Benger <werner@cct.lsu.edu> Visualization Research
Laboratory for Creative Arts and Technology (LCAT)
Center for Computation & Technology at Louisiana State University (CCT/LSU)
239 Johnston Hall, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809 Fax.: +1 225 578-5362
hm, I'm not sure how well the configure script supports dll's under
mingw, I'm not using it for building the dll from HDF5 in my case.
There is this switch "--enable-shared" which should activate building
HDF5 as shared library, which is a DLL under windows. Once you have a dll
or .a static library, you can use the "nm" tool from mingw to check if
a symbol is defined and exported, it should look like this:
nm hdf5.dll | grep H5Fopen
100bf193 T _H5Fopen
Another possibility is to create a pair of .a and .dll, where the .a file
just contains the symbols as exported by the .dll . In this case, you would
need both a .a file (for linking) and a .dll (for running the executable).
I don't have experience with static hdf5 library build under mingw.
But maybe there is some confusion that some parts think it would be
a DLL, and others don't. Did you check the compilation/linking flags
between the utility applications (which seem to work) and your application?
Werner
···
On Tue, 06 Oct 2009 00:04:20 +0200, Billy Charlton <billy.charlton@sfcta.org> wrote:
(sorry - sent HTML by mistake, resending -Billy)
------
Thanks for the quick replies. I'm not using Cygwin at all, this is pure
MinGW.
It looks like my build didn't create a .DLL at all, which might be the
problem -- I can live with linking to a shared DLL if I can't get the .a
file to work. Any idea if there's a ./configure switch enables the DLL?
Or is this symptomatic of a larger build problem?
Billy
Billy Charlton wrote:
Short version: has anybody else built C code with libhdf5 on windows,
using GCC/MinGW?
Long version:
Hi all, I figure this has been asked before but I'm having trouble
searching the list archives. Please forgive my ignorance!
- I've successfully built HDF5 1.8 from source, on Windows using GCC
(specifically, using MingW32 tools).
- The utility apps such as h5import.exe, etc, all seem to be working
properly, so I know it at least partially worked.
However, I can't build any code that links to libhdf5.a. The include
and lib folders are in the right places as far as I can tell, and the
simple C test program *compiles* correctly with references to #include
"hdf5.h".
But any attempts to link it result in "undefined reference to
'H5Fcreate'" and any other functions I try to call. It just looks
like the library isn't being picked up correctly. Even when I
explicitly list the library location and name using -L and -l cmdline
parameters, it fails.
So, has anybody else built C code with libhdf5 on windows, using GCC?
Looking for any insights into what I'm doing wrong here.
--
___________________________________________________________________________
Dr. Werner Benger <werner@cct.lsu.edu> Visualization Research
Laboratory for Creative Arts and Technology (LCAT)
Center for Computation & Technology at Louisiana State University (CCT/LSU)
239 Johnston Hall, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809 Fax.: +1 225 578-5362
Ahhh I was making this much harder than I realized. Thanks for the msg, you put me on the right track.
I actually didn't have to build HDF5 from scratch to use it with GCC/MinGW. I just downloaded the prebuilt Win32 version which has the includes and the DLL's in it. Linking to that DLL works fine.
Cheers,
Billy
Werner Benger wrote:
···
hm, I'm not sure how well the configure script supports dll's under
mingw, I'm not using it for building the dll from HDF5 in my case.
There is this switch "--enable-shared" which should activate building
HDF5 as shared library, which is a DLL under windows. Once you have a dll
or .a static library, you can use the "nm" tool from mingw to check if
a symbol is defined and exported, it should look like this:
nm hdf5.dll | grep H5Fopen
100bf193 T _H5Fopen
Another possibility is to create a pair of .a and .dll, where the .a file
just contains the symbols as exported by the .dll . In this case, you would
need both a .a file (for linking) and a .dll (for running the executable).
I don't have experience with static hdf5 library build under mingw.
But maybe there is some confusion that some parts think it would be
a DLL, and others don't. Did you check the compilation/linking flags
between the utility applications (which seem to work) and your application?
Werner
On Tue, 06 Oct 2009 00:04:20 +0200, Billy Charlton > <billy.charlton@sfcta.org> wrote:
> (sorry - sent HTML by mistake, resending -Billy)
> ------
>
> Thanks for the quick replies. I'm not using Cygwin at all, this is pure
> MinGW.
>
> It looks like my build didn't create a .DLL at all, which might be the
> problem -- I can live with linking to a shared DLL if I can't get the .a
> file to work. Any idea if there's a ./configure switch enables the DLL?
> Or is this symptomatic of a larger build problem?
>
> Billy
>
> Billy Charlton wrote:
>> Short version: has anybody else built C code with libhdf5 on windows,
>> using GCC/MinGW?
>> Long version:
>>
>> Hi all, I figure this has been asked before but I'm having trouble
>> searching the list archives. Please forgive my ignorance!
>>
>> - I've successfully built HDF5 1.8 from source, on Windows using GCC
>> (specifically, using MingW32 tools).
>>
>> - The utility apps such as h5import.exe, etc, all seem to be working
>> properly, so I know it at least partially worked.
>>
>> However, I can't build any code that links to libhdf5.a. The include
>> and lib folders are in the right places as far as I can tell, and the
>> simple C test program *compiles* correctly with references to #include
>> "hdf5.h".
>>
>> But any attempts to link it result in "undefined reference to
>> 'H5Fcreate'" and any other functions I try to call. It just looks
>> like the library isn't being picked up correctly. Even when I
>> explicitly list the library location and name using -L and -l cmdline
>> parameters, it fails.
>>
>> So, has anybody else built C code with libhdf5 on windows, using GCC?
>> Looking for any insights into what I'm doing wrong here.
>>
>> Cheers,
>> -Billy
>>
>
> _______________________________________________
> 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 <werner@cct.lsu.edu> Visualization Research
Laboratory for Creative Arts and Technology (LCAT)
Center for Computation & Technology at Louisiana State University (CCT/LSU)
239 Johnston Hall, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809 Fax.: +1 225 578-5362
Glad to hear that you can use prebuilt Windows DLL. As far as I remember, no shared libraries can be built for HDF5 under Cygwin or MinGW.
Kent
Billy Charlton wrote:
···
Ahhh I was making this much harder than I realized. Thanks for the msg, you put me on the right track.
I actually didn't have to build HDF5 from scratch to use it with GCC/MinGW. I just downloaded the prebuilt Win32 version which has the includes and the DLL's in it. Linking to that DLL works fine.
Cheers,
Billy
Werner Benger wrote:
hm, I'm not sure how well the configure script supports dll's under
mingw, I'm not using it for building the dll from HDF5 in my case.
There is this switch "--enable-shared" which should activate building
HDF5 as shared library, which is a DLL under windows. Once you have a dll
or .a static library, you can use the "nm" tool from mingw to check if
a symbol is defined and exported, it should look like this:
nm hdf5.dll | grep H5Fopen
100bf193 T _H5Fopen
Another possibility is to create a pair of .a and .dll, where the .a file
just contains the symbols as exported by the .dll . In this case, you would
need both a .a file (for linking) and a .dll (for running the executable).
I don't have experience with static hdf5 library build under mingw.
But maybe there is some confusion that some parts think it would be
a DLL, and others don't. Did you check the compilation/linking flags
between the utility applications (which seem to work) and your application?
Werner
On Tue, 06 Oct 2009 00:04:20 +0200, Billy Charlton >> <billy.charlton@sfcta.org> wrote:
> (sorry - sent HTML by mistake, resending -Billy)
> ------
>
> Thanks for the quick replies. I'm not using Cygwin at all, this is pure
> MinGW.
>
> It looks like my build didn't create a .DLL at all, which might be the
> problem -- I can live with linking to a shared DLL if I can't get the .a
> file to work. Any idea if there's a ./configure switch enables the DLL?
> Or is this symptomatic of a larger build problem?
>
> Billy
>
> Billy Charlton wrote:
>> Short version: has anybody else built C code with libhdf5 on windows,
>> using GCC/MinGW?
>> Long version:
>>
>> Hi all, I figure this has been asked before but I'm having trouble
>> searching the list archives. Please forgive my ignorance!
>>
>> - I've successfully built HDF5 1.8 from source, on Windows using GCC
>> (specifically, using MingW32 tools).
>>
>> - The utility apps such as h5import.exe, etc, all seem to be working
>> properly, so I know it at least partially worked.
>>
>> However, I can't build any code that links to libhdf5.a. The include
>> and lib folders are in the right places as far as I can tell, and the
>> simple C test program *compiles* correctly with references to #include
>> "hdf5.h".
>>
>> But any attempts to link it result in "undefined reference to
>> 'H5Fcreate'" and any other functions I try to call. It just looks
>> like the library isn't being picked up correctly. Even when I
>> explicitly list the library location and name using -L and -l cmdline
>> parameters, it fails.
>>
>> So, has anybody else built C code with libhdf5 on windows, using GCC?
>> Looking for any insights into what I'm doing wrong here.
>>
>> Cheers,
>> -Billy
>>
>
> _______________________________________________
> 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 <werner@cct.lsu.edu> Visualization Research
Laboratory for Creative Arts and Technology (LCAT)
Center for Computation & Technology at Louisiana State University (CCT/LSU)
239 Johnston Hall, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809 Fax.: +1 225 578-5362
A C++ library built with Visual C++ (or anything else that is not MinGW)
cannot be used from MinGW (which includes the HDF5 C++ interface), but
as long as it's a C library (such as HDF5 itself), it can be used from MinGW.
With cygwin, you can't use DLL's in any case (as far as I know).
It's not much of a problem to also compile HDF5 under MinGW into a DLL,
but it seems the configure script that comes with HDF5 doesn't support this.
Werner
···
On Wed, 07 Oct 2009 15:43:50 +0200, MuQun Yang <myang6@hdfgroup.org> wrote:
Glad to hear that you can use prebuilt Windows DLL. As far as I
remember, no shared libraries can be built for HDF5 under Cygwin or MinGW.
Kent
Billy Charlton wrote:
Ahhh I was making this much harder than I realized. Thanks for the
msg, you put me on the right track.
I actually didn't have to build HDF5 from scratch to use it with
GCC/MinGW. I just downloaded the prebuilt Win32 version which has the
includes and the DLL's in it. Linking to that DLL works fine.
Cheers,
Billy
Werner Benger wrote:
hm, I'm not sure how well the configure script supports dll's under
mingw, I'm not using it for building the dll from HDF5 in my case.
There is this switch "--enable-shared" which should activate building
HDF5 as shared library, which is a DLL under windows. Once you have a
dll
or .a static library, you can use the "nm" tool from mingw to check if
a symbol is defined and exported, it should look like this:
nm hdf5.dll | grep H5Fopen
100bf193 T _H5Fopen
Another possibility is to create a pair of .a and .dll, where the .a
file
just contains the symbols as exported by the .dll . In this case, you
would
need both a .a file (for linking) and a .dll (for running the
executable).
I don't have experience with static hdf5 library build under mingw.
But maybe there is some confusion that some parts think it would be
a DLL, and others don't. Did you check the compilation/linking flags
between the utility applications (which seem to work) and your
application?
Werner
On Tue, 06 Oct 2009 00:04:20 +0200, Billy Charlton >>> <billy.charlton@sfcta.org> wrote:
> (sorry - sent HTML by mistake, resending -Billy)
> ------
>
> Thanks for the quick replies. I'm not using Cygwin at all, this is
pure
> MinGW.
>
> It looks like my build didn't create a .DLL at all, which might be the
> problem -- I can live with linking to a shared DLL if I can't get
the .a
> file to work. Any idea if there's a ./configure switch enables the
DLL?
> Or is this symptomatic of a larger build problem?
>
> Billy
>
> Billy Charlton wrote:
>> Short version: has anybody else built C code with libhdf5 on
windows,
>> using GCC/MinGW?
>> Long version:
>>
>> Hi all, I figure this has been asked before but I'm having trouble
>> searching the list archives. Please forgive my ignorance!
>>
>> - I've successfully built HDF5 1.8 from source, on Windows using GCC
>> (specifically, using MingW32 tools).
>>
>> - The utility apps such as h5import.exe, etc, all seem to be working
>> properly, so I know it at least partially worked.
>>
>> However, I can't build any code that links to libhdf5.a. The include
>> and lib folders are in the right places as far as I can tell, and the
>> simple C test program *compiles* correctly with references to #include
>> "hdf5.h".
>>
>> But any attempts to link it result in "undefined reference to
>> 'H5Fcreate'" and any other functions I try to call. It just looks
>> like the library isn't being picked up correctly. Even when I
>> explicitly list the library location and name using -L and -l cmdline
>> parameters, it fails.
>>
>> So, has anybody else built C code with libhdf5 on windows, using GCC?
>> Looking for any insights into what I'm doing wrong here.
>>
>> Cheers,
>> -Billy
>>
>
> _______________________________________________
> 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 <werner@cct.lsu.edu> Visualization
Research
Laboratory for Creative Arts and Technology (LCAT)
Center for Computation & Technology at Louisiana State University
(CCT/LSU)
239 Johnston Hall, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809 Fax.: +1 225 578-5362
--
___________________________________________________________________________
Dr. Werner Benger <werner@cct.lsu.edu> Visualization Research
Laboratory for Creative Arts and Technology (LCAT)
Center for Computation & Technology at Louisiana State University (CCT/LSU)
239 Johnston Hall, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809 Fax.: +1 225 578-5362