diff --git a/source/backend/plugin/CarlaPluginDSSI.cpp b/source/backend/plugin/CarlaPluginDSSI.cpp index 047ef6116..bd08d3aeb 100644 --- a/source/backend/plugin/CarlaPluginDSSI.cpp +++ b/source/backend/plugin/CarlaPluginDSSI.cpp @@ -162,7 +162,7 @@ public: { std::snprintf(winIdStr, STR_MAX, P_UINTPTR, winId); ldPreloadValue = (CarlaString(kEngine->getOptions().binaryDir) - + CARLA_OS_SEP_STR "libcarla_interposer-x11.so"); + + "/libcarla_interposer-x11.so"); } else { diff --git a/source/backend/plugin/CarlaPluginJack.cpp b/source/backend/plugin/CarlaPluginJack.cpp index 89696ff82..7b8b96752 100644 --- a/source/backend/plugin/CarlaPluginJack.cpp +++ b/source/backend/plugin/CarlaPluginJack.cpp @@ -119,14 +119,22 @@ protected: CarlaString libjackdir(options.binaryDir); libjackdir += "/jack"; + CarlaString ldpreload; + + if (options.frontendWinId != 0) + { + ldpreload = (CarlaString(options.binaryDir) + + "/libcarla_interposer-x11.so"); + } + const ScopedEngineEnvironmentLocker _seel(kEngine); - const ScopedEnvVar sev1("LD_PRELOAD", nullptr); const ScopedEnvVar sev2("LD_LIBRARY_PATH", libjackdir.buffer()); + const ScopedEnvVar sev1("LD_PRELOAD", ldpreload.isNotEmpty() ? ldpreload.buffer() : nullptr); carla_setenv("CARLA_FRONTEND_WIN_ID", strBuf); - carla_setenv("CARLA_SHM_IDS", fShmIds.buffer()); carla_setenv("CARLA_LIBJACK_SETUP", fNumPorts.buffer()); + carla_setenv("CARLA_SHM_IDS", fShmIds.buffer()); started = fProcess->start(arguments); } diff --git a/source/interposer/interposer-x11.cpp b/source/interposer/interposer-x11.cpp index 453171795..39576f94d 100644 --- a/source/interposer/interposer-x11.cpp +++ b/source/interposer/interposer-x11.cpp @@ -63,6 +63,15 @@ int XMapWindow(Display* display, Window w) if (++sMapWindowCounter != 1) break; + static bool libjackopen = false; + + if (! libjackopen && std::getenv("CARLA_LIBJACK_SETUP") != nullptr) + { + libjackopen = true; + dlopen("libjack.so.0", RTLD_NOW|RTLD_LOCAL); + carla_stdout("------------------------------- libjack opened"); + } + if (const char* const winIdStr = std::getenv("CARLA_ENGINE_OPTION_FRONTEND_WIN_ID")) { CARLA_SAFE_ASSERT_BREAK(winIdStr[0] != '\0');