-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Superfluous HDF5 dependency #20
Comments
If the NetCDF library is static we require a method to specifically link against the downstream hdf5 library dependency (assuming it is required). This is still a work in progress and will be resolved before our next release. Sent from my iPhone
|
We cannot assume that NetCDF-c was built with cmake unfortunately or that cmake information is available; the majority of users still use automake. Sent from my iPhone
|
I just skimmed through netCDF-Fortran and found no reference to HDF5 at all. I just compiled it without HDF5 and it all links cleanly, no missing symbols. The HDF5 dependency really looks superfluous. What was your motivation for linking against it in the first place? |
Adding a quick link to the relevant issue, #17. AssumptionThe following assumes that We cannot assume that libnetcdf was built using CMake. Automake-based builds.When building netcdf-fortran and linking against a static libnetcdf, the tests for various If the variable is defined by hand, we then see a number of linker errors due to the undefined references in libnetcdf.a. This issue is fixed by assigning
Other downstream dependencies, such as CMake-based builds.When building with CMake, we will not see the same issue when testing
...
This is to be expected since libnetcdf.a does not carry information regarding dependencies with it, and so the linker is not linking against the inherited dependencies. It is trivial to confirm that these symbols are undefined in the library using the Unfortunately, CMake does not have an equivalent to automake's Other thoughtsWhen using automake, libtool is supposed to interpret the installed It is likely that I will reverse the work I've done automatically looking for hdf5 dependencies and instead implement a I'm going to close out this issue because when dealing with static libraries that don't contain information about inherited dependencies, there needs to be a way to tell the linker what objects define the relevant functions. |
I understand the problem now. The issue lies in the fact that it is not clear how netCDF-C is supposed to transmit the information "I'm using symbols from -lhdf5 and -lhdf5_hl" to consumers, e.g., netCDF-Fortran's test executables. In a CMake world, this information is supposed to travel on through the export files. Is netCDF-C using those? The man page http://www.cmake.org/cmake/help/v3.0/module/CMakePackageConfigHelpers.html can help. There must be something similar for automake as well. How are export configurations created there? |
Not sure why this is closed. IMHO, we can close this if Unidata/netcdf-c#74 gets merged, we use this in the CMake build here and finally remove the dependency. |
It was closed as a duplicate of #17, which remains open for the moment. I'll take a look at Unidata/netcdf-c#74 and merge it shortly, but it only solves the issue if a user is using cmake; sadly, the majority of our users are still using autotools, so we can't assume cmake is being used to build netcdf-c. Hence the addition of the 'NC_EXTRA_DEPS' for use when cmake is not used to build netcdf-c. |
That's right. Since you are supporting both automake and CMake, and that on both netCDF and netCDF-Fortran, basically we need to have both CMake and Makefile exports for both CMake and Makefile builds. I guess I could fix up a Makefile export from a netCDF CMake build, too, but that won't be relocatable (which might not be a big deal). |
Another possibility that just came to my mind is that in netCDF-Fortran's |
Commit 5fa56b4 introduces a dependency on HDF5 which might not actually by necessary. Note that HDF5 symbols are already pulled in by the dependency on netCDF.
Do you use HDF5 directly and explicitly in netCDF-Fortran?
The text was updated successfully, but these errors were encountered: