If we have a library dependency tree A depends on B depends on C (but A does not directly depend on C), from what I can tell the following is true:
- when building shared libraries, it is enough to specify
-lB
when compiling A - when building static libraries, one must specify
-lB -lC
(in that order) when compiling A.
This seems to be causing problems for me when building packages using pkgsStatic
, since the Make, CMake, meson, etc. files of these projects don’t specify all transitive dependencies. It’s not causing problems in all cases though, which is even weirder.
Am I understanding the situation correctly? Is there a solution besides adding NIX_LDFLAGS = [ "-lC" ];
manually for the transitive dependencies?
It may be relevant that I’m also cross-compiling to windows