-
Notifications
You must be signed in to change notification settings - Fork 97
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
adjust library search to work on windows, warn about lib prefix #97
Conversation
Thanks @wjwwood, I'll have a look soon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, thanks ! 👍
}; | ||
|
||
// Prepare to setup the relative file paths. | ||
bool debug_library_suffix = (0 == class_loader::systemLibrarySuffix().compare(0, 1, "d")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that currently systemLibrarySuffix
will always return the non debug version (but that's great to keep logic for handling both)
const char * lib_prefix = "lib"; | ||
if (library_name.rfind(lib_prefix, 0) == 0) { | ||
library_name_alternative = library_name.substr(strlen(lib_prefix)); | ||
RCUTILS_LOG_WARN_NAMED("pluginlib.ClassLoader", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks for adding the warning that'll help converge to the new way of defining them
Thanks for the quick review @mikaelarguedas 👍 |
* remove references to plugin_tool from CMakeLists (#93) * move pluginlib in its own folder (port 83 to ros2 branch) (#95) * move pluginlib in its own folder (port 83 to ros2 branch) * fix most linter errors * forward port of #88 Continue loading classes on error * vs2015 doesnt support __has_include, VS2015 and 2017 have both <files… (#96) * windows contains older version of std filesystem * either <experimental/filesystem> or <filesystem> will work ... use experimental to be namespace-consistent * vs2015 doesnt support __has_include, VS2015 and 2017 have both <filesystem> and <experimental/filesystem> but use std::experimental::filesystem in both cases * adjust library search to work on windows, warn about lib prefix (#97)
This is required for rviz to load
.dll
's on Windows which reside inbin
. Also, all users are probably including the implicitlib
prefix for their libraries explicitly, e.g.:https://github.com/ros2/rviz/blob/4e10a6925d8db08e539ea54997abeb1ed6226767/rviz_default_plugins/plugins_description.xml#L1
This is not so portable because the cmake code uses
<library_name>
which generates a library likelib<library_name>.so
on Linux andlib<library_name>.dylib
on macOS, but<library_name>.dll
on Windows.So, I added the ability for pluginlib to search with and without the
lib
prefix, i.e. if you givelibfoo
it will also search forfoo
, and if you givefoo
it will also search forlibfoo
. However, giving slight preference to the user input without thelib
prefix, I added a warning that prints if you givelibfoo
which suggests you usefoo
instead.Long term, I think we should deprecate this searching and instead use compile time information to store the actual location (relative or absolute) of the library and simply match that with what is in the plugin description
.xml
by name.