HDF-NI / hdf5.node

A node module for reading/writing the HDF5 file format.
MIT License
123 stars 40 forks source link

Compile Error #96

Closed NINI1988 closed 6 years ago

NINI1988 commented 6 years ago

When i want to compile I get the following error:

> npm install --link_type=static --hdf5_home_linux='/usr/lib/x86_64-linux-gnu/hdf5/serial' --longlong_type=LONGLONG53BITS

> hdf5@0.3.4 install /home/osboxes/cvs/Project/Display/WebServer/node_modules/hdf5
> node-gyp rebuild --jobs max

make: Entering directory '/home/osboxes/cvs/Project/Display/WebServer/node_modules/hdf5/build'
  CXX(target) Release/obj.target/h5ds/src/h5ds.o
  CXX(target) Release/obj.target/h5lt/src/uint64.o
  CXX(target) Release/obj.target/h5im/src/h5im.o
  CXX(target) Release/obj.target/h5lt/src/int64.o
In file included from ../src/file.h:15:0,
                 from ../src/h5ds.cc:2:
../src/reference.hpp: In static member function ‘static void NodeHDF5::Reference::dereference(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/reference.hpp:100:98: error: invalid conversion from ‘hid_t {aka long int}’ to ‘H5R_type_t’ [-fpermissive]
       H5Rdereference(locId, H5P_DEFAULT, (H5R_type_t)args[1]->Int32Value(), (void *)obj->objectId);
                                                                                                  ^
../src/reference.hpp:100:98: error: cannot convert ‘H5R_type_t’ to ‘const void*’ for argument ‘3’ to ‘hid_t H5Rdereference1(hid_t, H5R_type_t, const void*)’
In file included from ../src/file.h:15:0,
                 from ../src/h5im.cc:2:
../src/reference.hpp: In static member function ‘static void NodeHDF5::Reference::dereference(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/reference.hpp:100:98: error: invalid conversion from ‘hid_t {aka long int}’ to ‘H5R_type_t’ [-fpermissive]
       H5Rdereference(locId, H5P_DEFAULT, (H5R_type_t)args[1]->Int32Value(), (void *)obj->objectId);
                                                                                                  ^
../src/reference.hpp:100:98: error: cannot convert ‘H5R_type_t’ to ‘const void*’ for argument ‘3’ to ‘hid_t H5Rdereference1(hid_t, H5R_type_t, const void*)’
  CXX(target) Release/obj.target/h5lt/src/h5lt.o
  CXX(target) Release/obj.target/h5lt/src/reference.o
h5ds.target.mk:105: recipe for target 'Release/obj.target/h5ds/src/h5ds.o' failed
make: *** [Release/obj.target/h5ds/src/h5ds.o] Error 1
make: *** Waiting for unfinished jobs....
h5im.target.mk:105: recipe for target 'Release/obj.target/h5im/src/h5im.o' failed
make: *** [Release/obj.target/h5im/src/h5im.o] Error 1
In file included from ../src/file.h:15:0,
                 from ../src/h5lt.cc:2:
../src/reference.hpp: In static member function ‘static void NodeHDF5::Reference::dereference(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/reference.hpp:100:98: error: invalid conversion from ‘hid_t {aka long int}’ to ‘H5R_type_t’ [-fpermissive]
       H5Rdereference(locId, H5P_DEFAULT, (H5R_type_t)args[1]->Int32Value(), (void *)obj->objectId);
                                                                                                  ^
../src/reference.hpp:100:98: error: cannot convert ‘H5R_type_t’ to ‘const void*’ for argument ‘3’ to ‘hid_t H5Rdereference1(hid_t, H5R_type_t, const void*)’
In file included from ../src/reference.cc:4:0:
../src/reference.hpp: In static member function ‘static void NodeHDF5::Reference::dereference(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/reference.hpp:100:98: error: invalid conversion from ‘hid_t {aka long int}’ to ‘H5R_type_t’ [-fpermissive]
       H5Rdereference(locId, H5P_DEFAULT, (H5R_type_t)args[1]->Int32Value(), (void *)obj->objectId);
                                                                                                  ^
../src/reference.hpp:100:98: error: cannot convert ‘H5R_type_t’ to ‘const void*’ for argument ‘3’ to ‘hid_t H5Rdereference1(hid_t, H5R_type_t, const void*)’
h5lt.target.mk:108: recipe for target 'Release/obj.target/h5lt/src/reference.o' failed
make: *** [Release/obj.target/h5lt/src/reference.o] Error 1
h5lt.target.mk:108: recipe for target 'Release/obj.target/h5lt/src/h5lt.o' failed
make: *** [Release/obj.target/h5lt/src/h5lt.o] Error 1
make: Leaving directory '/home/osboxes/cvs/Project/Display/WebServer/node_modules/hdf5/build'
h5cc -showconfig
            SUMMARY OF THE HDF5 CONFIGURATION
            =================================

General Information:
-------------------
                   HDF5 Version: 1.10.0-patch1
                  Configured on: Sun Aug 13 23:12:31 UTC 2017
                  Configured by: buildd@lgw01-21
                    Host system: x86_64-pc-linux-gnu
                    ...
rimmartin commented 6 years ago

I'll test on Windows with hdf5 1.10. It builds on windows with 1.8.15

NINI1988 commented 6 years ago

It's under linux.

rimmartin commented 6 years ago

https://github.com/HDF-NI/hdf5.node/blob/master/src/reference.hpp#L100 is compiling with 1.10.1 and 1.10.0-patch1 on my ubuntu. My c++ compiler is v8.0.0

what could be making the difference. My hdf5 libs are compiled; not system installs. The travis-ci system installed hdf5 lib is defaulting to 1.8 I believe

NINI1988 commented 6 years ago

I'll look tomorrow to see if I found a difference.

NINI1988 commented 6 years ago

I tried it with g++-7 and g++-8 which doesn't fix the problem.

The problem is in /usr/include/hdf5/serial/H5version.h:

#if !defined(H5Rdereference_vers)
  #define H5Rdereference_vers 1
#endif /* !defined(H5Rdereference_vers) */

When H5Rdereference_vers is undefined it uses H5Rdereference1 as default.

So a workaround is to use H5Rdereference2 directly:

#if  H5_VERSION_GE(1,10,0)
      H5Rdereference2(locId, H5P_DEFAULT, (H5R_type_t)args[1]->Int32Value(), (void *)obj->objectId);
#else
      H5Rdereference(locId, (H5R_type_t)args[1]->Int32Value(), (void *)obj->objectId);
#endif

I use sudo apt install libhdf5-dev to install hdf5.

But I don't know why it work elsewhere except me?

rimmartin commented 6 years ago

Yea it would be nice to know; I'll put in the work around if we don't find it.

Something that is bothering me is the extra defaults for the hdf5 native home: https://github.com/HDF-NI/hdf5.node/blob/master/binding.gyp#L20

rimmartin commented 6 years ago

and you have home as --hdf5_home_linux='/usr/lib/x86_64-linux-gnu/hdf5/serial' so the /usr/include/hdf5/serial/H5version.h shouldn't be picked up

are versions mixing?

NINI1988 commented 6 years ago

include is a link: /usr/lib/x86_64-linux-gnu/hdf5/serial/include -> /usr/include/hdf5/serial

rimmartin commented 6 years ago

ah is that how they install it! links always catch me

NINI1988 commented 6 years ago

I didn't found a fix for this, and this crashes my ci builds. Could you add the workaround?

rimmartin commented 6 years ago

yep I'll add it

rimmartin commented 6 years ago

give it a test