It seems that the build system isn't properly detecting the need to link against zlib which is a required transient dependency when building with static openssl libraries. Adding -lz at the end of this line allows the build to succeed but we probably don't want to set it unconditionally as it's only needed for static builds, maybe we can detect if we need -lz somehow with pkg-config or similar.

Comment From: yossigo

@jameshilliard thanks for reporting this. This is a rather uncommon build settings so I'm not sure about adding anything explicit to support that, but I think what we can do is have a make variable that defaults to -lssl -lcrypto that you could easily override when invoking make to include -lz or whatever. Does that make sense to you?

Comment From: jameshilliard

@yossigo I think I have a better fix in #7452 using pkg-config.

Comment From: yossigo

@jameshilliard My concern is it adds a pkg-config dependency where in most cases it's not really needed. Exposing this as a variable could still have the same effect with a small burden on the caller in this case.

Comment From: jameshilliard

I'm thinking a fallback makes the most sense, essentially first try pkg-config then just set the default -lssl and -lcrypto if pkg-config doesn't find anything.

Comment From: yossigo

Yes that's definitely better. Especially if -lssl -lcrypto are still just a variable that can be overridden. And while at it, I guess the same should apply to the SSL CFLAGS to take the full advantage of pkg-config.

Comment From: jameshilliard

So I've currently got it working using a pkg-config autodetection technique similar to the existing libsystemd autodetection.

And while at it, I guess the same should apply to the SSL CFLAGS to take the full advantage of pkg-config.

Hmm, not sure if this is actually needed or not, on linux I don't actually get any cflags from pkg-config when I do pkg-config --cflags libssl or pkg-config --cflags libcrypto.