Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: fix for Python 3.12 Ubuntu Linux 24.04 (Noble Nimbat) #2303

Merged
merged 1 commit into from
Mar 17, 2024
Merged
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
13 changes: 11 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def build_extension(self, ext):
fullname = os.fspath(Path(self.build_lib, filename))
library_dirs = ext.library_dirs or []
libraries = self.get_libraries(ext)
extra_args = ext.extra_link_args or []
extra_args: list = ext.extra_link_args or []
if PLATFORM.startswith("freebsd"):
libraries.append("pthread")
if IS_MINGW or IS_WINDOWS:
Expand Down Expand Up @@ -111,6 +111,9 @@ def build_extension(self, ext):
extra_args.extend(get_config_var("BASEMODLIBS").split())
if get_config_var("LOCALMODLIBS"):
extra_args.extend(get_config_var("LOCALMODLIBS").split())
# fix for Python 3.12 Ubuntu Linux 24.04 (Noble Nimbat)
with contextlib.suppress(ValueError):
extra_args.remove("Modules/_hacl/libHacl_Hash_SHA2.a")
if IS_MACOS:
extra_args.append("-Wl,-export_dynamic")
extra_args.append("-Wl,-rpath,@loader_path/lib")
Expand All @@ -121,6 +124,7 @@ def build_extension(self, ext):
extra_args.append("-Wl,-rpath,$ORIGIN/../lib")
if not self.debug:
extra_args.append("-s")
link_error = None
for arg in (None, "-fno-lto", "--no-lto"):
try:
self.compiler.link_executable(
Expand All @@ -132,12 +136,17 @@ def build_extension(self, ext):
extra_postargs=extra_args + ([arg] if arg else []),
debug=self.debug,
)
except LinkError:
except LinkError as exc:
if IS_MINGW or IS_WINDOWS:
raise
if arg is None:
link_error = exc.args
continue
else:
link_error = None
break
if link_error is not None:
raise LinkError from link_error

def get_ext_filename(self, fullname):
if fullname.endswith("util"):
Expand Down