try out APPRUN_LD_LIBRARY_PATH
This commit is contained in:
parent
cc482c589c
commit
9454334ddd
@ -2,20 +2,25 @@
|
|||||||
#include "my_application.h"
|
#include "my_application.h"
|
||||||
|
|
||||||
#define RUSTDESK_LIB_PATH "librustdesk.so"
|
#define RUSTDESK_LIB_PATH "librustdesk.so"
|
||||||
// #define RUSTDESK_LIB_PATH "/usr/lib/rustdesk/librustdesk.so"
|
|
||||||
typedef bool (*RustDeskCoreMain)();
|
typedef bool (*RustDeskCoreMain)();
|
||||||
bool gIsConnectionManager = false;
|
bool gIsConnectionManager = false;
|
||||||
|
|
||||||
void print_help_install_pkg(const char* so);
|
void print_help_install_pkg(const char* so);
|
||||||
|
|
||||||
bool flutter_rustdesk_core_main() {
|
bool flutter_rustdesk_core_main() {
|
||||||
|
const char* appdir = getenv("APPDIR");
|
||||||
|
const char* apprun_ld_library_path = getenv("APPRUN_LD_LIBRARY_PATH");
|
||||||
|
if (appdir && apprun_ld_library_path) {
|
||||||
|
std::string new_ld_library_path = std::string(apprun_ld_library_path) + ":" + getenv("LD_LIBRARY_PATH");
|
||||||
|
printf("Setting LD_LIBRARY_PATH to %s\n", new_ld_library_path.c_str()
|
||||||
|
setenv("LD_LIBRARY_PATH", new_ld_library_path.c_str(), 1);
|
||||||
|
}
|
||||||
void* librustdesk = dlopen(RUSTDESK_LIB_PATH, RTLD_LAZY);
|
void* librustdesk = dlopen(RUSTDESK_LIB_PATH, RTLD_LAZY);
|
||||||
if (!librustdesk) {
|
if (!librustdesk) {
|
||||||
fprintf(stderr,"Failed to load \"librustdesk.so\"\n");
|
fprintf(stderr,"Failed to load \"librustdesk.so\"\n");
|
||||||
char* error;
|
char* error;
|
||||||
if ((error = dlerror()) != nullptr) {
|
if ((error = dlerror()) != nullptr) {
|
||||||
fprintf(stderr, "%s\n", error);
|
fprintf(stderr, "%s\n", error);
|
||||||
// libnsl.so.1: cannot open shared object file: No such file or directory
|
|
||||||
char* libmissed = strstr(error, ": cannot open shared object file: No such file or directory");
|
char* libmissed = strstr(error, ": cannot open shared object file: No such file or directory");
|
||||||
if (libmissed != nullptr) {
|
if (libmissed != nullptr) {
|
||||||
*libmissed = '\0';
|
*libmissed = '\0';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user