Re: [netcdfgroup] [Hdf-forum] netCDF-C 4.3.1-RC5 Available - buildHDF4 in Windows

I tried to build HDF4 using Cmake instead, no problems here.

Good to know that the syntax for zlib and szip is the same as for netCDF

cmake -C ../config/cmake/cacheinit.cmake
-D"JPEG_INCLUDE_DIR:PATH=I:\hdf4_explorer\hdf\jpeg"
-D"JPEG_LIBRARY:FILEPATH=I:\hdf4_explorer\windows\jpeg\Debug\jpeg.lib"
-D"ZLIB_INCLUDE_DIR:PATH=I:\zlib-1.2.5"
-D"ZLIB_LIBRARY:FILEPATH=I:\zlib-1.2.5\build\bin\Debug\libzlib_D.lib"
-D"SZIP_INCLUDE_DIR:PATH=I:\szip-2.1\src"
-D"SZIP_LIBRARY:FILEPATH=I:\szip-2.1\build\bin\Debug\libszip_D.lib"  ..

To build, I modified /config/cacheinit.cmake

so that

SET (BUILD_SHARED_LIBS OFF CACHE BOOL "Build Shared Libraries" FORCE)

changed ON to OFF

SET (HDF4_BUILD_FORTRAN OFF CACHE BOOL "Build FORTRAN support" FORCE)

changed ON to OFF

SET (HDF4_ENABLE_NETCDF OFF CACHE BOOL "Build HDF4 versions of NetCDF-3 APIS" FORCE)

changed ON to OFF

This last one being the flag that enables a "netCDF compatible" build, I think, please let me know if not


Just one small thing that could be done is to allow the generation of Microsoft static CRT (no DLLs, we've been here before :-) ), like HDF5 and netCDF now do

My workaround was to add this code to CMakeLists.txt, like I did for HDF5 before the introduction of static CRT

IF (WIN32)
 FOREACH (MODE "_DEBUG" "_MINSIZEREL" "_RELEASE" "_RELWITHDEBINFO")
   STRING(REPLACE "/MD" "/MT" TMP "${CMAKE_C_FLAGS${MODE}}")
   SET(CMAKE_C_FLAGS${MODE} "${TMP}" CACHE STRING "" FORCE)
   MESSAGE(STATUS "C_${MODE}=${CMAKE_C_FLAGS${MODE}}")
   STRING(REPLACE "/MD" "/MT" TMP "${CMAKE_CXX_FLAGS${MODE}}")
   SET(CMAKE_CXX_FLAGS${MODE} "${TMP}" CACHE STRING "" FORCE)
   MESSAGE(STATUS "CXX_${MODE}=${CMAKE_CXX_FLAGS${MODE}}")
 ENDFOREACH (MODE)
ENDIF (WIN32)



So, I think this takes care of the HDF4 part.

Now, regarding , netCDF, the same issue arises due to the fact the HDF4 headers for 'mfhdf' and 'hdf' libraries are in different places,
and the netCDF flags allow only for one header location

I used for the netCDF CMake build the locations of the HDF4 built above

-D"MFHDF_H_INCLUDE_DIR=I:\hdf-4.2.9\mfhdf\libsrc"
-D"HDF4_DF_LIB=I:\hdf-4.2.9\build\bin\Debug\hdfd.lib"
-D"HDF4_MFHDF_LIB=I:\hdf-4.2.9\build\bin\Debug\mfhdfd.lib"


the HDF4 mfhdf.h includes this section

/* change this back if it causes problems on other machines than the Alhpa-QAK */
/* Reverse back to the previous way. AKC */
#include "hdf.h"
#ifdef H4_HAVE_NETCDF
#include "netcdf.h"
#else
#include "hdf4_netcdf.h"
#endif

where the switch between different "netcdf.h" headers is made depending on H4_HAVE_NETCDF

One solution to solve the different header location is to copy all the HDF4 header files regarding the 'hdf' library to the location of the 'mfhdf' library, that I did

the netCDF Cmake generation went fine, but building I have compiling errors due to un-recognized symbols, for example

2>..\..\libsrc4\nc4type.c(29): error C2059: syntax error : 'constant'

NC4_inq_type_equal(int ncid1, nc_type typeid1, int ncid2,
   nc_type typeid2, int *equalp)
{
  NC_GRP_INFO_T *grp1, *grp2;


so, it seems that something is still missing here

------------
pvicente@xxxxxxx
Department of Earth System Science
3200 Croul Hall
University of California, Irvine
Irvine, CA 92697-3100




----- Original Message ----- From: "Pedro Vicente" <pvicente@xxxxxxx> To: "HDF Users Discussion List" <hdf-forum@xxxxxxxxxxxxxxxxxx>; <netcdfgroup@xxxxxxxxxxxxxxxx>; "Ward Fisher" <wfisher@xxxxxxxxxxxxxxxx>
Sent: Tuesday, December 10, 2013 11:25 PM
Subject: Re: [Hdf-forum] [netcdfgroup] netCDF-C 4.3.1-RC5 Available - buildHDF4 in Windows


Elena , Binh-Minh, I am going to need your help on this, since I am having trouble building the HDF4 library in a way that netCDF accepts it.

I just realized that the HDF4 version I was using was version 4.2.1 (circa year 1998) and the current version 4.2.9 has this symbol in h4config.h


/* Define if we support HDF NetCDF-3 APIs */
//#define H4_HAVE_NETCDF 1

So I am guessing here that this must be commented in the HDF4 build, so that netCDF accepts the HDF4 library without conflicts.

Is this the case?

There are 2 ways to build HDF4 in Windows:

1) Use the supplied Visual Studio projects
2) Use Cmake to generate Visual Studio projects

I tried 1)

"hdf" and "mfhdf" build fine
The current distro does not include the jpeg source. It should.
I had the jpeg source from version 4.2.1, so I can use that, no problem here.

This was done with

//#define H4_HAVE_NETCDF 1

commented , but I still have the same netCDF errors as in the last email.


So, assuming that the above build was done as it should, I am guessing here that the root of the problem is this symbol,
used by CMake of netCDF to detect "a"  HDF4 header location.

-D"MFHDF_H_INCLUDE_DIR=I:\hdf4-4.2.9-bin\include"

That I assume must include all the HDF4 headers.

Is this correct?

I tried to use

I:\hdf4-4.2.9-bin\include"

this place includes *all* the HDF4 headers, since this is a binary distribution (I use only the headers, not the libs)


This because the HDF5 *source* header locations includes 'mfhdf.h' and 'h4config.h' in different places.


I realize that this setting is a bit unusual (using source locations for the headers), but as a developer, binary distributions are totally useless for me , so
it would be great if anyone could come up with some fix for this

thanks

ps

these are the errors I get while compiling "netcdf4" from the generated CMake Visual Studio

2>J:\netcdf-c-4.3.1-rc5\include\netcdf_f.h(16): error C2054: expected '(' to follow 'EXTERNL' 2>J:\netcdf-c-4.3.1-rc5\include\netcdf_f.h(16): error C2085: 'nc_inq_var_chunking_ints' : not in formal parameter list 2>J:\netcdf-c-4.3.1-rc5\include\netcdf_f.h(18): error C2061: syntax error : identifier 'EXTERNL' 2>J:\netcdf-c-4.3.1-rc5\include\netcdf_f.h(22): error C2054: expected '(' to follow 'EXTERNL' 2>J:\netcdf-c-4.3.1-rc5\include\netcdf_f.h(23): error C2085: 'nc_open_par_fortran' : not in formal parameter list

[EDIT]

on closer look , these errors are actually different from the one from my first email

I:\hdf4_explorer\mfhdf\libsrc\netcdf.h(25): fatal error C1083: Cannot open
include file: 'hdfi.h': No such file or directory

so, it seems, that is solved, and this is another issue



----------------------
Pedro Vicente
pedro.vicente@xxxxxxxxxxxxxxxxxx
http://www.space-research.org/






----- Original Message ----- From: "Pedro Vicente" <pvicente@xxxxxxx> To: <netcdfgroup@xxxxxxxxxxxxxxxx>; "Ward Fisher" <wfisher@xxxxxxxxxxxxxxxx>
Cc: "HDF Users Discussion List" <hdf-forum@xxxxxxxxxxxxxxxxxx>
Sent: Tuesday, December 10, 2013 8:41 PM
Subject: Re: [Hdf-forum] [netcdfgroup] netCDF-C 4.3.1-RC5 Available


Hi Ward

It seems there is still an issue with the CMake HDF4 settings.
This is for Windows

In my case I used

-D"MFHDF_H_INCLUDE_DIR=I:\hdf4_explorer\mfhdf\libsrc"
-D"HDF4_DF_LIB=I:\hdf4_explorer\windows\lib\debug\singlethreaded\hd421d.lib"
-D"HDF4_MFHDF_LIB=I:\hdf4_explorer\windows\lib\debug\singlethreaded\hm421d.lib"

The Cmake generation went fine.

But when I try to build the generated Visual Studio 2010 solution , I get this error


I:\hdf4_explorer\mfhdf\libsrc\netcdf.h(25): fatal error C1083: Cannot open include file: 'hdfi.h': No such file or directory


The file <HDF4 root>\mfhdf\libsrc\netcdf.h

is part of the HDF4 distribution.

There are 2 distinct HDF4 libraries, each one with their different locations and header files.

In the Unix world , I believe when doing

make install

all these headers are copied to the same place.

But this is not necessarily true in Windows. One can just specify any location for the headers.


I tried to copy 'hdfi.h' to the same location that 'mfhdf.h' is located , but then I get a multitude of errors in netCDF, either unknown or duplicated symbols, due to the fact that the 'netcdf.h'
used is the one from the HDF4 distribution.

I am not really sure how to solve this.

Maybe copy all the HDF4 headers (which ones?) to one place , omitting the netcdf.h from HDF4 ?

For the autoconf build of HDF4 and netCDF, when enabling HDF4, there are these flags

for HDF4

 --disable-netcdf

"to prevent it from building an HDF4 version of the netCDF-2 library that conflicts with the netCDF-2 functions that are built into the Unidata netCDF library."

and for netCDF

--enable-hdf4

http://www.unidata.ucar.edu/software/netcdf/docs/build_hdf4.html

so, it's my understanding that these flags must define some macros in the code of the *two* libraries (HDF4 and netCDF) that compile some parts of the code and not others.

Is this the case?

If yes, then maybe setting these macros manually in Windows should do.


Thanks

Pedro

------------
pvicente@xxxxxxx
Department of Earth System Science
3200 Croul Hall
University of California, Irvine
Irvine, CA 92697-3100







----- Original Message ----- From: "Ward Fisher" <wfisher@xxxxxxxxxxxxxxxx>
To: <netcdfgroup@xxxxxxxxxxxxxxxx>
Sent: Friday, December 06, 2013 11:27 AM
Subject: [netcdfgroup] netCDF-C 4.3.1-RC5 Available


Hello all,

The netCDF-C libraries 4.3.1-r5 are now available.

Highlights of this release beyond the previous release candidate include:

* Fixed netCDF-4 failure when renaming a dimension and renaming a variable using that dimension, in either order. NCF-177 * Fixed bug in ncgen; it was not properly filling empty string constants ("") to be the proper length. NCF-279 * Fixed bug in ncgen where it was interpreting int64 constants as uint64 constants. NCF-278* When opening a netCDF-4 file, streamline the iteration over objects in the underlying HDF5 file. * Fixed bug in handling Http Basic Authorization. The code was actually there but was not being executed. NCF-277 * When compiling with hdf4 support, both autotools and cmake-based builds now properly look for the libjpeg dependency and will link against it when found (or complain if it's not). Also added ENABLE_HDF4_FILE_TESTS option to CMake-based builds.

Complete release notes may be found at:

http://www.unidata.ucar.edu/software/netcdf/docs_rc/release_notes.html

Source-code zip and tar.gz archives can be found at:

* http://github.com/Unidata/netcdf-c/releases/tag/v4.3.1-rc5

Pre-built Windows binaries are available from:

http://www.unidata.ucar.edu/netcdf/docs_rc/winbin.html

Thanks all,

-Ward
Ward Fisher
wfisher@xxxxxxxxxxxxxxxx

_______________________________________________
netcdfgroup mailing list
netcdfgroup@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/



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




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





  • 2013 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: