oracle / graalpython

GraalPy – A high-performance embeddable Python 3 runtime for Java
https://www.graalvm.org/python/
Other
1.24k stars 108 forks source link

External LLVMFunction PyWeakref_NewRef cannot be found #170

Closed rahulmutt closed 3 years ago

rahulmutt commented 4 years ago

While compiling tensorflow I got this error:

ImportError: cannot load /private/var/tmp/_bazel_rahulmuttineni/05d78f517423f5db8d64a08dc69ce173/execroot/org_tensorflow/bazel-out/host/bin/tensorflow/create_tensorflow.python_api_tf_python_api_gen_v2.runfiles/com_google_protobuf/python/google/protobuf/pyext/_message.so: External LLVMFunction PyWeakref_NewRef cannot be found.

I did a quick grep of PyWeakref_NewRef in the graalpython codebase and only found it in a header file and not the corresponding implementation file so I think it needs to be implemented: https://github.com/graalvm/graalpython/blob/master/graalpython/com.oracle.graal.python.cext/src/weakrefobject.c

rahulmutt commented 4 years ago

I found a way to get around this by commenting out the call to PyWeakref_NewRef in the python protobuf C extension which was only creating a dummy weak reference to get around some CPython performance bug for versions < 3. This function should still be implemented though as I'm sure some other C extensions might depend on it.

msimacek commented 3 years ago

I believe this should be already fixed, there's a PyWeakref_NewRef definition in: https://github.com/oracle/graalpython/blob/51a8273923277ead0bbaa1d54d85cacc2f01387f/graalpython/com.oracle.graal.python.cext/src/weakrefobject.c#L57-L64