Closed mansourmoufid closed 2 years ago
Rename libfoo.so to foo.so. This has been implemented through LOVE's own require paths since 11.4.
https://github.com/love2d/love/commit/b79b99bbaa60fb283d160782e5b31f953b43760c
Pada tanggal Sel, 15 Feb 2022 04.31, Mansour Moufid < @.***> menulis:
In would like to drop foo.so into the applicationInfo.nativeLibraryDir directory (app/src/main/jniLibs/arm64-v8a/) and do ffi.load("foo"). A few years ago this worked fine, but now fails with the error:
main.lua:6: dlopen failed: library "libfoo.so" not found
When I set the environment variable LUA_CPATH to include getCRequirePath(), LuaJIT is able to find libfoo in package.cpath, and load it properly.
Before:
package.cpath = ./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so
After:
package.cpath = ./?.so;/data/app/~~bA-o3tblNjxoXGxEegyvlQ==/org.love2d.android-B3nOyZj457IR_fUb49FRSw==/lib/arm64/?.so
You can view, comment on, or merge this pull request online at:
https://github.com/love2d/love-android/pull/225 Commit Summary
- 643070c https://github.com/love2d/love-android/pull/225/commits/643070c7535ec3e88e8fdc7eaab11f9cbee52fc5 Initialize the LUA_CPATH environment variable to getCRequirePath().
File Changes
(1 file https://github.com/love2d/love-android/pull/225/files)
- M love/src/main/java/org/love2d/android/GameActivity.java https://github.com/love2d/love-android/pull/225/files#diff-cc323b23aeb8cf150f3193cdc80d36ea7817263ac641057cd1e66bd7d35a90de (8)
Patch Links:
- https://github.com/love2d/love-android/pull/225.patch
- https://github.com/love2d/love-android/pull/225.diff
— Reply to this email directly, view it on GitHub https://github.com/love2d/love-android/pull/225, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZHFFTFVW4742NYGFK5I5LU3FRDNANCNFSM5OMQKSRA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you are subscribed to this thread.Message ID: @.***>
If it still doesn't work then it can be a bug. Please fill bug report instead.
Rename libfoo.so to foo.so.
Oops! 😅 Nevermind.
Also for future reference why this Pull Request is not 100% correct is because 2 things:
android.system.Os
only works in Android 5.0 or later. LOVE 11.x branch must still support Android version down to 4.2 so you need to use SDLActivity.nativeSetEnv
instead.love2d/love@b79b99bbaa60fb283d160782e5b31f953b43760c solves both problems.
In would like to drop foo.so into the applicationInfo.nativeLibraryDir directory (app/src/main/jniLibs/arm64-v8a/) and do ffi.load("foo"). A few years ago this worked fine, but now fails with the error:
When I set the environment variable LUA_CPATH to include getCRequirePath(), LuaJIT is able to find libfoo in package.cpath, and load it properly.
Before:
After: