libssh2.pc has references to
libcrypto.pc. These files only exist inside private brew folders, and there are no symlinks from public locations for these pc files. SPM does not query pkg-config for locations of these files, and unable to locate these files. Apparently the error message about missing
libssl2.pc is incorrect, because it misses
The solution by @gopito allows to build project from command line, since it adds
PKG_CONFIG_PATH env which extends search paths. But in Xcode project is still not buildable because this env does not get picked up.
One of the solutions would be to patch brew formulAE to add symbolic links to
libcrypto.pc I guess. Also, these commands fix the link issue:
$ ln -s /firstname.lastname@example.org/lib/pkgconfig/libcrypto.pc /usr/local/lib/pkgconfig/libcrypto.pc
$ ln -s /email@example.com/lib/pkgconfig/libssl.pc /usr/local/lib/pkgconfig/libssl.pc
I guess the correct patch would be to teach SPM to query
pkg-config for linker settings like that:
$ pkg-config --libs libssl
$ pkg-config --libs libcrypto
This way there won't be a need to iterate over
pkg-config search paths from inside SPM. Also, a setting to extend search paths would be suitable as a fix, but I wasn't able to locate one.
I might be wrong and still mis-understand the concept of
pkg-config related stuff though.