-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ctypes.util.find_library() not finding any libraries on Android #1624
Conversation
Just wondering, does ctypes respect $LD_LIBRARY_PATH on Android? I've used this successfully for other purposes but not sure if python's logic will use it correctly. If not it isn't a problem to add a patch. |
@inclement very interesting idea. So your suggestion is to try to set LD_LIBRARY_PATH on startup e.g. with some one-liner in We would need someone to test it with an old phone though (old Android version), some things like that change sometimes on Android |
@Jonast Exactly. For ctypes that should work the same on any Android version, as long as ctypes checks LD_LIBRARY_PATH. I checked the source and it looks like it does on the desktop, so that should work unless it gets messed up by not recognising what platform it's running on. I guess this could solve some problems for other library loading as well, I didn't think about that before. Maybe it could obselete the explicit library loading in PythonUtil.java, but not sure. |
@inclement neat idea! I am marking this WIP for now until I investigated the LD_LIBRARY_PATH alternative |
@inclement okay, so unless I screwed it up totally, relative paths don't work in What are your thoughts on this? Should I also give the absolute path a try, or are we going to go with this patch similar to how the Python 2 recipe already does it? |
I would be interested to know if the absolute path would work. I suspect not, I'm pretty sure nothing that reads LD_LIBRARY_PATH would really care about it. If you can check it then fine, we can merge this patch and it's completely fine, I'll look into making python get the paths in a better way some other time. |
@inclement ok hang on, I'll hack it into my own |
That's fine, I'm really wondering just in case it would work at all for future reference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay for now, it's interesting to wonder how python should actually find the correct file but it seems there's no good solution within the ctypes code right now.
Thanks! |
@inclement ok, I tested this & printed out the absolute path & resulting env & even added |
This is finally my long-delayed followup to #1517 to fix
ctypes.util.find_library()
for Python 3. It should fix the last somewhat showstopper bug to using Python 3 & ctypes out of the box on p4a master ❤️done & tested (with real world python3 app that uses ctypes)