-
Notifications
You must be signed in to change notification settings - Fork 266
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
Add capability to enable/disable compression libraries #2712
Conversation
I don't understand what you mean by this sentence:
Netcdf files can have dependencies on the filters it uses, but I cannot see how the netcdf-c library has any |
All I mean is that if I know my netCDF library is not going to use the blosc filters for example, I don't want to have libblosc.so as a dependency. If I do an install with the current library, and then do a Another driver for this is that if I happen to have certain modules enabled at build/configure time, then CMake may find libraries in non-standard locations. Unless I then have the rpath embedded in the library, it is possible for another user of my library to not have those modules enabled and then he will have unresolved externals even though he may not even use any of the functions in that library. We had that happen with |
Interesting. The problem is to detect various librarys (e.g. libblosc) without causing them |
I just checked using Ubuntu 22 and the filter libraries are not included in the ldd output. |
Is the BLOSC filter supported in any way by the netCDF configure? |
I am using a CMake configure. Here is the ldd output I get from the standard build:
Here is the ldd output when I disable blosc, zstd, bz2, szip, curl, and libxml:
|
Not sure I understand this as once the filters are detected, they are enabled in |
The `FIND_PACKAGE` should not be called if the filter/compression library is not enabled. It was causing some inconsistencied in link libraries and CMake configure output...
I'm not sure. configure would probably also need some modifications similar to these, but I haven't looked at it at all. |
Ok, I see the problem exists in both automake and cmake. I suspect that it would require a lot of automake/cmake-foo to |
IIRC, you have to opt into that behavior with the linker. Otherwise, if you ask it to link a library, it's linking that library. |
Anyone know how to enable that linker capability in automake/cmake? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Greg, this makes sense! It looks like we'll need to do the same with autotools
based builds, but we should be able to sort that out.
I'll take a look at the autotools (and it looks like Dennis is as well); if it's easy enough, we'll add that to this PR; I'd prefer to keep the build systems in sync unless it's problematic. But we'll get this in either way, in short order :) |
For GNU, the linker flag of interest seems to be "-Wl,--as-needed" |
@DennisHeimbigner that's good to know and will be good to include in general, but if we are adding user options to |
I am reluctant to add a whole additional set of --disable options to our build. |
After talking with Dennis about this this morning, we're going to take a look to see if there's a mechanism we can use in If it comes down to it, we will add these options; we might also add the configure-time option as a comma-delimited list instead of a series of individual options. Regardless, we'll resolve this with a mechanism for users to control which functionality is enabled/disabled, beyond 'does the dependent library exist on the system.' |
Bumping for my own purposes; at this point I'm at a loss as to what we can do besides add these options. I'll ensure they are in parity between cmake and autoconf-based builds. We will have discussions around how to prevent going further down this route in the future. |
There might be another possibility: create a completely separate build for the plugins directory so that |
I don't know if this belongs here or is a separate PR, but being able to disable CURL might also be a good option. I can disable DAP, but CURL seems to just look if it can find the libraries and is then enabled. |
Note that in general I like what CMake/netCDF do for configure. But we have a couple systems where it would be nice to eliminate as many dependencies as possible basically get down to |
Options should let users specify desired functionality at configure time, and desired functionality should dictate which libraries are checked for (and subsequently linked against). This is standard practice, and working towards that is perfectly reasonable, I agree, @gsjaardema. We just need to make sure we keep the build systems in sync, and to slow the rate of new options as much as is possible, although it's likely we will continue to need to add new options as we add new functionality. |
Sorry, I do not like this. This is going to get out of hand very quickly. |
WRT to curl, we already have a --enable-remote-functionality that we can use to cut off looking for libcurl. |
@DennisHeimbigner I agree that it's expanding and growing, but this is not just a netCDF issue. I think we can help mitigate this by putting in some work to reorganize and group the options presented in Also, there are a number of options that can be removed; it won't completely mitigate the current issue of readability, but I see an awful lot of options that I'll take responsibility for adding that are never used, or are flagged experimental. '--enable-doxygen-pdf-output', for example. Looking at this, we can accomodate this issue on a one-in/one-out basis. When I go in to ensure parity tomorrow, I'll remove enough old experimental/useless options I've added so that we still see a net reduction in lines printed by |
"Get off my lawn!" :-) |
Wow @gsjaardema I didn't know emacs could do that! But I will certainly start using this feature! |
It does rely on the |
OK, all fun and games aside, I do agree with @gsjaardema that it's important to be able to limit the dependencies. THis is really important on HPC systems. Using netCDF on HPC systems is almost universal - I doubt there's a HPC system in operation which doesn't have netCDF installed. And this is where many of our really important data sets are written. On HPC systems, they are must less casual about dependencies then we are in the linux workstation community, where we just don't even care if the library links to 10 other libraries that it never uses. However, I agree with @WardF that having more and more configure options is not feasible. But we have some options which turn off major areas of functionality, like --disable-dap and --disable-netcdf-4, and in those cases, the dependencies associated with those features should not appear in nc-config or anywhere else. |
Do we need this capability for cmake only? Or do we need it for automake as well? |
I would be using it only with CMake. |
Part of the work I'm doing (I lost a lot more of the day than expected to the auto mechanic) is to add parity between cmake and autoconf based builds, for this PR. |
I did an experiment. It appears that if the code in netcdf-c/CMakeLists.txt that looks for |
It looks like the branch this is being pulled from, |
Even though a library may exist on the system, the user may not want to have their netCDF library depend on it. This adds the capability to disable the various compression libraries. To maintain the same behavior as before, they are all enabled by default so they will be added as a dependency if found on the system. The user can do
-DENABLE_BLOSC=NO
on the configure to disable the filter.I used the uppercase version of the library/filter in the ENABLE_ line; not sure if that is the best, but it makes it easier instead of trying to guess the upper/lower variations of the libraries/filters.