On 10/31/2014 at 09:53 PM, lee wrote: > Don Armstrong <don@debian.org> writes: > >> On Fri, 31 Oct 2014, lee wrote: >>> Then the software shouldn't depend on a library it doesn't need. >> >> It needs the code paths of the library in some cases, therefore it >> links with the library, therefore the library must be installed if >> the binary is to run. > > It doesn't need these code paths. The library doesn't do anything > unless you do have the software actually running which the library > makes useable --- at least that's what was said. I think you're using differing definitions of "need", and talking past each other. (Possibly intentionally so?) In one sense, no, the program doesn't need the code paths which use the library. However, the only way the program can tell that it doesn't need those code paths is to try to call them. If it tries to call them and they aren't there to be called, it will crash. Thus, the program needs to have the library available, so that the library can tell it "no, you don't need this" by simply returning from the function call without taking any action. The alternative is for the program to try to detect the presence of the library at runtime, by calling functions that will be available regardless of whether the library is present, and checking for signs of the library's presence. This is much more complicated, heavy-weight, and error-prone, as can be seen by examining the configure script of any decently-sane program's build system. Or you could implement the program in a language which supports something like try..catch syntax, so that you can try a function call and simply transfer flow to a different control path (rather than crashing) if the function is not available. Not all languages support this, however, and certainly AFAIK C does not; I don't know of a C++ feature like that either. > Of course, not all cases are the same, yet in this case, the library > shouldn't be installed unless the software it is for is installed. While this is true, the question is how "the software for it" is to be defined. Under the definition which is pretty much unalterably necessary for software written in C (and possibly for any software linked at runtime by ld.so), "any software which contains a call to a function not provided outside of the library" would have to qualify. -- The Wanderer The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man. -- George Bernard Shaw
Attachment:
signature.asc
Description: OpenPGP digital signature