Repository: numba/numba

Issue:
Build failed: fatal error: omp.h: No such file or directory
<!--

Thanks for opening an issue! To help the Numba team handle your information
efficiently, please first ensure that there is no other issue present that
already describes the issue you have
(search at https://github.com/numba/numba/issues?&q=is%3Aissue).

For more general "how do I do X?" type questions, please speak to us in real
time on https://gitter.im/numba/numba or post to the Numba mailing list
https://groups.google.com/a/continuum.io/forum/#!forum/numba-users.

-->

## Reporting a bug

<!--

Before submitting a bug report please ensure that you can check off these boxes:

-->

- [x] I am using the latest released version of Numba (most recent is visible in
 the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).
- [x] I have included below a minimal working reproducer (if you are unsure how
 to write one see http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports).

<!--

Please include details of the bug here, including, if applicable, what you
expected to happen!

-->

I have added python3, python-llvmlite, python-numpy dependencies for numba-0.48.0 version. Build is failing due to missing omp.h please check this [numba_build_log](https://paste.ubuntu.com/p/9V7HKnvtfr/) 

Discussion:

Patch:
diff --git a/numba/cpython/hashing.py b/numba/cpython/hashing.py
index 5119e8a32..01ec6da94 100644
--- a/numba/cpython/hashing.py
+++ b/numba/cpython/hashing.py
@@ -6,6 +6,7 @@ import math
 import numpy as np
 import sys
 import ctypes
+import warnings
 from collections import namedtuple
 
 import llvmlite.binding as ll
@@ -460,7 +461,22 @@ _hashsecret = _build_hashsecret()
 # ------------------------------------------------------------------------------
 
 
-if _Py_hashfunc_name == 'siphash24':
+if _Py_hashfunc_name in ('siphash24', 'fnv'):
+
+    # Check for use of the FNV hashing alg, warn users that it's not implemented
+    # and functionality relying of properties derived from hashing will be fine
+    # but hash values themselves are likely to be different.
+    if _Py_hashfunc_name == 'fnv':
+        msg = ("FNV hashing is not implemented in Numba. See PEP 456 "
+               "https://www.python.org/dev/peps/pep-0456/ "
+               "for rationale over not using FNV. Numba will continue to work, "
+               "but hashes for built in types will be computed using "
+               "siphash24. This will permit e.g. dictionaries to continue to "
+               "behave as expected, however anything relying on the value of "
+               "the hash opposed to hash as a derived property is likely to "
+               "not work as expected.")
+        warnings.warn(msg)
+
     # This is a translation of CPython's siphash24 function:
     # https://github.com/python/cpython/blob/d1dd6be613381b996b9071443ef081de8e5f3aff/Python/pyhash.c#L287-L413    # noqa: E501
 
@@ -608,10 +624,6 @@ if _Py_hashfunc_name == 'siphash24':
         v0, v1, v2, v3 = _DOUBLE_ROUND(v0, v1, v2, v3)
         t = (v0 ^ v1) ^ (v2 ^ v3)
         return t
-
-elif _Py_hashfunc_name == 'fnv':
-    # TODO: Should this instead warn and switch to siphash24?
-    raise NotImplementedError("FNV hashing is not implemented")
 else:
     msg = "Unsupported hashing algorithm in use %s" % _Py_hashfunc_name
     raise ValueError(msg)


Test patch:
diff --git a/numba/tests/test_hashing.py b/numba/tests/test_hashing.py
index b4760dc0d..d139a229e 100644
--- a/numba/tests/test_hashing.py
+++ b/numba/tests/test_hashing.py
@@ -6,7 +6,9 @@ Test hashing of various supported types.
 import unittest
 
 import sys
+import subprocess
 from collections import defaultdict
+from textwrap import dedent
 
 import numpy as np
 
@@ -23,6 +25,47 @@ def hash_usecase(x):
     return hash(x)
 
 
+class TestHashingSetup(TestCase):
+
+    def test_warn_on_fnv(self):
+        # FNV hash alg variant is not supported, check Numba warns
+        work = """
+        import sys
+        import warnings
+        from collections import namedtuple
+
+        # hash_info is a StructSequence, mock as a named tuple
+        fields = ["width", "modulus", "inf", "nan", "imag", "algorithm",
+                  "hash_bits", "seed_bits", "cutoff"]
+
+        hinfo = sys.hash_info
+        FAKE_HASHINFO = namedtuple('FAKE_HASHINFO', fields)
+
+        fd = dict()
+        for f in fields:
+            fd[f] = getattr(hinfo, f)
+
+        fd['algorithm'] = 'fnv'
+
+        fake_hashinfo = FAKE_HASHINFO(**fd)
+
+        # replace the hashinfo with the fnv version
+        sys.hash_info = fake_hashinfo
+        with warnings.catch_warnings(record=True) as warns:
+            # Cause all warnings to always be triggered.
+            warnings.simplefilter("always")
+            import numba
+            assert len(warns) > 0
+            expect = "FNV hashing is not implemented in Numba. See PEP 456"
+            for w in warns:
+                if expect in str(w.message):
+                    break
+            else:
+                raise RuntimeError("Expected warning not found")
+        """
+        subprocess.check_call([sys.executable, '-c', dedent(work)])
+
+
 class BaseTest(TestCase):
 
     def setUp(self):