diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-07-14 10:41:27 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-07-14 10:41:27 +0200 |
| commit | e7478f33908793f79ca197a10744d112f707410f (patch) | |
| tree | 69556c3f978349e05c8737337b3361f278d12c7e /src | |
| parent | 9be89e8ba26dcffc4ae2a6477459dd2c115d1a5b (diff) | |
| download | box64-e7478f33908793f79ca197a10744d112f707410f.tar.gz box64-e7478f33908793f79ca197a10744d112f707410f.zip | |
Make library loaded with absolute path not wrapped (unless BOX64_PREFER_WRAPPED=1 is used)
Diffstat (limited to 'src')
| -rwxr-xr-x | src/include/debug.h | 1 | ||||
| -rwxr-xr-x | src/librarian/library.c | 5 | ||||
| -rwxr-xr-x | src/main.c | 11 |
3 files changed, 13 insertions, 4 deletions
diff --git a/src/include/debug.h b/src/include/debug.h index 5341435f..26bbb8d7 100755 --- a/src/include/debug.h +++ b/src/include/debug.h @@ -23,6 +23,7 @@ extern uintptr_t trace_start, trace_end; extern char* trace_func; #endif extern int allow_missing_libs; +extern int box64_prefer_wrapped; extern int box64_steam; extern int box64_wine; extern int box64_nopulse; // disabling the use of wrapped pulseaudio diff --git a/src/librarian/library.c b/src/librarian/library.c index e6812660..215ac523 100755 --- a/src/librarian/library.c +++ b/src/librarian/library.c @@ -265,18 +265,19 @@ library_t *NewLibrary(const char* path, box64context_t* context) } } int notwrapped = FindInCollection(lib->name, &context->box64_emulated_libs); + int precise = (path && path[0]=='/')?1:0; // check if name is libSDL_sound-1.0.so.1 but with SDL2 loaded, then try emulated first... if(!notwrapped && !strcmp(lib->name, "libSDL_sound-1.0.so.1") && my_context->sdl2lib) notwrapped = 1; // And now, actually loading a library // look for native(wrapped) libs first - if(!notwrapped) + if(!notwrapped && !precise) initNativeLib(lib, context); // then look for a native one if(lib->type==-1) initEmulatedLib(path, lib, context); // still not loaded but notwrapped indicated: use wrapped... - if(lib->type==-1 && notwrapped) + if(lib->type==-1 && notwrapped && !precise) initNativeLib(lib, context); // nothing loaded, so error... if(lib->type==-1) diff --git a/src/main.c b/src/main.c index 5f4e2cf8..d504b2a0 100755 --- a/src/main.c +++ b/src/main.c @@ -56,6 +56,7 @@ int box64_dynarec_trace = 0; int x11threads = 0; int x11glx = 1; int allow_missing_libs = 0; +int box64_prefer_wrapped = 0; int fix_64bit_inodes = 0; int box64_zoom = 0; int box64_steam = 0; @@ -423,7 +424,7 @@ int GatherEnv(char*** dest, const char** env, const char* prog) (*dest)[idx++] = strdup("BOX64_PATH=.:bin"); } if(!ld_path) { - (*dest)[idx++] = strdup("BOX64_LD_LIBRARY_PATH=.:lib"); + (*dest)[idx++] = strdup("BOX64_LD_LIBRARY_PATH=.:lib:lib64"); } // add "_=prog" at the end... if(prog) { @@ -448,7 +449,8 @@ void PrintHelp() { printf(" '-h'|'--help' to print box64 help and quit\n"); printf("You can also set some environment variables:\n"); printf(" BOX64_PATH is the box64 version of PATH (default is '.:bin')\n"); - printf(" BOX64_LD_LIBRARY_PATH is the box64 version LD_LIBRARY_PATH (default is '.:lib')\n"); + printf(" BOX64_LD_LIBRARY_PATH is the box64 version LD_LIBRARY_PATH (default is '.:lib:lib64')\n"); + printf(" BOX64_PREFER_WRAPPED if box64 will use wrapped libs even if the lib is specified with absolute path\n"); printf(" BOX64_LOG with 0/1/2/3 or NONE/INFO/DEBUG/DUMP to set the printed debug info (level 3 is level 2 + BOX64_DUMP)\n"); printf(" BOX64_DUMP with 0/1 to dump elf infos\n"); printf(" BOX64_NOBANNER with 0/1 to enable/disable the printing of box64 version and build at start\n"); @@ -506,6 +508,11 @@ void LoadEnvVars(box64context_t *context) printf_log(LOG_INFO, "\n"); } } + if(getenv("BOX64_PREFER_WRAPPED")) { + if (strcmp(getenv("BOX64_PREFER_WRAPPED"), "1")==0) + box64_prefer_wrapped = 1; + printf_log(LOG_INFO, "BOX64: Prefer Wrapped libs\n"); + } if(getenv("BOX64_NOSIGSEGV")) { if (strcmp(getenv("BOX64_NOSIGSEGV"), "1")==0) |