Open
Description
Presumably, this would let us share precompilation cache between PyCall and PyJulia in more situations [1]: conda-forge/python-feedstock#222 (comment)
[1] Not all situation. For example, non-PIE statically linked python
still won't work.
Metadata
Metadata
Assignees
Labels
No labels
Activity
stevengj commentedon Nov 8, 2018
You can't
dlopen
an executable, can you? Oh, I see that this is indeed possible for PIE executables on some platforms. Not sure if this is safe withpython
but I I guess we could give it a try.Does
ccall(("PyFoo", "/path/to/python"), ...)
work directly, or do we need to explicitly calldlopen
and work with the library handle?isuruf commentedon Nov 8, 2018
Yes, it works.
dlopen
can't be used directly because julia appends a.so
to the path.tkf commentedon Nov 8, 2018
Hmm... So
Py_GetVersion
works butPy_InitializeEx
fails here https://github.com/python/cpython/blob/v3.7.1/Python/sysmodule.c#L2292Any guess why?
(@isuruf BTW, it looks like I don't need
.so
if I pass absolute path to dlopen. Checked with Julia 1.0.1 and master.)I created a conda environment with
create --prefix py defaults::python
which installspython 3.7.1-h0371630_3
and then run:isuruf commentedon Nov 8, 2018
Can you check what Py_IsInitialized gives you?
tkf commentedon Nov 8, 2018
OTOH
Py_InitializeEx
works with /usr/bin/python in Arch Linux.tkf commentedon Nov 8, 2018
@isuruf
Py_IsInitialized
gives me 0tkf commentedon Nov 8, 2018
With
/usr/bin/python
:isuruf commentedon Nov 9, 2018
Okay. Looks like this idea won't work
isuruf commentedon Nov 9, 2018
tkf commentedon Nov 9, 2018
Cool! But do you need to pass
RTLD_LOCAL
? IIUC it would make PyCall incompatible with wheels, right?tkf commentedon Nov 9, 2018
What is the Linux distribution you are using?
isuruf commentedon Nov 9, 2018
Ubuntu 18.04
isuruf commentedon Nov 9, 2018
Libdl.RTLD_LAZY|Libdl.RTLD_GLOBAL
works, butLibdl.RTLD_DEEPBIND
doesn'ttkf commentedon Nov 9, 2018
@isuruf Thanks! Yeah I just figured that out too :)
tkf commentedon Nov 9, 2018
Looks like
RTLD_DEEPBIND
was added due to #189.16 remaining items