Dear HDF5 users.
I try to execute the F90 example h5_crtdat.f90 provided in
'1.8.12\fortran\examples\h5_crtdat.f90'
This should create an empty dataset. It should create a file called
'dsetf.h5', defines the dataset dataspace, creates a dataset which is a 4x6
integer array, and then closes the dataspace, the dataset, and the file.
However when I execute the program I have the following error
D:\GJ\svn\tools\ThirdParty\hdf5\1.8.12_compil\bin>f90_ex_h5_crtdatdll.exe
HDF5-DIAG: Error detected in HDF5 (1.8.12) thread 0:
#000: d:/GJ/svn/tools/ThirdParty/hdf5/1.8.12/src/H5D.c line 143 in
H5Dcreate2(): not a datatype ID
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.12) thread 0:
#000: d:/GJ/svn/tools/ThirdParty/hdf5/1.8.12/src/H5D.c line 391 in
H5Dclose(): not a dataset
major: Invalid arguments to routine
minor: Inappropriate type
My guess is that the H5T_NATIVE_INTEGER is not recognized, hence H5Dcreate2
is throwing an error.
I compile two times:
- one time with the activation of examples/tests in the generation of HDF5
library.
- one time as a full projet
But the same mistake occurs.
I have the problems with different examples.
I run the program with Win 32, MinGW, Gfortran 4.7.2, HDF5 1.8.12.
Below is the CMakeLists.txt I use to compile the example h5_crtdat.f90 as a
full project.
Is there any specific operation for H5T_NATIVE_INTEGER to be understood? At
compilation, at linking stage, at run time stage?
Any help will be apreciated.
Best regards
Guillaume Jacquenot
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(F90 Fortran)
ENABLE_LANGUAGE(Fortran)
GET_FILENAME_COMPONENT (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER}
NAME_WE)
IF(Fortran_COMPILER_NAME STREQUAL "gfortran")
SET(CMAKE_Fortran_FLAGS_RELEASE "-fmessage-length=0
-ffixed-line-length-none -ffree-line-length-none -fno-automatic
-fdefault-real-8 -fdefault-double-8 -funroll-all-loops -fno-f2c -O3")
SET(CMAKE_Fortran_FLAGS_DEBUG "-fmessage-length=0
-ffixed-line-length-none -ffree-line-length-none -fno-automatic
-fdefault-real-8 -fdefault-double-8 -fno-f2c -O0 -g")
ELSEIF(Fortran_COMPILER_NAME STREQUAL "ifort")
SET(CMAKE_Fortran_FLAGS_RELEASE "-f77rtl -O3")
SET(CMAKE_Fortran_FLAGS_DEBUG "-f77rtl -O0 -g")
ELSEIF(Fortran_COMPILER_NAME STREQUAL "g77")
SET(CMAKE_Fortran_FLAGS_RELEASE "-funroll-all-loops -fno-f2c -O3 -m32")
SET(CMAKE_Fortran_FLAGS_DEBUG "-fno-f2c -O0 -g -m32")
ELSE(Fortran_COMPILER_NAME STREQUAL "gfortran")
MESSAGE(STATUS "CMAKE_Fortran_COMPILER full path: "
${CMAKE_Fortran_COMPILER})
MESSAGE(STATUS "Fortran compiler: " ${Fortran_COMPILER_NAME})
MESSAGE(STATUS "No optimized Fortran compiler flags are known, we just
try -O2...")
SET(CMAKE_Fortran_FLAGS_RELEASE "-O2 ")
SET(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g")
ENDIF(Fortran_COMPILER_NAME STREQUAL "gfortran")
FIND_PACKAGE(HDF5 NAMES hdf5)
IF(HDF5_FOUND)
MESSAGE(STATUS "HDF5 : ${HDF5}")
MESSAGE(STATUS "HDF5_INCLUDE_DIR : ${HDF5_INCLUDE_DIR}")
ELSE(HDF5_FOUND)
MESSAGE(STATUS "HDF5 NOT FOUND")
ENDIF(HDF5_FOUND)
INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIR})
FOREACH(f h5_crtdat)
ADD_EXECUTABLE(${f}
${f}.f90)
TARGET_LINK_LIBRARIES(${f} ${HDF5_LIBRARIES})
SET_TARGET_PROPERTIES(${f} PROPERTIES LINKER_LANGUAGE Fortran)
IF (WIN32 AND NOT CYGWIN)
SET_PROPERTY (TARGET ${f}
APPEND PROPERTY COMPILE_DEFINITIONS HDF5F90_WINDOWS)
ENDIF (WIN32 AND NOT CYGWIN)
ENDFOREACH(f)