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

icub.i: Fix compatibility with SWIG 4.2.1 #958

Merged
merged 2 commits into from
Apr 28, 2024

Conversation

traversaro
Copy link
Member

Without this, compilation with SWIG 4.2.1 fails with:

[100%] Building CXX object bindings/CMakeFiles/_icub_python.dir/CMakeFiles/_icub_python.dir/icubPYTHON_wrap.cxx.o
/home/traversaro/robotology-superbuild/build/src/ICUB/bindings/CMakeFiles/_icub_python.dir/icubPYTHON_wrap.cxx: In function ‘PyObject* _wrap_waveletIntegrand(PyObject*, PyObject*)’:
/home/traversaro/robotology-superbuild/build/src/ICUB/bindings/CMakeFiles/_icub_python.dir/icubPYTHON_wrap.cxx:26621:22: error: ‘waveletIntegrand’ was not declared in this scope; did you mean ‘_wrap_waveletIntegrand’?
26621 |     result = (double)waveletIntegrand(arg1,arg2);
      |                      ^~~~~~~~~~~~~~~~
      |                      _wrap_waveletIntegrand
make[2]: *** [bindings/CMakeFiles/_icub_python.dir/build.make:76: bindings/CMakeFiles/_icub_python.dir/CMakeFiles/_icub_python.dir/icubPYTHON_wrap.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:4786: bindings/CMakeFiles/_icub_python.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

This is a bit complicated. Basically, waveletIntegrand is a friend function of icub::ctrl::WaveletEncoder , see https://github.com/robotology/icub-main/blob/v2.5.0/src/libraries/ctrlLib/include/iCub/ctrl/functionEncoder.h#L126 . The reason why it is a friend function and not a method is that it needs to be passed to gsl in https://github.com/robotology/icub-main/blob/v2.5.0/src/libraries/ctrlLib/src/functionEncoder.cpp#L119 (I guess). For some reason, SWIG wants to wrap that function, even if it is not declared in the headers (it is directly defined in C++). I guess it is safe to simply ignore the function, that anyhow is not meant to be called by users outside of icub-main.

Related issues:

Copy link
Member

@pattacini pattacini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@pattacini pattacini merged commit 50d273c into robotology:master Apr 28, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants