mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-27 13:07:39 +00:00
Fix error loading libsqlite.so
Vendors are always adding “extra libraries” in /vendor/lib* for their own sake, in this case AS*S loaded with customized `libicuuc.so` for Zenf*ne 5z and led to the failure of dynamic loading libsqlite.so: <quote> db: dlopen failed: cannot locate symbol "UCNV_FROM_U_CALLBACK_ESCAPE_63" referenced by "/apex/com.android.runtime/lib64/libandroidicu.so"... </quote> Signed-off-by: Shaka Huang <shakalaca@gmail.com> * Minor optimizations Co-authored-by: John Wu <topjohnwu@gmail.com>
This commit is contained in:
parent
e864919c0b
commit
cf589f8c64
@ -57,9 +57,9 @@ static void (*android_update_LD_LIBRARY_PATH)(const char *ld_library_path);
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __LP64__
|
#ifdef __LP64__
|
||||||
constexpr char apex_path[] = ":/apex/com.android.runtime/lib64";
|
constexpr char apex_path[] = "/apex/com.android.runtime/lib64:";
|
||||||
#else
|
#else
|
||||||
constexpr char apex_path[] = ":/apex/com.android.runtime/lib";
|
constexpr char apex_path[] = "/apex/com.android.runtime/lib:";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int dl_init = 0;
|
static int dl_init = 0;
|
||||||
@ -80,15 +80,14 @@ static bool dload_sqlite() {
|
|||||||
|
|
||||||
// Inject APEX into LD_LIBRARY_PATH
|
// Inject APEX into LD_LIBRARY_PATH
|
||||||
char ld_path[4096];
|
char ld_path[4096];
|
||||||
android_get_LD_LIBRARY_PATH(ld_path, sizeof(ld_path));
|
memcpy(ld_path, apex_path, sizeof(apex_path));
|
||||||
int len = strlen(ld_path);
|
constexpr int len = sizeof(apex_path) - 1;
|
||||||
strcpy(ld_path + len, apex_path);
|
android_get_LD_LIBRARY_PATH(ld_path + len, sizeof(ld_path) - len);
|
||||||
android_update_LD_LIBRARY_PATH(ld_path);
|
android_update_LD_LIBRARY_PATH(ld_path);
|
||||||
sqlite = dlopen("libsqlite.so", RTLD_LAZY);
|
sqlite = dlopen("libsqlite.so", RTLD_LAZY);
|
||||||
|
|
||||||
// Revert LD_LIBRARY_PATH just in case
|
// Revert LD_LIBRARY_PATH just in case
|
||||||
ld_path[len] = '\0';
|
android_update_LD_LIBRARY_PATH(ld_path + len);
|
||||||
android_update_LD_LIBRARY_PATH(ld_path);
|
|
||||||
}
|
}
|
||||||
DLERR(sqlite);
|
DLERR(sqlite);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user