Skip to content

Commit

Permalink
Merge pull request #646 from bedroge/gobject_introspection_fix
Browse files Browse the repository at this point in the history
prevent GObject-Introspection from setting EB-filtered environment variables
  • Loading branch information
ocaisa authored Jul 19, 2024
2 parents 9ec0cad + 013e181 commit efd3ad1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 2024.07.19
# GObject-Introspection sets $LD_LIBRARY_PATH (to many different paths, including $EPREFIX/lib)
# when calling gcc, and this causes a lot of issues for, especially, scripts using /bin/bash.
#
# This rebuild ensures (by using a new EasyBuild hook) that GObject-Introspection will not set
# environment variables that are configured to be filtered by EasyBuild.
#
# See https://github.com/EESSI/software-layer/issues/196
easyconfigs:
- GObject-Introspection-1.74.0-GCCcore-12.2.0.eb
- GObject-Introspection-1.76.1-GCCcore-12.3.0.eb
- GObject-Introspection-1.78.1-GCCcore-13.2.0.eb
- at-spi2-core-2.46.0-GCCcore-12.2.0.eb
- at-spi2-core-2.49.91-GCCcore-12.3.0.eb
34 changes: 18 additions & 16 deletions eb_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,23 @@ def pre_configure_hook_extrae(self, *args, **kwargs):
else:
raise EasyBuildError("Extrae-specific hook triggered for non-Extrae easyconfig?!")


def pre_configure_hook_gobject_introspection(self, *args, **kwargs):
"""
pre-configure hook for GObject-Introspection:
- prevent GObject-Introspection from setting $LD_LIBRARY_PATH if EasyBuild is configured to filter it, see:
https://github.com/EESSI/software-layer/issues/196
"""
if self.name == 'GObject-Introspection':
# inject a line that removes all items from runtime_path_envvar that are in $EASYBUILD_FILTER_ENVVARS
sed_cmd = r'sed -i "s@\(^\s*runtime_path_envvar = \)\(.*\)@'
sed_cmd += r'\1\2\n\1 [x for x in runtime_path_envvar if not x in os.environ.get(\'EASYBUILD_FILTER_ENV_VARS\', \'\').split(\',\')]@g"'
sed_cmd += ' %(start_dir)s/giscanner/ccompiler.py && '
self.cfg.update('preconfigopts', sed_cmd)
else:
raise EasyBuildError("GObject-Introspection-specific hook triggered for non-GObject-Introspection easyconfig?!")


def pre_configure_hook_gromacs(self, *args, **kwargs):
"""
Pre-configure hook for GROMACS:
Expand Down Expand Up @@ -484,21 +501,6 @@ def pre_configure_hook_wrf_aarch64(self, *args, **kwargs):
raise EasyBuildError("WRF-specific hook triggered for non-WRF easyconfig?!")


def pre_configure_hook_atspi2core_filter_ld_library_path(self, *args, **kwargs):
"""
pre-configure hook for at-spi2-core:
- instruct GObject-Introspection's g-ir-scanner tool to not set $LD_LIBRARY_PATH
when EasyBuild is configured to filter it, see:
https://github.com/EESSI/software-layer/issues/196
"""
if self.name == 'at-spi2-core':
if build_option('filter_env_vars') and 'LD_LIBRARY_PATH' in build_option('filter_env_vars'):
sed_cmd = 'sed -i "s/gir_extra_args = \[/gir_extra_args = \[\\n \'--lib-dirs-envvar=FILTER_LD_LIBRARY_PATH\',/g" %(start_dir)s/atspi/meson.build && '
self.cfg.update('preconfigopts', sed_cmd)
else:
raise EasyBuildError("at-spi2-core-specific hook triggered for non-at-spi2-core easyconfig?!")


def pre_test_hook(self,*args, **kwargs):
"""Main pre-test hook: trigger custom functions based on software name."""
if self.name in PRE_TEST_HOOKS:
Expand Down Expand Up @@ -759,8 +761,8 @@ def inject_gpu_property(ec):
}

PRE_CONFIGURE_HOOKS = {
'at-spi2-core': pre_configure_hook_atspi2core_filter_ld_library_path,
'BLIS': pre_configure_hook_BLIS_a64fx,
'GObject-Introspection': pre_configure_hook_gobject_introspection,
'Extrae': pre_configure_hook_extrae,
'GROMACS': pre_configure_hook_gromacs,
'libfabric': pre_configure_hook_libfabric_disable_psm3_x86_64_generic,
Expand Down

0 comments on commit efd3ad1

Please sign in to comment.