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.
This commit is contained in:
Glenn Johnson 2021-11-13 14:39:50 -06:00 committed by GitHub
parent 9fb9399487
commit 7a00cef055
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.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 @@ def configure(self, spec, prefix):
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',