From 7a00cef055e5864f72e8d7dbd9e8bd2097e538d0 Mon Sep 17 00:00:00 2001 From: Glenn Johnson Date: Sat, 13 Nov 2021 14:39:50 -0600 Subject: qt: turn off features if not supported by the kernel (#27438) If building Qt on a system with a recent glibc but an older kernel, it is possible that Qt configures features based on glibc that are not supported in the kernel. This PR tests the kernel version and ensures certain features are disabled if the kernel does not support them. --- var/spack/repos/builtin/packages/qt/package.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/var/spack/repos/builtin/packages/qt/package.py b/var/spack/repos/builtin/packages/qt/package.py index 2b96ddde3d..324d29ad42 100644 --- a/var/spack/repos/builtin/packages/qt/package.py +++ b/var/spack/repos/builtin/packages/qt/package.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import itertools import os +import platform import sys import llnl.util.tty as tty @@ -12,6 +13,7 @@ from spack import * from spack.operating_systems.mac_os import macos_version MACOS_VERSION = macos_version() if sys.platform == 'darwin' else None +LINUX_VERSION = Version(platform.release()) if platform.system() == 'Linux' else None class Qt(Package): @@ -637,6 +639,20 @@ class Qt(Package): config_args.append('-I{0}/include'.format(spec['libx11'].prefix)) config_args.append('-I{0}/include'.format(spec['xproto'].prefix)) + # If the version of glibc is new enough Qt will configure features that + # may not be supported by the kernel version on the system. This will + # cause errors like: + # error while loading shared libraries: libQt5Core.so.5: cannot open + # shared object file: No such file or directory + # Test the kernel version and disable features that Qt detects in glibc + # but that are not supported in the kernel as determined by information + # in: qtbase/src/corelib/global/minimum-linux_p.h. + if LINUX_VERSION and version >= Version('5.10'): + if LINUX_VERSION < Version('3.16'): + config_args.append('-no-feature-renameat2') + if LINUX_VERSION < Version('3.17'): + config_args.append('-no-feature-getentropy') + if '~webkit' in spec: config_args.extend([ '-skip', -- cgit v1.2.3-70-g09d2