File tree Expand file tree Collapse file tree 1 file changed +1
-48
lines changed
Expand file tree Collapse file tree 1 file changed +1
-48
lines changed Original file line number Diff line number Diff line change 1- import os
2- import ctypes
3-
4-
5- def load_shared_library (libname , paths ):
6- for path in paths :
7- lib_path = os .path .join (path , libname )
8- if os .path .exists (lib_path ):
9- return ctypes .CDLL (lib_path , mode = ctypes .RTLD_GLOBAL )
10-
11- raise FileNotFoundError (
12- f"Shared library { libname } not found in { paths } "
13- )
14-
15- # Search LD_LIBRARY_PATH
16- ld_paths = os .environ .get ("LD_LIBRARY_PATH" , "" ).split (":" )
17-
18- if not any (ld_paths ):
19- # Path to the bundled `lib/` directory inside site-packages
20- package_dir = os .path .abspath (os .path .dirname (__file__ ))
21- internal_lib_dir = [os .path .join (package_dir , 'lib' )]
22-
23- # Shared libraries required
24- shared_libs = [
25- 'libgomp.so' ,
26- 'libOPENFHEcore.so.1' ,
27- 'libOPENFHEbinfhe.so.1' ,
28- 'libOPENFHEpke.so.1' ,
29- ]
30-
31- for libname in shared_libs :
32- load_shared_library (libname , internal_lib_dir )
33-
34- from .openfhe import *
35-
36- else :
37- # Shared libraries required
38- # skip 'libgomp.so' if LD_LIBRARY_PATH is set as we should get it from the libgomp.so location
39- shared_libs = [
40- 'libOPENFHEcore.so.1' ,
41- 'libOPENFHEbinfhe.so.1' ,
42- 'libOPENFHEpke.so.1' ,
43- ]
44-
45- for libname in shared_libs :
46- load_shared_library (libname , ld_paths )
47-
48- # from .openfhe import *
1+ from .openfhe import *
You can’t perform that action at this time.
0 commit comments