kou commented on issue #39695:
URL: https://github.com/apache/arrow/issues/39695#issuecomment-1912186637
`llvm_orc_registerEHFrameSectionWrapper` is needed to be visible in the
target process.
For PyArrow case, `llvm_orc_registerEHFrameSectionWrapper` is needed to be
visible in `python` process.
Here are solutions for this case but all of them are subtlety...:
1. Use `os.RTLD_GLOBAL` to import `pyarrow.gandiva`
```python
import sys
import os
sys.setdlopenflags(sys.getdlopenflags() + os.RTLD_GLOBAL)
import pyarrow.gandiva
```
Python use `os.RTLD_LOCAL` by default. So symbols in `libLLVM-17.so` aren't
visible in `python` process.
2. Load `libLLVM-17.so` to `python` process
Use `LD_PRELOAD`:
```console
$ LD_PRELOAD=/lib/llvm-17/lib/libLLVM-17.so python ...
```
Use `ctype` and `os.RTLD_GLOBAL`:
```python
import pyarrow.gandiva as gandiva
import ctypes
import os
import sys
ctypes.CDLL("libLLVM-17.so.1", sys.getdlopenflags() + os.RTLD_GLOBAL)
```
Note: We can't use the `ENABLE_EXPORTS` approach that is used by
https://github.com/llvm/llvm-project/commit/2ad8e6e082e254e5560c1c04b20a9904429d8bf0
because we don't build Python and Python isn't linked to `libLLVM.so`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]