pkg-config
command comes with the OS.pkg-config --cflags --libs openssl
command works
out of the box and finds the system library.pkg-config
command needs to be installed separately
with sudo pkg_add pkgconf
(or
sudo pkg_add pkg-config
).pkg-config --cflags --libs openssl
finds the system
library.sudo pkg_add libressl
or sudo pkg_add openssl
from the OS package manager.pkg-config --cflags --libs openssl
points to the OpenSSL or LibreSSL version from the package manager,
which automatically overrides the native version for this purpose.pkg-config
command needs to be installed separately
with sudo pkg install pkgconf
.pkg-config --cflags --libs openssl
still does
not work.sudo pkg install libressl
or sudo pkg install openssl
.pkg-config --cflags --libs openssl
finds that copy
of libressl or openssl.The pkg-config
command needs to be installed
separately (Homebrew: brew install pkg-config
).
The OS comes with LibreSSL 2.6.5 but does not ship with an openssl.pc file. Also, the <openssl/ssl.h> and other necessary C header files may not be installed even though the shared library is.
Easiest fix: tell people to use Homebrew to install an
OpenSSL-compatible library: brew install openssl
or
brew install libressl
.
pkg-config --cflags --libs openssl
does not work
even when you have installed the separate package from Homebrew, because
Homebrew packages don’t put their .pc
files where
pkg-config can find them.
That can be remedied with:
export PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig"
export PKG_CONFIG_PATH="$(brew --prefix libressl)/lib/pkgconfig"
Then pkg-config --cflags --libs openssl
finds that
copy of libressl or openssl.
IMPORTANT: In many of the above cases, the openssl
shell
command can represent a different version of OpenSSL/LibreSSL than the
library and headers found by pkg-config. So openssl
should
not be invoked to gather any version information in build scripts.