-
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
load ssl
and crypto
libs before loading python, for (4.1.2 or ear…
#903
Conversation
I tried it on Android Virtual Device and unfortunately it doesn't work for me. |
@akshayaurora I feel that I lost track of this issue - is this still a good fix for a current bug? |
should cffi be considered here as well? https://github.com/kivy/python-for-android/pull/903/files#diff-58dede73f12c2d1e35c61afbe5f187aaR25 |
and what about other potential libs? does it make sence to have auto detection of everything contained in lib/armeabi-v7a/ in the apk? |
@inclement yes, this is a working fix for the current issue on older androids. @rnixx I would not be comfortable with loading all available libs in that folder... that would mean malicious could be easily injected... is there a easier workaround for this? cffi could definitely be included here https://github.com/kivy/python-for-android/pull/903/files#diff-58dede73f12c2d1e35c61afbe5f187aaR25 |
@dzmitrykrukouski the app would crash on emulator cause of missing OpenGL... please test on actual device. |
@akshayaurora It would be great if libs to load get extracted from installed recipes if there are extensions. Whether there is something to load can be defined on the related recipes. It might be just a text file generated somewhere and read in https://github.com/kivy/python-for-android/blob/master/pythonforandroid/bootstraps/sdl2/build/src/org/kivy/android/PythonUtil.java. What do you think? Btw - libs are loaded in https://github.com/kivy/python-for-android/blob/master/pythonforandroid/bootstraps/webview/build/src/org/kivy/android/PythonUtil.java as well. Maybe the final mechanism needs to be used here too. |
@akshayaurora unfortunately I don't have actual device with Android 4.2 or earlier. |
Some updates
|
@rnixx could you please put up a example that uses needs, uses cffi? I could test with including it. |
@rnixx could you paste that log, would be interesting to see which symbols were not found. |
@akshayaurora ad example -> just add When starting App which has been built with NDK r13b and commented out V/PythonActivity( 6245): About to do super onCreate As said above, when leaving |
This is the error when building with NDK r9c NOT trying to load I/python ( 6652): File "/home/me/workspace/myapp/.buildozer/android/app/myapp/messaging.py", line 22, in You need to import |
And this happens if I try to load D/dalvikvm( 7370): Trying to load lib /data/data/org.foo.myapp/files/app/lib/python2.7/site-packages/_cffi_backend.so 0x4185c8f8 |
@akshayaurora Do you need more / other details? |
@rnixx nope, that's enough details...I think I have seen the getline issue in a older version...searching... |
I was able to resolve the following error (pasted below) by updating 5 copies of PythonUtil.java after searching for them in .buildozer. I inserted the two lines from the github link below the error, in these 5 files and my Android 4.2.2 tablet ran the app flawlessly. I have had this problem since September last year and am very happy KeyWeeUsr was able to guide to the solution, thank you very much. E/dalvikvm( 3869): dlopen("/data/app-lib/com.masterpics.slideshow-1/libpython2.7.so") failed: Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library "libssl1.0.2h.so" needed by "libpython2.7.so"; caused by load_library(linker.cpp:745): library "libssl1.0.2h.so" not found I probably should go back to see if I can remove this code above to see if it is unnecessary in some of the PythonUtil.java files. Below are the list I updated: Thank you all! |
Using this path, I get:
If I comment out the python3.5m from line 18 of the PR, I get
We are using 2.7, and the APK works on Andorid > 4.4. |
@Zen-CODE I've just come around to investigating this, and it's an annoyance that our library loader actually obscures the real errors. If you're still looking at it, could you change the PythonActivity code to:
This should print some more helpful information about what has gone wrong. I think I have it working now, but am not yet sure because it still fails for an emulator-related reason. I did have to work through a couple of unexpected problems, including that building for api 19 didn't work (while 15 appears to). If I'm right about having it working now, I'll fix up this PR and propose a new one for people to test within the next few days. The method here seems solid though. I'm sorry it's taken so long to get around to it, I haven't tackled it before due to the lack of devices with this issue - I would have merged it if it clearly worked for everyone, but as above it has seemed not quite there. |
Insert the above code in PythonActivity.java still gives me this in the logcat.
That being said, I see there are multiple PythonActivity.java files. Which one should be changing? |
Also, building with "android.api = 15" still produces the same error. |
@Zen-CODE My best guess is that your error represents the same problem as openssl, but with libsqlite3.so instead, in which case it could be fixed by adding "sqlite3" to the module loading list. I intend to test sqlite3 myself shortly to confirm this. I'll push my changes to the logging to the master branch shortly, to make it easier to use. Sorry about being unclear about where to apply the changes, the best thing to do is to clean any existing distributions and edit the version in |
I've just pushed my logging improvements to master, so you should be able to get them by pulling that. I'm now investigating sqlite3. |
sqlite3 is in the requirements. Get this error on screen:
And the log has this:
Complete log here: https://gist.github.com/Zen-CODE/79998bb0a569374dde008ab58b8bc3da |
@Zen-CODE Just to be clear, by 'module loading list' I mean the list of strings in PythonUtil.java, not the buildozer.spec requirements. I believe my PR at #1106 should fix this issue. At the very least, it should give an extended log about what it finds (or fails to find) when trying to load sqlite3. |
The log above was generated using PR #1106 changes. |
@Zen-CODE Are you sure it's using the new code? There really should now be more logs than that. Could you paste the full logcat output? |
The log above was generated using PR #1106 changes, but let me do another one. So, I am changing the file: To verify this is the one being used, I do a clean and build and the (deliberate) syntax error I inserted crashes it, so it is using the file. When I use the new version from PR 1106, it crashes with the same libsqlite3 issue, full output here: https://gist.github.com/Zen-CODE/cdca11cb6e57aab7e2962ffd876597b6 |
@Zen-CODE I still can't work out why you wouldn't be seeing the more extended logs - in particular, the line at https://github.com/kivy/python-for-android/pull/1106/files#diff-58dede73f12c2d1e35c61afbe5f187aaR58 should be called for every library, printing output using the "pythonutil" tag. Do you see anything I'm missing here (maybe I'm mistaken!). The actual dist you've built should be in the .buildozer somewhere - I think |
@inclement. Sorry, it just occurred to me that perhaps it the way I capture the log using the "> log.txt" post-fix.
Perhaps the logging you are expecting to not redirect? Or how should I generate the log? |
I'm closing this as superseded by #1106 (now merged), but I'm still not clear if it has fixed the issue for everyone. Feel free to open a new issue if you still experience this problem with the master branch. |
…lier devices)
closes #866