Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

irods_plugin_dependencies needs to pass down ${CMAKE_DL_LIBS} #7736

Open
SwooshyCueb opened this issue May 10, 2024 · 0 comments
Open

irods_plugin_dependencies needs to pass down ${CMAKE_DL_LIBS} #7736

SwooshyCueb opened this issue May 10, 2024 · 0 comments
Assignees
Milestone

Comments

@SwooshyCueb
Copy link
Member

irods_plugin_dependencies links privately to ${CMAKE_DL_LIBS}:

target_link_libraries(
irods_plugin_dependencies
PRIVATE
"${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_filesystem.so"
"${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_random.so"
"${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_system.so"
${CMAKE_DL_LIBS}
)

However, the public header irods_load_plugin.hpp references symbols from libdl in multiple locations:
// =-=-=-=-=-=-=-
// try to open the shared object
const auto rtld_flags = get_plugin_rtld_flags(so_name);
void* handle = dlopen(so_name.c_str(), rtld_flags);
if ( !handle ) {
std::stringstream msg;
msg << "failed to open shared object file [" << so_name
<< "] :: dlerror: is [" << dlerror() << "]";
return ERROR( PLUGIN_ERROR, msg.str() );
}
// =-=-=-=-=-=-=-
// clear any existing dlerrors
dlerror();
// =-=-=-=-=-=-=-
// attempt to load the plugin factory function from the shared object
typedef PluginType* ( *factory_type )( const std::string& , const Ts&... );
factory_type factory = reinterpret_cast< factory_type >( dlsym( handle, "plugin_factory" ) );
char* err = dlerror();
if ( 0 != err || !factory ) {
std::stringstream msg;
msg << "failed to load symbol from shared object handle - plugin_factory"
<< " :: dlerror is [" << err << "]";
dlclose( handle );
return ERROR( PLUGIN_ERROR, msg.str() );
}
rodsLog(LOG_DEBUG, "load_plugin - calling plugin_factory() in [%s]", so_name.c_str());
// =-=-=-=-=-=-=-
// using the factory pointer create the plugin
_plugin = factory( _instance_name, _args... );
if ( !_plugin ) {
std::stringstream msg;
msg << "failed to create plugin object for [" << _plugin_name << "]";
dlclose( handle );
return ERROR( PLUGIN_ERROR, msg.str() );
}

irods_plugin_dependencies must link ${CMAKE_DL_LIBS} publicly to pass down this dependency.
Better yet, the linkage should be moved to the irods_plugin_dependencies_obj target as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant