1From 208fe98f10c580a5a2fb6a8cfdd56de109073925 Mon Sep 17 00:00:00 2001
2From: Frederik Rietdijk <fridh@fridh.nl>
3Date: Sat, 17 Jul 2021 18:36:27 +0200
4Subject: [PATCH] hardcode path to libgomp
5
6---
7 omp/__init__.py | 40 ++++------------------------------------
8 1 file changed, 4 insertions(+), 36 deletions(-)
9
10diff --git a/omp/__init__.py b/omp/__init__.py
11index bddae3063..9ba3678d8 100644
12--- a/omp/__init__.py
13+++ b/omp/__init__.py
14@@ -69,43 +69,11 @@ class OpenMP(object):
15
16 def init_not_msvc(self):
17 """ Find OpenMP library and try to load if using ctype interface. """
18- # find_library() does not search automatically LD_LIBRARY_PATH
19- paths = os.environ.get('LD_LIBRARY_PATH', '').split(':')
20+ libgomp_path = "@gomp@"
21
22- for libomp_name in self.get_libomp_names():
23- if cxx is None or sys.platform == 'win32':
24- # Note: Clang supports -print-file-name, but not yet for
25- # clang-cl as of v12.0.0 (April '21)
26- continue
27-
28- cmd = [cxx, '-print-file-name=' + libomp_name]
29- # the subprocess can fail in various ways in that case just give up
30- try:
31- path = os.path.dirname(check_output(cmd).decode().strip())
32- if path:
33- paths.append(path)
34- except (OSError, CalledProcessError):
35- pass
36-
37- # Try to load find libgomp shared library using loader search dirs
38- libgomp_path = find_library("gomp")
39-
40- # Try to use custom paths if lookup failed
41- for path in paths:
42- if libgomp_path:
43- break
44- path = path.strip()
45- if os.path.isdir(path):
46- libgomp_path = find_library(os.path.join(str(path), "libgomp"))
47-
48- if not libgomp_path:
49- raise ImportError("I can't find a shared library for libgomp,"
50- " you may need to install it or adjust the "
51- "LD_LIBRARY_PATH environment variable.")
52- else:
53- # Load the library (shouldn't fail with an absolute path right?)
54- self.libomp = ctypes.CDLL(libgomp_path)
55- self.version = 45
56+ # Load the library (shouldn't fail with an absolute path right?)
57+ self.libomp = ctypes.CDLL(libgomp_path)
58+ self.version = 45
59
60 def __getattr__(self, name):
61 """
62--
632.32.0
64