Fix a problem not letting plugins work when the client is built on RedHat and derived systems (Fedora is affected too). Completely avoid apr_dso_load() on Linux (they modified it to open libraries with RTLD_NOW | RTLD_GLOBAL | RTLD_DEEPBIND). Get a standard DSO handle with RTLD_NOW | RTLD_GLOBAL flags instead, and convert it to a valid APR one by using apr_os_handle_put().
This commit is contained in:
@@ -28,6 +28,11 @@
|
|||||||
* COMPLETENESS OR PERFORMANCE.
|
* COMPLETENESS OR PERFORMANCE.
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
#if LL_LINUX
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <apr_portable.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "linden_common.h"
|
#include "linden_common.h"
|
||||||
|
|
||||||
#include "apr_pools.h"
|
#include "apr_pools.h"
|
||||||
@@ -85,9 +90,15 @@ void LLImageJ2C::openDSO()
|
|||||||
j2cimpl_dso_memory_pool.create();
|
j2cimpl_dso_memory_pool.create();
|
||||||
|
|
||||||
//attempt to load the shared library
|
//attempt to load the shared library
|
||||||
|
#if LL_LINUX
|
||||||
|
void *dso_handle = dlopen(dso_path.c_str(), RTLD_NOW | RTLD_GLOBAL);
|
||||||
|
rv = (!dso_handle)?APR_EDSOOPEN:apr_os_dso_handle_put(&j2cimpl_dso_handle,
|
||||||
|
dso_handle, j2cimpl_dso_memory_pool());
|
||||||
|
#else
|
||||||
rv = apr_dso_load(&j2cimpl_dso_handle,
|
rv = apr_dso_load(&j2cimpl_dso_handle,
|
||||||
dso_path.c_str(),
|
dso_path.c_str(),
|
||||||
j2cimpl_dso_memory_pool());
|
j2cimpl_dso_memory_pool());
|
||||||
|
#endif
|
||||||
|
|
||||||
//now, check for success
|
//now, check for success
|
||||||
if ( rv == APR_SUCCESS )
|
if ( rv == APR_SUCCESS )
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ endif (NOT WORD_SIZE EQUAL 32)
|
|||||||
list(APPEND llplugin_SOURCE_FILES ${llplugin_HEADER_FILES})
|
list(APPEND llplugin_SOURCE_FILES ${llplugin_HEADER_FILES})
|
||||||
|
|
||||||
add_library (llplugin ${llplugin_SOURCE_FILES})
|
add_library (llplugin ${llplugin_SOURCE_FILES})
|
||||||
|
if(LINUX)
|
||||||
|
target_link_libraries (llplugin rt dl)
|
||||||
|
endif(LINUX)
|
||||||
|
|
||||||
add_dependencies(llplugin prepare)
|
add_dependencies(llplugin prepare)
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,10 @@
|
|||||||
*
|
*
|
||||||
* @endcond
|
* @endcond
|
||||||
*/
|
*/
|
||||||
|
#if LL_LINUX
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <apr_portable.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "linden_common.h"
|
#include "linden_common.h"
|
||||||
|
|
||||||
@@ -83,16 +87,25 @@ int LLPluginInstance::load(std::string &plugin_file)
|
|||||||
{
|
{
|
||||||
pluginInitFunction init_function = NULL;
|
pluginInitFunction init_function = NULL;
|
||||||
|
|
||||||
|
#if LL_LINUX
|
||||||
|
void *dso_handle = dlopen(plugin_file.c_str(), RTLD_NOW | RTLD_GLOBAL);
|
||||||
|
int result = (!dso_handle)?APR_EDSOOPEN:apr_os_dso_handle_put(&mDSOHandle,
|
||||||
|
dso_handle, AIAPRRootPool::get()());
|
||||||
|
#else
|
||||||
int result = apr_dso_load(&mDSOHandle,
|
int result = apr_dso_load(&mDSOHandle,
|
||||||
plugin_file.c_str(),
|
plugin_file.c_str(),
|
||||||
AIAPRRootPool::get()());
|
AIAPRRootPool::get()());
|
||||||
|
#endif
|
||||||
if(result != APR_SUCCESS)
|
if(result != APR_SUCCESS)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
apr_dso_error(mDSOHandle, buf, sizeof(buf));
|
apr_dso_error(mDSOHandle, buf, sizeof(buf));
|
||||||
|
|
||||||
|
#if LL_LINUX
|
||||||
|
LL_WARNS("Plugin") << "plugin load " << plugin_file << " failed with error " << result << " , additional info string: " << buf << LL_ENDL;
|
||||||
|
#else
|
||||||
LL_WARNS("Plugin") << "apr_dso_load of " << plugin_file << " failed with error " << result << " , additional info string: " << buf << LL_ENDL;
|
LL_WARNS("Plugin") << "apr_dso_load of " << plugin_file << " failed with error " << result << " , additional info string: " << buf << LL_ENDL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(result == APR_SUCCESS)
|
if(result == APR_SUCCESS)
|
||||||
|
|||||||
@@ -32,6 +32,9 @@
|
|||||||
|
|
||||||
#if LL_DBUS_ENABLED
|
#if LL_DBUS_ENABLED
|
||||||
|
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <apr_portable.h>
|
||||||
|
|
||||||
#include "linden_common.h"
|
#include "linden_common.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -71,9 +74,11 @@ bool grab_dbus_syms(std::string dbus_dso_name)
|
|||||||
//attempt to load the shared library
|
//attempt to load the shared library
|
||||||
apr_pool_create(&sSymDBUSDSOMemoryPool, NULL);
|
apr_pool_create(&sSymDBUSDSOMemoryPool, NULL);
|
||||||
|
|
||||||
if ( APR_SUCCESS == (rv = apr_dso_load(&sSymDBUSDSOHandle,
|
void *dso_handle = dlopen(dbus_dso_name.c_str(), RTLD_NOW | RTLD_GLOBAL);
|
||||||
dbus_dso_name.c_str(),
|
rv = (!dso_handle)?APR_EDSOOPEN:apr_os_dso_handle_put(&sSymDBUSDSOHandle,
|
||||||
sSymDBUSDSOMemoryPool) ))
|
dso_handle, sSymDBUSDSOMemoryPool);
|
||||||
|
|
||||||
|
if ( APR_SUCCESS == rv )
|
||||||
{
|
{
|
||||||
INFOMSG("Found DSO: %s", dbus_dso_name.c_str());
|
INFOMSG("Found DSO: %s", dbus_dso_name.c_str());
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ extern "C" {
|
|||||||
|
|
||||||
#include "aiaprpool.h"
|
#include "aiaprpool.h"
|
||||||
#include "apr_dso.h"
|
#include "apr_dso.h"
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <apr_portable.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
@@ -87,9 +89,10 @@ bool grab_pa_syms(std::string pulse_dso_name)
|
|||||||
//attempt to load the shared library
|
//attempt to load the shared library
|
||||||
sSymPADSOMemoryPool.create();
|
sSymPADSOMemoryPool.create();
|
||||||
|
|
||||||
if ( APR_SUCCESS == (rv = apr_dso_load(&sSymPADSOHandle,
|
void *dso_handle = dlopen(pulse_dso_name.c_str(), RTLD_NOW | RTLD_GLOBAL);
|
||||||
pulse_dso_name.c_str(),
|
rv = (!dso_handle)?APR_EDSOOPEN:apr_os_dso_handle_put(&sSymPADSOHandle,
|
||||||
sSymPADSOMemoryPool()) ))
|
dso_handle, sSymPADSOMemoryPool());
|
||||||
|
if ( APR_SUCCESS == rv )
|
||||||
{
|
{
|
||||||
INFOMSG("Found DSO: %s", pulse_dso_name.c_str());
|
INFOMSG("Found DSO: %s", pulse_dso_name.c_str());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user