def check_readiness_step(self):
     """Fail early on RHEL 5.x and derivatives because of known bug in libc."""
     super(EB_Clang, self).check_readiness_step()
     # RHEL 5.x have a buggy libc.  Building stage 2 will fail.
     if get_os_name() in ['redhat', 'RHEL', 'centos', 'SL'] and get_os_version().startswith('5.'):
         self.log.error(("Can not build clang on %s v5.x: libc is buggy, building stage 2 will fail.  " +
                         "See http://stackoverflow.com/questions/7276828/") % get_os_name())
Beispiel #2
0
 def check_readiness_step(self):
     """Fail early on RHEL 5.x and derivatives because of known bug in libc."""
     super(EB_Clang, self).check_readiness_step()
     # RHEL 5.x have a buggy libc.  Building stage 2 will fail.
     if get_os_name() in ['redhat', 'RHEL', 'centos', 'SL'] and get_os_version().startswith('5.'):
         raise EasyBuildError("Can not build Clang on %s v5.x: libc is buggy, building stage 2 will fail. "
                              "See http://stackoverflow.com/questions/7276828/", get_os_name())
 def check_readiness_step(self):
     """Fail early on RHEL 5.x and derivatives because of known bug in libc."""
     super(EB_Clang, self).check_readiness_step()
     # RHEL 5.x have a buggy libc.  Building stage 2 will fail.
     if get_os_name() in ["redhat", "RHEL", "centos", "SL"] and get_os_version().startswith("5."):
         raise EasyBuildError(
             "Can not build Clang on %s v5.x: libc is buggy, building stage 2 will fail. "
             "See http://stackoverflow.com/questions/7276828/",
             get_os_name(),
         )
Beispiel #4
0
    def __init__(self, *args, **kwargs):
        """Initialize custom class variables for Clang."""

        super(EB_Clang, self).__init__(*args, **kwargs)
        self.llvm_src_dir = None
        self.llvm_obj_dir_stage1 = None
        self.llvm_obj_dir_stage2 = None
        self.llvm_obj_dir_stage3 = None
        self.make_parallel_opts = ""

        # RHEL 5.x have a buggy libc.  Building stage 2 will fail.
        if get_os_name() in ['redhat', 'RHEL', 'centos', 'SL'] and get_os_version().startswith('5.'):
            self.log.error(("Can not build clang on %s v5.x: libc is buggy, building stage 2 will fail.  " +
                            "See http://stackoverflow.com/questions/7276828/") % get_os_name()) 
Beispiel #5
0
    def __init__(self, *args, **kwargs):
        super(EB_GCC, self).__init__(*args, **kwargs)

        self.stagedbuild = False

        # need to make sure version is an actual version
        # required because of support in SystemCompiler generic easyblock to specify 'system' as version,
        # which results in deriving the actual compiler version
        # comparing a non-version like 'system' with an actual version like '2016' fails with TypeError in Python 3.x
        if re.match(r'^[0-9]+\.[0-9]+.*', self.version):
            version = LooseVersion(self.version)

            if version >= LooseVersion('4.8.0') and self.cfg[
                    'clooguseisl'] and not self.cfg['withisl']:
                raise EasyBuildError(
                    "Using ISL bundled with CLooG is unsupported in >=GCC-4.8.0. "
                    "Use a seperate ISL: set withisl=True")

            # I think ISL without CLooG has no purpose in GCC < 5.0.0 ...
            if version < LooseVersion('5.0.0') and self.cfg[
                    'withisl'] and not self.cfg['withcloog']:
                raise EasyBuildError(
                    "Activating ISL without CLooG is pointless")

        # unset some environment variables that are known to may cause nasty build errors when bootstrapping
        self.cfg.update('unwanted_env_vars', [
            'CPATH', 'C_INCLUDE_PATH', 'CPLUS_INCLUDE_PATH',
            'OBJC_INCLUDE_PATH'
        ])
        # ubuntu needs the LIBRARY_PATH env var to work apparently (#363)
        if get_os_name() not in ['ubuntu', 'debian']:
            self.cfg.update('unwanted_env_vars', ['LIBRARY_PATH'])
Beispiel #6
0
    def handle_jemalloc(self):
        """Figure out whether jemalloc support should be enabled or not."""
        if self.cfg['with_jemalloc'] is None:
            if LooseVersion(self.version) > LooseVersion('1.6'):
                # jemalloc bundled with recent versions of TensorFlow does not work on RHEL 6 or derivatives,
                # so disable it automatically if with_jemalloc was left unspecified
                os_name = get_os_name().replace(' ', '')
                rh_based_os = any(
                    os_name.startswith(x)
                    for x in ['centos', 'redhat', 'rhel', 'sl'])
                if rh_based_os and get_os_version().startswith('6.'):
                    self.log.info(
                        "Disabling jemalloc since bundled jemalloc does not work on RHEL 6 and derivatives"
                    )
                    self.cfg['with_jemalloc'] = False

            # if the above doesn't disable jemalloc support, then enable it by default
            if self.cfg['with_jemalloc'] is None:
                self.log.info(
                    "Enabling jemalloc support by default, since it was left unspecified"
                )
                self.cfg['with_jemalloc'] = True

        else:
            # if with_jemalloc was specified, stick to that
            self.log.info(
                "with_jemalloc was specified as %s, so sticking to it",
                self.cfg['with_jemalloc'])
    def _os_dependency_check(self, dep):
        """
        Check if dependency is available from OS.
        """
        # - uses rpm -q and dpkg -s --> can be run as non-root!!
        # - fallback on which
        # - should be extended to files later?
        cmd = "exit 1"
        if get_os_name() in ['debian', 'ubuntu']:
            if run_cmd('which dpkg', simple=True, log_ok=False):
                cmd = "dpkg -s %s" % dep
        else:
            # OK for get_os_name() == redhat, fedora, RHEL, SL, centos
            if run_cmd('which rpm', simple=True, log_ok=False):
                cmd = "rpm -q %s" % dep

        found = run_cmd(cmd, simple=True, log_all=False, log_ok=False)

        if not found:
            # fallback for when os-dependency is a binary/library
            cmd = 'which %(dep)s || locate --regexp "/%(dep)s$"' % {'dep': dep}

            found = run_cmd(cmd, simple=True, log_all=False, log_ok=False)

        return found
Beispiel #8
0
    def __init__(self, *args, **kwargs):
        super(EB_GCC, self).__init__(*args, **kwargs)

        self.stagedbuild = False

        if LooseVersion(self.version) >= LooseVersion("4.8.0") and self.cfg[
                'clooguseisl'] and not self.cfg['withisl']:
            raise EasyBuildError(
                "Using ISL bundled with CLooG is unsupported in >=GCC-4.8.0. "
                "Use a seperate ISL: set withisl=True")

        # I think ISL without CLooG has no purpose in GCC < 5.0.0 ...
        if LooseVersion(self.version) < LooseVersion(
                "5.0.0") and self.cfg['withisl'] and not self.cfg['withcloog']:
            raise EasyBuildError("Activating ISL without CLooG is pointless")

        # unset some environment variables that are known to may cause nasty build errors when bootstrapping
        self.cfg.update('unwanted_env_vars', [
            'CPATH', 'C_INCLUDE_PATH', 'CPLUS_INCLUDE_PATH',
            'OBJC_INCLUDE_PATH'
        ])
        # ubuntu needs the LIBRARY_PATH env var to work apparently (#363)
        if get_os_name() not in ['ubuntu', 'debian']:
            self.cfg.update('unwanted_env_vars', ['LIBRARY_PATH'])

        self.platform_lib = get_platform_name(withversion=True)
Beispiel #9
0
    def _os_dependency_check(self, dep):
        """
        Check if dependency is available from OS.
        """
        # - uses rpm -q and dpkg -s --> can be run as non-root!!
        # - fallback on which
        # - should be extended to files later?
        cmd = "exit 1"
        if get_os_name() in ['debian', 'ubuntu']:
            if run_cmd('which dpkg', simple=True, log_ok=False):
                cmd = "dpkg -s %s" % dep
        else:
            # OK for get_os_name() == redhat, fedora, RHEL, SL, centos
            if run_cmd('which rpm', simple=True, log_ok=False):
                cmd = "rpm -q %s" % dep

        found = run_cmd(cmd, simple=True, log_all=False, log_ok=False)

        if not found:
            # fallback for when os-dependency is a binary/library
            cmd = 'which %(dep)s || locate --regexp "/%(dep)s$"' % {'dep': dep}

            found = run_cmd(cmd, simple=True, log_all=False, log_ok=False)

        return found
Beispiel #10
0
    def __init__(self, *args, **kwargs):
        """Initialize custom class variables for Clang."""

        super(EB_Clang, self).__init__(*args, **kwargs)
        self.llvm_src_dir = None
        self.llvm_obj_dir_stage1 = None
        self.llvm_obj_dir_stage2 = None
        self.llvm_obj_dir_stage3 = None
        self.make_parallel_opts = ""

        # RHEL 5.x have a buggy libc.  Building stage 2 will fail.
        if get_os_name() in ['redhat', 'RHEL', 'centos', 'SL'
                             ] and get_os_version().startswith('5.'):
            self.log.error((
                "Can not build clang on %s v5.x: libc is buggy, building stage 2 will fail.  "
                + "See http://stackoverflow.com/questions/7276828/") %
                           get_os_name())
    def handle_jemalloc(self):
        """Figure out whether jemalloc support should be enabled or not."""
        if self.cfg['with_jemalloc'] is None:
            if LooseVersion(self.version) > LooseVersion('1.6'):
                # jemalloc bundled with recent versions of TensorFlow does not work on RHEL 6 or derivatives,
                # so disable it automatically if with_jemalloc was left unspecified
                rh_based_os = get_os_name().split(' ')[0] in ['centos', 'redhat', 'rhel', 'sl']
                if rh_based_os and get_os_version().startswith('6.'):
                    self.log.info("Disabling jemalloc since bundled jemalloc does not work on RHEL 6 and derivatives")
                    self.cfg['with_jemalloc'] = False

            # if the above doesn't disable jemalloc support, then enable it by default
            if self.cfg['with_jemalloc'] is None:
                self.log.info("Enabling jemalloc support by default, since it was left unspecified")
                self.cfg['with_jemalloc'] = True

        else:
            # if with_jemalloc was specified, stick to that
            self.log.info("with_jemalloc was specified as %s, so sticking to it", self.cfg['with_jemalloc'])
Beispiel #12
0
    def __init__(self, *args, **kwargs):
        super(EB_GCC, self).__init__(*args, **kwargs)

        self.stagedbuild = False

        if LooseVersion(self.version) >= LooseVersion("4.8.0") and self.cfg['clooguseisl'] and not self.cfg['withisl']:
            raise EasyBuildError("Using ISL bundled with CLooG is unsupported in >=GCC-4.8.0. "
                                 "Use a seperate ISL: set withisl=True")

        # I think ISL without CLooG has no purpose in GCC < 5.0.0 ...
        if LooseVersion(self.version) < LooseVersion("5.0.0") and self.cfg['withisl'] and not self.cfg['withcloog']:
            raise EasyBuildError("Activating ISL without CLooG is pointless")

        # unset some environment variables that are known to may cause nasty build errors when bootstrapping
        self.cfg.update('unwanted_env_vars', ['CPATH', 'C_INCLUDE_PATH', 'CPLUS_INCLUDE_PATH', 'OBJC_INCLUDE_PATH'])
        # ubuntu needs the LIBRARY_PATH env var to work apparently (#363)
        if get_os_name() not in ['ubuntu', 'debian']:
            self.cfg.update('unwanted_env_vars', ['LIBRARY_PATH'])

        self.platform_lib = get_platform_name(withversion=True)
Beispiel #13
0
 def test_os_name(self):
     """Test getting OS name."""
     os_name = get_os_name()
     self.assertTrue(isinstance(os_name, basestring) or os_name == UNKNOWN)
Beispiel #14
0
#

"""
Easyconfig constants module that provides all constants that can
be used within an Easyconfig file.

:author: Stijn De Weirdt (Ghent University)
:author: Kenneth Hoste (Ghent University)
"""
import os
import platform
from vsc.utils import fancylogger

from easybuild.tools.systemtools import get_shared_lib_ext, get_os_name, get_os_type, get_os_version


_log = fancylogger.getLogger('easyconfig.constants', fname=False)


EXTERNAL_MODULE_MARKER = 'EXTERNAL_MODULE'

# constants that can be used in easyconfig
EASYCONFIG_CONSTANTS = {
    'EXTERNAL_MODULE': (EXTERNAL_MODULE_MARKER, "External module marker"),
    'HOME': (os.path.expanduser('~'), "Home directory ($HOME)"),
    'OS_TYPE': (get_os_type(), "System type (e.g. 'Linux' or 'Darwin')"),
    'OS_NAME': (get_os_name(), "System name (e.g. 'fedora' or 'RHEL')"),
    'OS_VERSION': (get_os_version(), "System version"),
    'SYS_PYTHON_VERSION': (platform.python_version(), "System Python version (platform.python_version())"),
}
    if arch not in KNOWN_ARCH_CONSTANTS:
        print_warning("Using unknown value for ARCH constant: %s", arch)

    return arch


# constants that can be used in easyconfig
EASYCONFIG_CONSTANTS = {
    'ARCH':
    (_get_arch_constant(),
     "CPU architecture of current system (aarch64, x86_64, ppc64le, ...)"),
    'EXTERNAL_MODULE': (EXTERNAL_MODULE_MARKER, "External module marker"),
    'HOME': (os.path.expanduser('~'), "Home directory ($HOME)"),
    'OS_TYPE': (get_os_type(), "System type (e.g. 'Linux' or 'Darwin')"),
    'OS_NAME': (get_os_name(), "System name (e.g. 'fedora' or 'RHEL')"),
    'OS_VERSION': (get_os_version(), "System version"),
    'SYS_PYTHON_VERSION':
    (platform.python_version(),
     "System Python version (platform.python_version())"),
    'SYSTEM': ({
        'name': 'system',
        'version': 'system'
    }, "System toolchain"),
    'OS_PKG_IBVERBS_DEV':
    (('libibverbs-dev', 'libibverbs-devel', 'rdma-core-devel'),
     "OS packages providing ibverbs/infiniband development support"),
    'OS_PKG_OPENSSL_BIN': (('openssl'),
                           "OS packages providing the openSSL binary"),
    'OS_PKG_OPENSSL_LIB': (('libssl', 'libopenssl'),
                           "OS packages providing openSSL libraries"),
 def test_os_name(self):
     """Test getting OS name."""
     os_name = get_os_name()
     self.assertTrue(isinstance(os_name, basestring) or os_name == UNKNOWN)