Guest User

Untitled

a guest
Feb 10th, 2021
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.82 KB | None | 0 0
  1. test/test_runner.py:11: in get_cpu
  2.     cpu = LLVM_CPU(rtyper=None, stats=FakeStats())
  3. runner.py:14: in __init__
  4.     if not self.InitializeNativeTarget(None):
  5. ../../../rtyper/lltypesystem/rffi.py:313: in wrapper
  6.     res = call_external_function(*real_args)
  7. <281-codegen /home/muke/Programming/Project/pypy/rpython/rtyper/lltypesystem/rffi.py:211>:13: in call_external_function
  8.     res = funcptr(a0)
  9. ../../../rtyper/lltypesystem/lltype.py:1390: in __call__
  10.     return callb(*args)
  11. ../../../rtyper/lltypesystem/ll2ctypes.py:1323: in __call__
  12.     cfunc = get_ctypes_callable(self.funcptr, self.calling_conv)
  13. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  14.  
  15. funcptr = <* fn LLVMInitializeNativeTarget>, calling_conv = 'c'
  16.  
  17.     def get_ctypes_callable(funcptr, calling_conv):
  18.         if not ctypes:
  19.             raise ImportError("ctypes is needed to use ll2ctypes")
  20.    
  21.         def get_on_lib(lib, elem):
  22.             """ Wrapper to always use lib[func] instead of lib.func
  23.            """
  24.             try:
  25.                 return lib[elem]
  26.             except AttributeError:
  27.                 pass
  28.    
  29.         old_eci = funcptr._obj.compilation_info
  30.         funcname = funcptr._obj._name
  31.         if hasattr(old_eci, '_with_ctypes'):
  32.             old_eci = old_eci._with_ctypes
  33.    
  34.         try:
  35.             eci = _eci_cache[old_eci]
  36.         except KeyError:
  37.             eci = old_eci.compile_shared_lib(ignore_a_files=True,
  38.                                              defines=['RPYTHON_LL2CTYPES'])
  39.             _eci_cache[old_eci] = eci
  40.    
  41.         libraries = eci.testonly_libraries + eci.libraries + eci.frameworks
  42.    
  43.         FUNCTYPE = lltype.typeOf(funcptr).TO
  44.         cfunc = None
  45.         if libraries:
  46.             not_found = []
  47.             for libname in libraries:
  48.                 libpath = None
  49.                 ext = platform.so_ext
  50.                 prefixes = platform.so_prefixes
  51.                 for dir in eci.library_dirs:
  52.                     if libpath:
  53.                         break
  54.                     for prefix in prefixes:
  55.                         tryfile = os.path.join(dir, prefix + libname + '.' + ext)
  56.                         if os.path.isfile(tryfile):
  57.                             libpath = tryfile
  58.                             break
  59.                 if not libpath:
  60.                     libpath = ctypes.util.find_library(libname)
  61.                     if not libpath:
  62.                         libpath = _findLib_gcc_fallback(libname)
  63.                     if not libpath and os.path.isabs(libname):
  64.                         libpath = libname
  65.                 if libpath:
  66.                     dllclass = getattr(ctypes, calling_conv + 'dll')
  67.                     # on ie slackware there was need for RTLD_GLOBAL here.
  68.                     # this breaks a lot of things, since passing RTLD_GLOBAL
  69.                     # creates symbol conflicts on C level.
  70.                     clib = dllclass._dlltype(libpath, **load_library_kwargs)
  71.                     cfunc = get_on_lib(clib, funcname)
  72.                     if cfunc is not None:
  73.                         break
  74.                 else:
  75.                     not_found.append(libname)
  76.    
  77.         if cfunc is None:
  78.             if _FREEBSD and funcname in ('dlopen', 'fdlopen', 'dlsym', 'dlfunc', 'dlerror', 'dlclose'):
  79.                 cfunc = rtld_default_lib[funcname]
  80.             else:
  81.                 cfunc = get_on_lib(standard_c_lib, funcname)
  82.             # XXX magic: on Windows try to load the function from 'kernel32' too
  83.             if cfunc is None and hasattr(ctypes, 'windll'):
  84.                 cfunc = get_on_lib(ctypes.windll.kernel32, funcname)
  85.             if cfunc is None and hasattr(ctypes, 'windll'):
  86.                 cfunc = get_on_lib(ctypes.cdll.msvcrt, funcname)
  87.    
  88.         if cfunc is None:
  89.             # function name not found in any of the libraries
  90.             if not libraries:
  91.                 place = 'the standard C library (missing libraries=...?)'
  92.             elif len(not_found) == len(libraries):
  93.                 if len(not_found) == 1:
  94.                     raise NotImplementedError(
  95.                         'cannot find the library %r' % (not_found[0],))
  96.                 else:
  97.                     raise NotImplementedError(
  98.                         'cannot find any of the libraries %r' % (not_found,))
  99.             elif len(libraries) == 1:
  100.                 place = 'library %r' % (libraries[0],)
  101.             else:
  102.                 place = 'any of the libraries %r' % (libraries,)
  103.                 if not_found:
  104.                     place += ' (did not find %r)' % (not_found,)
  105.             raise NotImplementedError("function %r not found in %s" % (
  106. >               funcname, place))
  107. E           NotImplementedError: function 'LLVMInitializeNativeTarget' not found in library 'LLVM-11'
Add Comment
Please, Sign In to add comment