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
15 changes: 15 additions & 0 deletions easybuild/easyblocks/l/llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import os
import re
import stat
import tempfile

from easybuild.framework.easyconfig import CUSTOM
from easybuild.toolchains.compiler.clang import Clang
Expand Down Expand Up @@ -130,6 +131,10 @@
'Python3_FIND_VIRTUALENV': 'STANDARD',
}

LLVM_MINIMAL_CPP_EXAMPLE = """
int main(int argc, char** argv){ return 0; }
"""


@contextlib.contextmanager
def _wrap_env(path="", ld_path=""):
Expand Down Expand Up @@ -1675,6 +1680,16 @@ def sanity_check_step(self, custom_paths=None, custom_commands=None, *args, **kw
self._sanity_check_gcc_prefix(gcc_prefix_compilers, self.gcc_prefix, self.installdir)
self._sanity_check_dynamic_linker()

# Check if a simple test program can be built when we link all LLVM libraries.
# This can reveal dependencies we missed to add. We can use GCC for this,
# as this doesn't require any LLVM specific flags.
tmpdir = tempfile.mkdtemp()
write_file(os.path.join(tmpdir, 'minimal.cpp'), LLVM_MINIMAL_CPP_EXAMPLE)
minimal_cpp_compiler_cmd = "cd %s && g++ minimal.cpp -o minimal_cpp " % tmpdir
# Here, we add the system libraries LLVM expects to find
minimal_cpp_compiler_cmd += "$(llvm-config --link-static --system-libs all)"
custom_commands.append(minimal_cpp_compiler_cmd)

return super().sanity_check_step(custom_paths=custom_paths, custom_commands=custom_commands, *args, **kwargs)

def make_module_step(self, *args, **kwargs):
Expand Down