HDFGroup / vol-rest

HDF5 REST VOL Connector
Other
5 stars 8 forks source link

CMake: (feature+fix) HDF5 and CMake Config files #51

Closed jwsblokland closed 1 year ago

jwsblokland commented 1 year ago
jwsblokland commented 1 year ago

The modifications to the rv-config.cmake.in are done such it remains close to its original implementation. With this pull request there is an opportunity to revisit certain choices, like the target names.

jhendersonHDF commented 1 year ago

Thanks for the updates @jwsblokland!

With this pull request there is an opportunity to revisit certain choices, like the target names.

Yes, the CMake code for building the REST VOL was hastily thrown together and so could likely use some updates. For VOL connectors developed by the HDF Group staff, we've mostly been moving to a naming scheme similar to "hdf5-vol-name" or "hdf5_vol_name", depending on the context, so it's probably best for us to stay consistent there. For an example, the DAOS VOL's CMake files are at https://github.com/HDFGroup/vol-daos/tree/master/CMake.

jhendersonHDF commented 1 year ago

It looks like these changes are causing the PREBUILT_HDF5_DIR builds to fail for some reason. Though, at this point I think the whole prebuilt hdf5 notion should just go away.

jwsblokland commented 1 year ago

It looks like these changes are causing the PREBUILT_HDF5_DIR builds to fail for some reason. Though, at this point I think the whole prebuilt hdf5 notion should just go away.

In my latest commit I got all 3 options (build from source, prebuilt and find_pacakage) of specifying the HDF5 library working. Furthermore, the compilation of the examples works again.

mattjala commented 1 year ago

Trying this on my end and having issues linking to yajl when running the build script. Tried it with prebuilt/non-prebuilt HDF5, and yajl installed under /usr/local/ on Ubuntu 22.04, with cmake 3.22.1

Excerpt from the CMake error log:

...
/usr/bin/ld: ../bin/libhdf5_vol_rest.so: undefined reference to `yajl_tree_get'
/usr/bin/ld: ../bin/libhdf5_vol_rest.so: undefined reference to `yajl_tree_parse'
/usr/bin/ld: ../bin/libhdf5_vol_rest.so: undefined reference to `yajl_tree_get'
[ 97%] Building C object test/CMakeFiles/test_rest_vol-shared.dir/test_rest_vol.c.o
collect2: error: ld returned 1 exit status
make[2]: *** [examples/CMakeFiles/rv_crtdat-shared.dir/build.make:100: bin/rv_crtdat-shared] Error 1
make[1]: *** [CMakeFiles/Makefile2:988: examples/CMakeFiles/rv_crtdat-shared.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
make[2]: *** [examples/CMakeFiles/rv_write-shared.dir/build.make:100: bin/rv_write-shared] Error 1
make[2]: *** [examples/CMakeFiles/rv_crtgrpd-shared.dir/build.make:100: bin/rv_crtgrpd-shared] Error 1
make[1]: *** [CMakeFiles/Makefile2:1118: examples/CMakeFiles/rv_crtgrpd-shared.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1170: examples/CMakeFiles/rv_write-shared.dir/all] Error 2
collect2: error: ld returned 1 exit status
...
mattjala commented 1 year ago

Reinstalling yajl to /usr/ instead of /usr/local/ allowed me to configure and build. I'm not sure why this would make the linker unable to find the library, since both of those are in the linker's default search paths.

mattjala commented 1 year ago

Upon further testing, a fresh yajl installation in /usr/ or /usr/local/ works. The issue was probably some duplicate installations on my end conflicting.

This works with the prebuilt library, HDF5 found by CMake, and using the submodule. Static/shared yajl also both worked. LGTM.