diff --git a/easybuild/easyblocks/o/opencv.py b/easybuild/easyblocks/o/opencv.py index 9b1db4b40f..88529b79e7 100644 --- a/easybuild/easyblocks/o/opencv.py +++ b/easybuild/easyblocks/o/opencv.py @@ -37,7 +37,7 @@ from easybuild.tools.build_log import EasyBuildError from easybuild.tools.config import build_option from easybuild.tools.filetools import compute_checksum, copy -from easybuild.tools.modules import get_software_libdir, get_software_root +from easybuild.tools.modules import get_software_libdir, get_software_root, get_software_version from easybuild.tools.systemtools import X86_64, get_cpu_architecture, get_cpu_features, get_shared_lib_ext from easybuild.tools.toolchain.compiler import OPTARCH_GENERIC @@ -149,6 +149,13 @@ def configure_step(self): lib_path = os.path.join(dep_root, libdir, lib_file) self.cfg.update('configopts', '-D%s_LIBRARY=%s' % (opt_name, lib_path)) + # GTK+3 is used by default, use GTK+2 or none explicitely to avoid picking up a system GTK + if get_software_root('GTK+'): + if LooseVersion(get_software_version('GTK+')) < LooseVersion('3.0'): + self.cfg.update('configopts', '-DWITH_GTK_2_X=ON') + else: + self.cfg.update('configopts', '-DWITH_GTK=OFF') + # configure optimisation for CPU architecture # see https://github.com/opencv/opencv/wiki/CPU-optimizations-build-options if self.toolchain.options.get('optarch') and 'CPU_BASELINE' not in self.cfg['configopts']: