-
Notifications
You must be signed in to change notification settings - Fork 327
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
Support Swig 4.0 #2976
Support Swig 4.0 #2976
Conversation
Try swig 4.0.0 if available on chocolatey
Allow swig 4.0.2 pass -doxygen flag to swig
…nd swig-out call-site
use 4.0.2 for ci
…lity and account for changes in swig handling of function templates scoping
Use 4.0.0 so as not to force bleeding edge swig
Remove stale comment referring to swig 3.0.9
Update SWIG acquisition script
workaround caching swig
try get source for swig on linux
swig location on linux
SWIG_DIR on linux
swig4.0 on linux
@carmichaelong you may want to take a look/review if @nickbianco is not available |
Relavant issue: #2869 |
From dev meeting today: create Python (and maybe Java) versions of osimC3D and add tests for them. EDIT: We could manually test osimC3D to merge this PR, and then creating a Python version could be a separate PR. |
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.
Reviewed 14 of 14 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @aymanhab)
Bindings/common.i, line 389 at r1 (raw file):
std::map<std::string, std::shared_ptr<OpenSim::AbstractDataTable> >; //%template(StdMapStringTimeSeriesTableVec3) // std::map<std::string, std::shared_ptr<OpenSim::TimeSeriesTable_<SimTK::Vec3> > >;
Is this supposed to be commented out?
OpenSim/Tools/InverseKinematicsTool.h, line 111 at r1 (raw file):
#ifndef SWIG /** @cond **/ // hide from Doxygen #endif
Will this get exposed if Doxygen is installed but not SWIG?
The changes look good, just a few minor comments. Creating a local build now to test osimC3D. |
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.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @nickbianco)
Bindings/common.i, line 389 at r1 (raw file):
Previously, nickbianco (Nicholas Bianco) wrote…
Is this supposed to be commented out?
Yes, this map is used internally and is exposed only by the C3DAdapter class's write method which is never used. If left behind, the code generated by SWIG fails to compile because an Iterator over the Map has to be generated and that was quite difficult to communicate to SWIG and is rather unnecessary.
OpenSim/Tools/InverseKinematicsTool.h, line 111 at r1 (raw file):
Previously, nickbianco (Nicholas Bianco) wrote…
Will this get exposed if Doxygen is installed but not SWIG?
Yes, while running SWIG the block disappears to it can digest comments, if not running SWIG the ifndef/endif is a no-op so Doxygen and any other old code/processor work as expected.
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.
Changes LGTM. I tested osimC3D locally and it seems to work fine. However, I'm having trouble getting a Python environment to work. I was able to get an older version of pre-release 4.2 working (with changes to the install process I commented here: #2968), but the same process hasn't worked for this build (I'm working on Mac).
I don't want to hold this up unnecessarily, but I also want to make sure that installing Python still works with the new swig changes.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @aymanhab)
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.
Sure, I understand, just keep me posted.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @aymanhab)
I'm getting the familiar ImportError issue: A quick Google search suggests that this could be due to circular imports, but nothing in |
@nickbianco Can you do plain python 3.7-9 to isolate Anaconda specific issues? The ci build runs python tests so it must be able to import simbody without an issue I'm guessing |
Note that ci was built against python 3.9.2 (just to test) but we could bring it down to 3.7, this could be the difference between this and 4.2 public release which couldn't go above 3.7 |
@aymanhab that could be the issue. I thought we we're still building against python 3.7. |
Okay, I got it to work with an Anaconda environment with Python 3.9.2. However, it only works if I'm in the
In addition, the opensim package still doesn't appear in the conda package list. I'm not sure if there's a conflict with |
@nickbianco I reverted osx and windows builds to use python 3.7. The warning about version number is rather benign (https://stackoverflow.com/questions/27493792/python-and-pep-440-how-serious-is-this-warning-about-pep440) and will not happen in official releases because we don't embed build date and hash in release versions. |
Thanks @aymanhab, I'll try out the new build. I know the warning is benign, but it mentions potentially loss of compatibility with setuptools, which we need for |
Update: I've tried installing the Python bindings with same Homebrew version of Python 3.7 as the CI uses, but I'm still running into issues. I'm now encountering this error:
I'm there is some issue with Python version compatibility that I'm missing now. This is probably an issue with my environment and not the updates to SWIG. I'm fine with merging this and can sort out the install issues afterwards. |
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.
@aymanhab Okay I finally got a local build working. I needed to set the PYTHONPATH
in addition to DYLD_LIBRARY_PATH
on Mac to get it work. I did this using my own local build of the bindings.
I'm going to try again using the build from CI. If you want, we could test again using the latest version of Python through CI since that was a motivating factor for updating SWIG.
Reviewable status: 13 of 14 files reviewed, all discussions resolved (waiting on @nickbianco)
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.
Actually, I forgot I already had a Python 3.9 build downloaded and set up. Just tested again and it works! So we don't have to force Python 3.7. Once you revert that change and the tests pass, feel free to merge.
Reviewable status: 13 of 14 files reviewed, all discussions resolved (waiting on @nickbianco)
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 @nickbianco much appreciated. So do you prefer we make builds with 3.7 or 3.9? I prefer we fix a python version either way rather than get the randomly chosen version selected by ci.
Reviewable status: 13 of 14 files reviewed, all discussions resolved (waiting on @nickbianco)
I was going back and forth about this, but I think I agree that we should fix to a specific version (until something in Python changes that necessitates a version upgrade). It could make sense to stay at 3.7 since other Python package might not stay as current (like Antoine's issue with NumPy and Tensorflow). |
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.
Reviewed 1 of 1 files at r2.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @aymanhab)
Thanks @nickbianco much appreciated 👍 |
Fixes issue #2524
Brief summary of changes
-Upgrade makefiles to require SWIG 4.0
Testing I've completed
Standard test suite passes, Java bindings work in GUI and comments available in GUI IDE
Looking for feedback on...
How this looks in Matlab and in Python, whether comments are available/helpful
CHANGELOG.md (choose one)
This change is