Skip to content

Commit

Permalink
Fix bug when clang compiler is not available. Improve warning message…
Browse files Browse the repository at this point in the history
…s. (#530)
  • Loading branch information
pearu authored Feb 10, 2023
1 parent d6a0f81 commit 2172262
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 7 additions & 1 deletion rbc/ctools.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,14 @@ def __repr__(self):
@staticmethod
def _get_compilers(_cache=[]):
if not _cache:
from numba import _min_llvm_version
v = _min_llvm_version[0]
# TODO: cuda support
for xmode, clang, suffix in [('c++', 'clang++', '.cpp'), ('c', 'clang', '.c')]:
for xmode, clang, suffix in [('c++', f'clang++-{v}', '.cpp'),
('c++', 'clang++', '.cpp'),
('c', f'clang-{v}', '.c'),
('c', 'clang', '.c'),
]:
exe = shutil.which(clang)
if exe is not None:
s, o = run(exe, '--version')
Expand Down
3 changes: 2 additions & 1 deletion rbc/heavydb/remoteheavydb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,8 @@ def compiler(self):
compiler = ctools.Compiler.get(std='c')
if self.debug:
print(f'compiler={compiler}')

if compiler is None:
return
from numba import _min_llvm_version

url = "https://numba.readthedocs.io/en/stable/user/installing.html#version-support-information" # noqa: E501
Expand Down
5 changes: 4 additions & 1 deletion rbc/irtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,10 @@ def compile_instance(func, sig,
library=main_library,
locals={},
pipeline_class=pipeline_class)
except (UnsupportedError, nb_errors.TypingError, nb_errors.LoweringError) as msg:
except UnsupportedError as msg:
warnings.warn(f'Skipping {fname}: {msg.args[1]}')
return
except (nb_errors.TypingError, nb_errors.LoweringError) as msg:
for m in re.finditer(r'UnsupportedError(.*?)\n', str(msg), re.S):
warnings.warn(f'Skipping {fname}:{m.group(0)[18:]}')
break
Expand Down

0 comments on commit 2172262

Please sign in to comment.