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

pulseaudio: fix missing glibc symbols on newer systems #20275

Closed
wants to merge 3 commits into from
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
45 changes: 45 additions & 0 deletions recipes/pulseaudio/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,51 @@
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rm(self, "*.la", os.path.join(self.package_folder, "lib"), recursive=True)
self._check_for_removed_glibc_symbols()

def _check_for_removed_glibc_symbols(self):
from conan.tools.scm import Version
from conan.errors import ConanException
import re
if self.settings.os not in ["Linux", "FreeBSD"]:
return
if self.settings.compiler == "clang" and Version(self.settings.compiler.version) >= 10:
return
external_symbols = self._list_external_elf_symbols()
finite_math_pattern = re.compile(r"\w*__\w+_finite")
removed_glibc_symbols = {"__dn_expand", "__res_nquery", "__xmknod", "__xmknodat"}
finite_math_warnings = []
for file, symbols in external_symbols.items():
forbidden_symbols = [sym for sym in symbols if finite_math_pattern.fullmatch(sym) or sym in removed_glibc_symbols]
if forbidden_symbols:
finite_math_warnings.append(f"{file}: {', '.join(sorted(forbidden_symbols))}")
if finite_math_warnings:
raise ConanException(f"Package contains files that link against functions removed from glibc >= v2.31:\n"

Check warning on line 158 in recipes/pulseaudio/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Using an f-string that does not have any interpolated variables
+ "\n".join(sorted(finite_math_warnings))
+ "\nPlease add -fno-finite-math-only to compiler flags to disable the use of these functions in optimizations.")

def _list_external_elf_symbols(self):
import subprocess
def _objdump(path, is_dynamic):
cmd = ["objdump", "--dynamic-syms" if is_dynamic else "--syms", path]
objdump_output = subprocess.check_output(cmd, cwd=self.package_folder).decode()
return [l.rsplit(" ", 1)[-1] for l in objdump_output.splitlines() if "*UND*" in l]

def _is_elf(path):
with path.open("rb") as f:
return f.read(4) == b"\x7fELF"

symbols = {}
for file in (self.package_path / "lib").rglob("*.a"):
if file.is_file() and not file.is_symlink():
symbols[file] = _objdump(file, is_dynamic=False)
for file in (self.package_path / "lib").rglob("*.so*"):
if file.is_file() and not file.is_symlink() and _is_elf(file):
symbols[file] = _objdump(file, is_dynamic=True)
for file in (self.package_path / "bin").rglob("*"):
if (file.is_file() and not file.is_symlink() and os.access(file, os.X_OK) and _is_elf(file)):
symbols[file] = _objdump(file, is_dynamic=True)
return {k.relative_to(self.package_path): v for k, v in symbols.items()}

def package_info(self):
self.cpp_info.components["pulse"].set_property("pkg_config_name", "libpulse")
Expand Down