Closed andy5995 closed 1 year ago
Failed due to missing libcrypto:
meson.build:98:0: ERROR: Dependency "libcrypto" not found, tried pkgconfig, system and cmake
Not sure how to get that installed -or- instruct meson.build to find it on MacOS X.
I had to do a bit of reading. It seems that MacOS used to ship with OpenSSL but they've switched to LibreSSL. Some people complain that the libressl version installed is pretty old.
People who use brew on macos most likely have either libressl or openssl already installed. The meson build will check either path for the the .pc file (the changes I made are pretty obvious).
I logged into an m1 system earlier today but couldn't find an openssl or libcrypto pc file in or under /usr/lib
Probably not worth it to try using find_library() unless someone starts complaining, but that's your call.
I could add another test to the matrix, in which brew doesn't install either libre or openssl, and add a find_library() line to meson and see if it picks it up. What do you think?
My suggestion is to first get it building with libressl as shipped with the system. That may or may not work. Off the top of my head, I do not know if libressl will provide the same API calls that bsdutils will want. At one point libressl was a reasonable fork of openssl, but now it's diverged significantly.
If you can't get it working with libressl without signficant patching, then I would say bsdutils should carry a hard dependency on openssl on macos.
With the above information, patch meson.build accordingly. If libressl is workable, then modify meson.build to look for and use that first. If that isn't found and you're on macos, then search for openssl in the logical places and use that if found. If that fails, then error out telling the user you need one of those on macos.
On MacOS, meson setup finds libcrypto without installing any extra packages (I thought I tried that first but I guess I was sleep-coding again).
I'll remove the matrix if you don't think you want any additional tests on mac right now.
I'm not sure if the conditions I added to meson are the best yet. On my system, Manjaro, pkg-config --libs openssl
returns 'lssl -lcrypto', so I figured if for some reason meson can't find libcrypto, it will still link to it as long as openssl or libressl is installed.
On MacOS, meson setup finds libcrypto without installing any extra packages (I thought I tried that first but I guess I was sleep-coding again).
The pkg_config_path setting in the meson default options is what's helping to find it now.
I'm not sure if the conditions I added to meson are the best yet. On my system, Manjaro,
pkg-config --libs openssl
returns 'lssl -lcrypto', so I figured if for some reason meson can't find libcrypto, it will still link to it as long as openssl or libressl is installed.
I removed those 2 checks. No need for it unless someone actually reports a problem.
Modifying the pkg-config path is fine, since you need to tell meson to look in a non-typical place to find the openssl installation done by brew.
What I can't tell from your PR now is if openssl is a hard requirement or not. You mention it can fall back on libcrypto from the system, but does that work?
libressl and openssl unfortunately share the same shared library names, but the APIs are not 100% compatible. However, if bsdutils is using functions that are present in the system-provided libressl, then I would suggest just having it use that rather than looking for openssl. But maybe that's not even worth the trouble. I don't have a macos system, so I can't try any of this locally. If openssl works for you, I'm fine leaving it that way.
There is a new problem though and it's the inclusion of
Thanks!
New errors now after avoiding the include. I have no idea how to fix.
I'm not on macos, I just had temporary access from a friend. Maybe I'll let this PR sit until a mac person comes along... I only intended to add a test for a mac build, not to fix the mac build.
That's fine. If there's interest from mac people, sure. I tend to not do anything on macos and I don't have any of those systems around nor do I have easy access to one. Besides, macos people already have all of these commands on their systems anyway. These are ported from FreeBSD, which is where they originate [now] on macos.
Failed due to missing libcrypto:
meson.build:98:0: ERROR: Dependency "libcrypto" not found, tried pkgconfig, system and cmake
Not sure how to get that installed -or- instruct meson.build to find it on MacOS X.