Require a minimum version of a system library

Hi! I'm working on a project that depends on a couple of C system libraries. We include them as dependencies via SwiftPM.

The linking and building work just fine when recent versions of the libraries are installed, but we've run into user issues in the past where someone has an extremely old version of one of the libs installed and gets cryptic build errors as a result about missing symbols and so on.

I know that SwiftPM uses pkg-config to figure out where libraries are. Is it possible to specify specific version(s) for SwiftPM to look for with pkg-config? I don't see this documented anywhere in here.

pkg-config itself supports this via an option:

--atleast-version=VERSION               return 0 if the module is at least version VERSION

Any ideas are appreciated. If it helps, here's the Package.swift for the my project, and here are the repos containing the C bindings (1, 2).



We don't have any facility to do this at the moment and I cannot think of a workaround, either. This sounds like a useful addition, though, could you please file it as an improvement on

1 Like

Thanks for getting back to me! Filed SR-9542.

1 Like