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

Java and C# bindings extended analog sensor interfaces do not compile. #1770

Closed
Nicogene opened this issue Jun 25, 2018 · 19 comments
Closed
Assignees
Labels
Component: Bindings swig, python, java, ruby, perl, octave, matlab, lua, csharp, tcl Issue Type: Bug Involves some intervention from a system administrator

Comments

@Nicogene
Copy link
Member

Nicogene commented Jun 25, 2018

Describe the bug
The java bindings doesn't compile since #1756
To Reproduce
Enable CREATE_JAVA and compiles

Output

/home/ngenesio/yarp/build/generated_src/java/yarpJAVA_wrap.cxx:43754:17: error: use of undeclared identifier 'ThreeAxisGyroscope_EXTENDED_INTERFACE_get'
  result = (int)ThreeAxisGyroscope_EXTENDED_INTERFACE_get();
                ^
/home/ngenesio/yarp/build/generated_src/java/yarpJAVA_wrap.cxx:43942:17: error: use of undeclared identifier 'ThreeAxisLinearAccelerometer_EXTENDED_INTERFACE_get'
  result = (int)ThreeAxisLinearAccelerometer_EXTENDED_INTERFACE_get();
                ^
/home/ngenesio/yarp/build/generated_src/java/yarpJAVA_wrap.cxx:44130:17: error: use of undeclared identifier 'ThreeAxisMagnetometer_EXTENDED_INTERFACE_get'
  result = (int)ThreeAxisMagnetometer_EXTENDED_INTERFACE_get();
                ^
/home/ngenesio/yarp/build/generated_src/java/yarpJAVA_wrap.cxx:44318:17: error: use of undeclared identifier 'OrientationSensor_EXTENDED_INTERFACE_get'
  result = (int)OrientationSensor_EXTENDED_INTERFACE_get();
                ^
/home/ngenesio/yarp/build/generated_src/java/yarpJAVA_wrap.cxx:44535:17: error: use of undeclared identifier 'TemperatureSensor_EXTENDED_INTERFACE_get'
  result = (int)TemperatureSensor_EXTENDED_INTERFACE_get();
                ^
/home/ngenesio/yarp/build/generated_src/java/yarpJAVA_wrap.cxx:44723:17: error: use of undeclared identifier 'SixAxisForceTorqueSensor_EXTENDED_INTERFACE_get'
  result = (int)SixAxisForceTorqueSensor_EXTENDED_INTERFACE_get();
                ^
/home/ngenesio/yarp/build/generated_src/java/yarpJAVA_wrap.cxx:44905:17: error: use of undeclared identifier 'ContactLoadCellArray_EXTENDED_INTERFACE_get'
  result = (int)ContactLoadCellArray_EXTENDED_INTERFACE_get();
                ^
/home/ngenesio/yarp/build/generated_src/java/yarpJAVA_wrap.cxx:45070:17: error: use of undeclared identifier 'EncoderArray_EXTENDED_INTERFACE_get'
  result = (int)EncoderArray_EXTENDED_INTERFACE_get();
                ^
/home/ngenesio/yarp/build/generated_src/java/yarpJAVA_wrap.cxx:45235:17: error: use of undeclared identifier 'SkinPatch_EXTENDED_INTERFACE_get'
  result = (int)SkinPatch_EXTENDED_INTERFACE_get();

Configuration (please complete the following information):

  • OS: Ubuntu 16.04
  • yarp version: latest devel
  • compiler: clang 3.8
@Nicogene Nicogene added Issue Type: Bug Involves some intervention from a system administrator Component: Bindings swig, python, java, ruby, perl, octave, matlab, lua, csharp, tcl labels Jun 25, 2018
@Nicogene
Copy link
Member Author

Nicogene commented Jun 25, 2018

Probably I have the build messy because I just noticed that the binding of JAVA are compiled on travis and there they work. I will check tomorrow and eventually close it!

@Nicogene
Copy link
Member Author

I can reproduce it also on a clean build, could be related to the version of swig?
On my machine I have 3.0.8-0ubuntu3

@nunoguedelha
Copy link
Contributor

Hi @Nicogene , ...

regarding the SWIG version

as we generate bindings for Matlab too, we are actually using a SWIG fork that Silvio and I maintain: https://github.com/robotology-dependencies/swig. The default branch is matlab and the latest commit displays the Swig version 3.0.11. I strongly suggest that you get aligned with our SWIG branch.

regarding the BUG

The generated symbols you are seeing are clearly incomplete. You should get IThreeAxisLinearAccelerometers_getNrOfThreeAxisLinearAccelerometers or IThreeAxisLinearAccelerometers_getThreeAxisLinearAccelerometerStatus, etc, and not just ThreeAxisLinearAccelerometer_EXTENDED_INTERFACE_get. You might get the right symbols with the updated SWIG.
Let me know how it goes.

@Nicogene
Copy link
Member Author

Nicogene commented Jul 2, 2018

Hi @nunoguedelha !

I updated to Bionic Beaver and now I have swig 3.0.12 and the problem persists.

I don't know what could be the problem in my case 🤔

@nunoguedelha
Copy link
Contributor

It looks like the preprocessor of SWIG is doing a wrong interpretation of the defines in the interface file .../robotology-superbuild/robotology/YARP/bindings/macrosForMultipleAnalogSensors.i.
We actually pulled an old fix on an issue with %define and #define handling by SWIG: robotology-dependencies/swig#1.

You should really try with the latest commit on the matlab branch in the repo in robotology-dependencies: https://github.com/robotology-dependencies/swig.

@nunoguedelha
Copy link
Contributor

@Nicogene , any news?

@Nicogene
Copy link
Member Author

Nicogene commented Jul 11, 2018

Also @drdanz had my same issue and he has swig 3.0.12 too.
On travis it works because on travis there ins swig 3.0.2.

So if I understood correctly these changes (robotology-dependencies/swig#1) are necessary to compile the java bindings with newer version of swig than 3.0.2.

So this is the situation now

swig version
3.0.2
3.0.8
3.0.11
3.0.11(matlab branch)
3.0.12

We have to fix it, we can't assume that the users use this custom version of swig.

@traversaro
Copy link
Member

I am surprised that 3.0.12 is not working, as the related fix swig/swig#781 should be part of the released version.

@drdanz
Copy link
Member

drdanz commented Jul 11, 2018

Tested clean builds with all "official" swig versions from 3.0.0 to 3.0.12:

swig version
3.0.0
3.0.1
3.0.2
3.0.3
3.0.4
3.0.5
3.0.6
3.0.7
3.0.8
3.0.9
3.0.10
3.0.11
3.0.11 (matlab branch)
3.0.12

On travis we have 3.0.2
The matlab branch is very suspicious, just to be sure, on what system are you building the bindings with the matlab branch, and are you sure that it is not using the system share files (i.e. /usr/share/swig3.0) instead of the custom build ones?

@traversaro
Copy link
Member

traversaro commented Jul 11, 2018

The matlab branch contains explicitly the fix for this issue (swig/swig#781), that was backported in robotology-dependencies/swig#1 . However, I did not test it.

@drdanz
Copy link
Member

drdanz commented Jul 11, 2018

This PR is available both in 3.0.11 and 3.0.12 but none of them seem to work

@nunoguedelha
Copy link
Contributor

nunoguedelha commented Jul 11, 2018

I have tested the matlab branch on MacOS, and also on Linux (icub-30 machine). And I'm sure I was using the custom build swig executable. Apparently the fix was reverted from the official releases after 3.0.2.

@drdanz
Copy link
Member

drdanz commented Jul 25, 2018

Since we are releasing on YARP 3.1.0 next Monday, we need to fix this ASAP.
@traversaro, @nunoguedelha what do you suggest?

Can we insert the broken part in a #if !defined(SWIGJAVA) block?

@traversaro
Copy link
Member

Can we insert the broken part in a #if !defined(SWIGJAVA) block?

I guess yes.

@nunoguedelha
Copy link
Contributor

Can we insert the broken part in a #if !defined(SWIGJAVA) block?

Seems fine to me too.

drdanz added a commit to drdanz/yarp that referenced this issue Jul 25, 2018
@drdanz drdanz changed the title Java Bindings don't compile Java bindings extended analog sensor interfaces do not compile. Jul 26, 2018
@drdanz
Copy link
Member

drdanz commented Jul 26, 2018

#1817 disabled the interfaces for java, I renamed the bug, but I think we shouldn't close this until we actually fix the issue, or swig is fixed upstream...

@Nicogene
Copy link
Member Author

I agree !

@Tobias-Fischer
Copy link
Member

The same happens in C#:

/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx: In function ‘int CSharp_ThreeAxisGyroscope_EXTENDED_INTERFACE_get()’:
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx:35585:59: error: ‘ThreeAxisGyroscope_EXTENDED_INTERFACE_get’ was not declared in this scope
   result = (int)ThreeAxisGyroscope_EXTENDED_INTERFACE_get();
                                                           ^
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx: In function ‘int CSharp_ThreeAxisLinearAccelerometer_EXTENDED_INTERFACE_get()’:
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx:35743:69: error: ‘ThreeAxisLinearAccelerometer_EXTENDED_INTERFACE_get’ was not declared in this scope
   result = (int)ThreeAxisLinearAccelerometer_EXTENDED_INTERFACE_get();
                                                                     ^
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx: In function ‘int CSharp_ThreeAxisMagnetometer_EXTENDED_INTERFACE_get()’:
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx:35901:62: error: ‘ThreeAxisMagnetometer_EXTENDED_INTERFACE_get’ was not declared in this scope
   result = (int)ThreeAxisMagnetometer_EXTENDED_INTERFACE_get();
                                                              ^
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx: In function ‘int CSharp_OrientationSensor_EXTENDED_INTERFACE_get()’:
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx:36059:58: error: ‘OrientationSensor_EXTENDED_INTERFACE_get’ was not declared in this scope
   result = (int)OrientationSensor_EXTENDED_INTERFACE_get();
                                                          ^
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx: In function ‘int CSharp_TemperatureSensor_EXTENDED_INTERFACE_get()’:
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx:36243:58: error: ‘TemperatureSensor_EXTENDED_INTERFACE_get’ was not declared in this scope
   result = (int)TemperatureSensor_EXTENDED_INTERFACE_get();
                                                          ^
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx: In function ‘int CSharp_SixAxisForceTorqueSensor_EXTENDED_INTERFACE_get()’:
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx:36401:65: error: ‘SixAxisForceTorqueSensor_EXTENDED_INTERFACE_get’ was not declared in this scope
   result = (int)SixAxisForceTorqueSensor_EXTENDED_INTERFACE_get();
                                                                 ^
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx: In function ‘int CSharp_ContactLoadCellArray_EXTENDED_INTERFACE_get()’:
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx:36553:61: error: ‘ContactLoadCellArray_EXTENDED_INTERFACE_get’ was not declared in this scope
   result = (int)ContactLoadCellArray_EXTENDED_INTERFACE_get();
                                                             ^
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx: In function ‘int CSharp_EncoderArray_EXTENDED_INTERFACE_get()’:
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx:36691:53: error: ‘EncoderArray_EXTENDED_INTERFACE_get’ was not declared in this scope
   result = (int)EncoderArray_EXTENDED_INTERFACE_get();
                                                     ^
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx: In function ‘int CSharp_SkinPatch_EXTENDED_INTERFACE_get()’:
/home/tobias/robot/yarp/build2/bindings/csharp/yarpCSHARP_wrap.cxx:36829:50: error: ‘SkinPatch_EXTENDED_INTERFACE_get’ was not declared in this scope
   result = (int)SkinPatch_EXTENDED_INTERFACE_get();

I created a patch in #1830

@traversaro traversaro changed the title Java bindings extended analog sensor interfaces do not compile. Java and C# bindings extended analog sensor interfaces do not compile. Aug 21, 2018
traversaro pushed a commit that referenced this issue Aug 21, 2018
@randaz81
Copy link
Member

randaz81 commented Jan 21, 2025

closed because too old. This issue might be not present anymore in newer versions of yarp/swig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Bindings swig, python, java, ruby, perl, octave, matlab, lua, csharp, tcl Issue Type: Bug Involves some intervention from a system administrator
Projects
None yet
Development

No branches or pull requests

6 participants