Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2447,8 +2447,13 @@ def split_var(name, sep):
# features like DSO engines or external OSSL providers don't work.
# Only tested on GCC and clang on X86_64.
if os.environ.get("PY_UNSUPPORTED_OPENSSL_BUILD") == "static":
import subprocess, shutil
pkgconfig = os.getenv("PKG_CONFIG", shutil.which("pkg-config"))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will give incorrect results on systems without pkg-config. ax_check_openssl.m4 works around missing pkg-config.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine, we don't support all platforms for this hack. We can fall back to the previous behaviour if there is no pkg-config

libs_out = subprocess.check_output(
[pkgconfig, "--static", "--libs-only-l", "openssl"]).decode()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are not taking --with-openssl= configure option into account. It will only look up openssl.pc in standard pkg-config paths.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is that logic in the configure script? I can try to adapt it

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in an external autoconf-archive script called ax_check_openssl.m4, https://www.gnu.org/software/autoconf-archive/ax_check_openssl.html . You cannot modify it.

openssl_libs_static = {v.strip() for v in libs_out.split("-l") if v.strip()}
extra_linker_args = []
for lib in openssl_extension_kwargs["libraries"]:
for lib in openssl_libs_static:
# link statically
extra_linker_args.append(f"-l:lib{lib}.a")
# don't export symbols
Expand Down