Skip to content
Snippets Groups Projects
Commit 175ec8ff authored by Eleni Mathioulaki's avatar Eleni Mathioulaki
Browse files

Merge branch 'hxtorch_try_cleanup' into 'master'

chore(hxtorch): try to drop env modifications

See merge request technical-coordination/project-internal/devops/platform/ebrains-spack-builds!496
parents cb15e9cc bc57b50b
No related branches found
No related tags found
1 merge request!496chore(hxtorch): try to drop env modifications
Pipeline #27878 failed with stage
in 45 minutes and 18 seconds
......@@ -62,76 +62,6 @@ class Hxtorch(WafPackage):
depends_on('yaml-cpp+shared', type=('build', 'link', 'run'))
extends('python')
def setup_build_environment(self, env):
"""waf needs to find headers and libraries by itself (mostly `boost`
tool, but also `gtest`); it also needs to run executables during
configuration."""
include = []
include_exclude_dirs = set(['/usr/include'])
for dep in self.spec.traverse(deptype='build', root=False):
query = self.spec[dep.name]
if dep.name in ['pthreadpool', 'fxdiv']:
print('skipping {} in SPACK_INCLUDE_DIRS/CPATH/C{{,_PLUS}}_INCLUDE_PATH\n'.format(dep.name))
for d in query.headers.directories:
if os.path.exists(d):
env.remove_path('SPACK_INCLUDE_DIRS', d)
continue
try:
include_dirs = set(query.headers.directories)
include_dirs -= include_exclude_dirs
print('headers (', dep.name, '):', include_dirs, "\n")
include.extend(list(include_dirs))
except spack.error.NoHeadersError:
# we don't care if no header directories are found
pass
library = []
library_exclude_dirs = set(['/lib', '/lib64', '/usr/lib', '/usr/lib64'])
for dep in self.spec.traverse(deptype=('link', 'run'), root=False):
query = self.spec[dep.name]
try:
library_dirs = set(query.libs.directories)
library_dirs -= library_exclude_dirs
print('libs (', dep.name, '):', library_dirs, "\n")
library.extend(list(library_dirs))
except spack.error.NoLibrariesError:
# we don't care if no library directories are found
pass
path = []
for dep in self.spec.traverse(deptype=('build', 'link', 'run'), root=False):
if dep.name in ['pthreadpool', 'fxdiv']:
print('skipping {} for bin'.format(dep.name))
continue
query = self.spec[dep.name]
if os.path.exists(self.prefix.bin):
path.append(query.prefix.bin)
print('bin (', dep.name, '):', query.prefix.bin, "\n")
# llvm might be built with ~shared_libs but still builds shared libs
if not any('llvm' in lib for lib in library):
print("libs: manually adding ", self.spec['llvm'].prefix.lib)
library.append(self.spec['llvm'].prefix.lib)
# explicitly add googletest library if it isn't found above;
# adding in front of the list of libraries is a hack to circumvent
# issues from vendoring packages like pthreadpool
if not any('googletest' in lib for lib in library):
if os.path.isdir(self.spec['googletest'].prefix.lib64):
print("libs: manually inserting at front ", self.spec['googletest'].prefix.lib64)
library.insert(0, self.spec['googletest'].prefix.lib64)
if os.path.isdir(self.spec['googletest'].prefix.lib):
print("libs: manually inserting at front ", self.spec['googletest'].prefix.lib)
library.insert(0, self.spec['googletest'].prefix.lib)
env.set('CPATH', ':'.join(include))
env.set('C_INCLUDE_PATH', ':'.join(include))
env.set('CPLUS_INCLUDE_PATH', ':'.join(include))
env.set('LIBRARY_PATH', ':'.join(library))
env.set('WAF_CONFIGURE_LD_LIBRARY_PATH', ':'.join(library))
env.prepend_path('PATH', ':'.join(path))
def _setup_common_env(self, env):
# grenade needs to find some libraries for the JIT-compilation of
# programs for BrainScaleS-2's embedded processor.
......@@ -157,10 +87,19 @@ class Hxtorch(WafPackage):
def configure(self, spec, prefix):
"""Setup and configure the project."""
# spack tries to find headers and libraries by itself (i.e. it's not
# relying on the compiler to find it); we explicitly expose the
# spack-provided env vars that contain include and library paths
env = os.environ
if 'SPACK_INCLUDE_DIRS' in env:
env['C_INCLUDE_PATH'] = env['SPACK_INCLUDE_DIRS']
env['CPLUS_INCLUDE_PATH'] = env['SPACK_INCLUDE_DIRS']
if 'SPACK_LINK_DIRS' in env:
env['LIBRARY_PATH'] = env['SPACK_LINK_DIRS']
env['LD_LIBRARY_PATH'] = env['SPACK_LINK_DIRS']
if 'SPACK_COMPILER_IMPLICIT_RPATHS' in env:
env['LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['LIBRARY_PATH']
env['WAF_CONFIGURE_LD_LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['WAF_CONFIGURE_LD_LIBRARY_PATH']
env['WAF_CONFIGURE_LD_LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['LD_LIBRARY_PATH']
self.waf('setup', '--repo-db-url=https://github.com/electronicvisions/projects',
'--without-munge',
......
......@@ -59,56 +59,6 @@ class PynnBrainscales(WafPackage):
depends_on('yaml-cpp+shared', type=('build', 'link', 'run'))
extends('python')
def setup_build_environment(self, env):
"""waf needs to find headers and libraries by itself (mostly `boost`
tool, but also `gtest`); it also needs to run executables during
configuration."""
include = []
include_exclude_dirs = set(['/usr/include'])
for dep in self.spec.traverse(deptype='build', root=False):
query = self.spec[dep.name]
try:
include_dirs = set(query.headers.directories)
include_dirs -= include_exclude_dirs
print('headers (', dep.name, '):', include_dirs, "\n")
include.extend(list(include_dirs))
except spack.error.NoHeadersError:
# we don't care if no header directories are found
pass
library = []
library_exclude_dirs = set(['/lib', '/lib64', '/usr/lib', '/usr/lib64'])
for dep in self.spec.traverse(deptype=('link', 'run'), root=False):
query = self.spec[dep.name]
try:
library_dirs = set(query.libs.directories)
library_dirs -= library_exclude_dirs
print('libs (', dep.name, '):', library_dirs, "\n")
library.extend(list(library_dirs))
except spack.error.NoLibrariesError:
# we don't care if no library directories are found
pass
path = []
for dep in self.spec.traverse(deptype=('build', 'link', 'run'), root=False):
query = self.spec[dep.name]
if os.path.exists(self.prefix.bin):
path.append(query.prefix.bin)
print('bin (', dep.name, '):', query.prefix.bin, "\n")
# llvm might be built with ~shared_libs but still builds shared libs
if not any('llvm' in lib for lib in library):
print("libs: manually adding ", self.spec['llvm'].prefix.lib)
library.append(self.spec['llvm'].prefix.lib)
env.set('CPATH', ':'.join(include))
env.set('C_INCLUDE_PATH', ':'.join(include))
env.set('CPLUS_INCLUDE_PATH', ':'.join(include))
env.set('LIBRARY_PATH', ':'.join(library))
env.set('WAF_CONFIGURE_LD_LIBRARY_PATH', ':'.join(library))
env.prepend_path('PATH', ':'.join(path))
def _setup_common_env(self, env):
# grenade needs to find some libraries for the JIT-compilation of
# programs for BrainScaleS-2's embedded processor.
......@@ -134,10 +84,19 @@ class PynnBrainscales(WafPackage):
def configure(self, spec, prefix):
"""Setup and configure the project."""
# spack tries to find headers and libraries by itself (i.e. it's not
# relying on the compiler to find it); we explicitly expose the
# spack-provided env vars that contain include and library paths
env = os.environ
if 'SPACK_INCLUDE_DIRS' in env:
env['C_INCLUDE_PATH'] = env['SPACK_INCLUDE_DIRS']
env['CPLUS_INCLUDE_PATH'] = env['SPACK_INCLUDE_DIRS']
if 'SPACK_LINK_DIRS' in env:
env['LIBRARY_PATH'] = env['SPACK_LINK_DIRS']
env['LD_LIBRARY_PATH'] = env['SPACK_LINK_DIRS']
if 'SPACK_COMPILER_IMPLICIT_RPATHS' in env:
env['LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['LIBRARY_PATH']
env['WAF_CONFIGURE_LD_LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['WAF_CONFIGURE_LD_LIBRARY_PATH']
env['WAF_CONFIGURE_LD_LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['LD_LIBRARY_PATH']
self.waf('setup', '--repo-db-url=https://github.com/electronicvisions/projects',
'--without-munge',
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment