Don't call LoadOpenSimLibrary("osimActuators") in tests #4143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Potential fix for issue #4139
(Not-so-)Brief summary of changes
Based on comments and commits these
LoadOpenSimLibrary("osimActuators")calls exist because the osimActuators shared library "is not automatically loaded on anything other than clang". The reason for this is that the tests in question do not actually reference anything in osimActuators directly (e.g., call any of its functions) so the linker sees this and decides there's no need to record the dependency in the executable. And thus osimActuators is not loaded when the executable is run.If we instead just call one of its functions the linker will record the dependency in the test executable and the osimActuators library will get loaded automatically.
Given that the only reason we need osimActuators is because the data files these tests load contain objects defined in and registered by that library, perhaps the most appropriate function to call would be
RegisterTypes_osimActuators(). That works but then we end up registering the osimActuators types twice (first time being when the library is loaded). So I went with just default-instantiating what looks like one of the most common Actuator classes given that we're loading Actuators from the data files.I think there are probably linker-specific methods to make this work but it seems like the above is probably going to be simpler.
Testing I've completed
Ran tests locally on Linux. Only 5 Moco tests failed, but this is true even for the
mainbranch.Looking for feedback on...
The method is still a bit of a hack so any suggestions are welcome but I think it's definitely better than calling
LoadOpenSimLibrary().CHANGELOG.md
This change is