From 0d0b06731d3c3155fcf13241952b56ba9d233c87 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 31 Oct 2020 10:41:45 +0100 Subject: [PATCH 1/3] support using system binutils in TensorFlow easyblock, taking into account alterate sysroot --- easybuild/easyblocks/t/tensorflow.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/easybuild/easyblocks/t/tensorflow.py b/easybuild/easyblocks/t/tensorflow.py index 822642cbcb..53ef835116 100644 --- a/easybuild/easyblocks/t/tensorflow.py +++ b/easybuild/easyblocks/t/tensorflow.py @@ -421,10 +421,21 @@ def setup_build_dirs(self): def configure_step(self): """Custom configuration procedure for TensorFlow.""" + # determine location where binutils commands (ar, as, ld, nm, ...) are installed (and double check to be sure) binutils_root = get_software_root('binutils') - if not binutils_root: - raise EasyBuildError("Failed to determine installation prefix for binutils") - self.binutils_bin_path = os.path.join(binutils_root, 'bin') + if binutils_root: + self.binutils_bin_path = os.path.join(binutils_root, 'bin') + else: + sysroot = build_option('sysroot') or '/' + self.binutils_bin_path = os.path.join(sysroot, 'usr', 'bin') + + missing_cmds = [] + for cmd in ['ar', 'as', 'ld', 'nm']: + if not os.path.exists(os.path.join(self.binutils_bin_path, cmd)): + missing_cmds.append(cmd) + if missing_cmds: + raise EasyBuildError("One or more binutils commands not found in %s: %s", + self.binutils_bin_path, ', '.join(missing_cmds)) # filter out paths from CPATH and LIBRARY_PATH. This is needed since bazel will pull some dependencies that # might conflict with dependencies on the system and/or installed with EB. For example: protobuf From f939eea7e1e452a1619e7c132aee08970d94cafa Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Mon, 2 Nov 2020 16:29:18 +0100 Subject: [PATCH 2/3] determine path to binutils location via which('ld'), so ld wrapper script is picked up when EasyBuild was configured with --rpath --- easybuild/easyblocks/t/tensorflow.py | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/easybuild/easyblocks/t/tensorflow.py b/easybuild/easyblocks/t/tensorflow.py index 53ef835116..8b75bb8568 100644 --- a/easybuild/easyblocks/t/tensorflow.py +++ b/easybuild/easyblocks/t/tensorflow.py @@ -421,21 +421,12 @@ def setup_build_dirs(self): def configure_step(self): """Custom configuration procedure for TensorFlow.""" - # determine location where binutils commands (ar, as, ld, nm, ...) are installed (and double check to be sure) - binutils_root = get_software_root('binutils') - if binutils_root: - self.binutils_bin_path = os.path.join(binutils_root, 'bin') - else: - sysroot = build_option('sysroot') or '/' - self.binutils_bin_path = os.path.join(sysroot, 'usr', 'bin') - - missing_cmds = [] - for cmd in ['ar', 'as', 'ld', 'nm']: - if not os.path.exists(os.path.join(self.binutils_bin_path, cmd)): - missing_cmds.append(cmd) - if missing_cmds: - raise EasyBuildError("One or more binutils commands not found in %s: %s", - self.binutils_bin_path, ', '.join(missing_cmds)) + # determine location where binutils' ld command is installed + # note that this may be an RPATH wrapper script (when EasyBuild is configured with --rpath) + ld_path = which('ld') + self.log.info("Found ld at %s", ld_path) + self.binutils_bin_path = os.path.dirname(ld_path) + self.log.info("Assuming that all binutils tools are located at %s", self.binutils_bin_path) # filter out paths from CPATH and LIBRARY_PATH. This is needed since bazel will pull some dependencies that # might conflict with dependencies on the system and/or installed with EB. For example: protobuf From 3f18097fa956b135fdd16f25b78d29134240cea9 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Mon, 2 Nov 2020 17:50:49 +0100 Subject: [PATCH 3/3] remove superfluous/confusing log messages --- easybuild/easyblocks/t/tensorflow.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/easybuild/easyblocks/t/tensorflow.py b/easybuild/easyblocks/t/tensorflow.py index 8b75bb8568..2aba823718 100644 --- a/easybuild/easyblocks/t/tensorflow.py +++ b/easybuild/easyblocks/t/tensorflow.py @@ -424,9 +424,7 @@ def configure_step(self): # determine location where binutils' ld command is installed # note that this may be an RPATH wrapper script (when EasyBuild is configured with --rpath) ld_path = which('ld') - self.log.info("Found ld at %s", ld_path) self.binutils_bin_path = os.path.dirname(ld_path) - self.log.info("Assuming that all binutils tools are located at %s", self.binutils_bin_path) # filter out paths from CPATH and LIBRARY_PATH. This is needed since bazel will pull some dependencies that # might conflict with dependencies on the system and/or installed with EB. For example: protobuf