Skip to content
Merged
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
19 changes: 14 additions & 5 deletions easybuild/easyblocks/b/binutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def __init__(self, *args, **kwargs):
"""Easyblock constructor"""
super().__init__(*args, **kwargs)

self.search_paths = []

if LooseVersion(self.version) >= LooseVersion('2.44') or get_cpu_family() == RISCV:
# ld.gold linker is not supported on RISC-V, and is being phased out starting from v2.44
self.use_gold = False
Expand Down Expand Up @@ -103,12 +105,12 @@ def configure_step(self):

version = LooseVersion(self.version)

# determine list of 'lib' directories to use rpath for;
# this should 'harden' the resulting binutils to bootstrap GCC
# (no trouble when other libstdc++ is build etc)
lib_paths = self.determine_used_library_paths()
self.search_paths = lib_paths.copy()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Crivella Since self.search_paths is used in sanity_check_step, can we already determine the list of library paths in the easyblock constructor instead?

That way, the sanity check commands will also be run when using --sanity-check-only...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In particular to address the second point i am not sure this is possible.
We would need the dependencies to be available to be able to filter them out

if self.toolchain.is_system_toolchain():
# determine list of 'lib' directories to use rpath for;
# this should 'harden' the resulting binutils to bootstrap GCC
# (no trouble when other libstdc++ is build etc)
lib_paths = self.determine_used_library_paths()

# The installed lib dir must come first though to avoid taking system libs over installed ones, see:
# https://github.com/easybuilders/easybuild-easyconfigs/issues/10056
# To get literal $ORIGIN through Make we need to escape it by doubling $$, else it's a variable to Make;
Expand Down Expand Up @@ -230,6 +232,10 @@ def configure_step(self):
# append "-std=c++11" to $CXXFLAGS, not overriding
self.cfg.update('buildopts', 'CXXFLAGS="$CXXFLAGS -std=c++11"')

def build_step(self, verbose=None, path=None):
env.setvar('LIB_PATH', ':'.join(self.search_paths))
return super().build_step(verbose, path)

def install_step(self):
"""Install using 'make install', also symlink libiberty/demangle headers if desired."""
super().install_step()
Expand Down Expand Up @@ -294,6 +300,9 @@ def sanity_check_step(self):
# All binaries support --version, check that they can be run
custom_commands = ['%s --version' % b for b in binaries]

for sdir in self.search_paths:
custom_commands.append(f'ld -verbose | grep "SEARCH_DIR(" | grep "{sdir}"')

# if zlib is listed as a build dependency, it should have been linked in statically
build_deps = self.cfg.dependencies(build_only=True)
if any(dep['name'] == 'zlib' for dep in build_deps):
Expand Down