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

call of overloaded rb_define_virtual_variable is ambiguous #187

Open
majioa opened this issue Oct 12, 2021 · 2 comments
Open

call of overloaded rb_define_virtual_variable is ambiguous #187

majioa opened this issue Oct 12, 2021 · 2 comments
Labels
scripting Scripting issues (Python, Ruby...)

Comments

@majioa
Copy link

majioa commented Oct 12, 2021

Hello I've got the many following errors during compilation ruby module:

cd /usr/src/RPM/BUILD/canorus-0.7.3.git45e82ec/x86_64-alt-linux/src && /usr/bin/c++ -DCANORUS_VERSION=\"0.8.0rc1\" -DCanorusRuby_EXPORTS -DDEFAULT_DATA_DIR=\"/usr/share/canorus\" -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -DUSE_RUBY -DUSE_SWIG -D__LINUX_ALSA__ -I/usr/src/RPM/BUILD/canorus-0.7.3.git45e82ec/src -I/usr/src/RPM/BUILD/canorus-0.7.3.git45e82ec/src/zlib -I/usr/src/RPM/BUILD/canorus-0.7.3.git45e82ec/src/core -I/usr/src/RPM/BUILD/canorus-0.7.3.git45e82ec/src/ui -I/usr/src/RPM/BUILD/canorus-0.7.3.git45e82ec/src/widgets -I/usr/src/RPM/BUILD/canorus-0.7.3.git45e82ec/src/import -I/usr/src/RPM/BUILD/canorus-0.7.3.git45e82ec/x86_64-alt-linux/src -I/usr/include/x86_64-linux -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtCore -isystem /usr/share/qt5/../../lib64/qt5/mkspecs/linux-g++ -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtSvg -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtXml -isystem /usr/include/qt5/QtPrintSupport -pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto -Wno-error=deprecated-declarations -Wno-error=return-type -Wno-error -O2 -Wno-error=deprecated-declarations -Wno-error=return-type -Wno-deprecated-declarations -Wno-return-type -Wno-unused-variable -Wno-error -fPIC -DSWIGCPP -Wno-error=deprecated-declarations -Wno-return-type -fPIC -std=gnu++14 -MD -MT src/CMakeFiles/CanorusRuby.dir/canorusrubyRUBY_wrap.cxx.o -MF CMakeFiles/CanorusRuby.dir/canorusrubyRUBY_wrap.cxx.o.d -o CMakeFiles/CanorusRuby.dir/canorusrubyRUBY_wrap.cxx.o -c /usr/src/RPM/BUILD/canorus-0.7.3.git45e82ec/x86_64-alt-linux/src/canorusrubyRUBY_wrap.cxx
/usr/src/RPM/BUILD/canorus-0.7.3.git45e82ec/x86_64-alt-linux/src/canorusrubyRUBY_wrap.cxx: In function 'void SWIG_RubyInitializeTrackings()':
/usr/src/RPM/BUILD/canorus-0.7.3.git45e82ec/x86_64-alt-linux/src/canorusrubyRUBY_wrap.cxx:1263:29: error: call of overloaded 'rb_define_virtual_variable(const char [21], VALUE (&)(...), NULL)' is ambiguous
 1263 |   rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", swig_ruby_trackings_count, NULL);
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/ruby/ruby.h:2863,
                 from /usr/include/ruby.h:33,
                 from /usr/src/RPM/BUILD/canorus-0.7.3.git45e82ec/x86_64-alt-linux/src/canorusrubyRUBY_wrap.cxx:879:
/usr/include/ruby/backward/cxxanyargs.hpp:59:1: note: candidate: 'void ruby::backward::cxxanyargs::rb_define_virtual_variable(const char*, VALUE (*)(...), void (*)(...))'
   59 | rb_define_virtual_variable(const char *q, type *w, void_type *e)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/ruby/backward/cxxanyargs.hpp:90:1: note: candidate: 'void ruby::backward::cxxanyargs::rb_define_virtual_variable(const char*, VALUE (*)(...), void (*)(VALUE, ID, VALUE*))'
   90 | rb_define_virtual_variable(const char *q, type *w, rb_gvar_setter_t *e)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
gmake[2]: *** [src/CMakeFiles/CanorusRuby.dir/build.make:136: src/CMakeFiles/CanorusRuby.dir/canorusrubyRUBY_wrap.cxx.o] Error 1
gmake[2]: Leaving directory '/usr/src/RPM/BUILD/canorus-0.7.3.git45e82ec/x86_64-alt-linux'
gmake[2]: *** Waiting for unfinished jobs....
gmake[2]: Entering directory '/usr/src/RPM/BUILD/canorus-0.7.3.git45e82ec/x86_64-alt-linux'

It seems that some erroneous code for function rb_define_virtual_variable is used. So, how it can be fixed?

@matevz
Copy link
Member

matevz commented Dec 26, 2022

Ruby support is a bit rusty. If you don't need ruby support, you can always do cmake -DNO_RUBY=1 to avoid ruby-related compilation errors.

@matevz matevz added the scripting Scripting issues (Python, Ruby...) label Dec 27, 2022
@suamor
Copy link
Collaborator

suamor commented Jan 1, 2023

I remember that the python swig interface had similar problems, so we should have a look how it was fixed on python side.
Apart from that we discussed it a few years ago what should happen with our binding interface but did not come to a final conclusion.

Generally I don't see a way around swig itself. Most programs use only one scripting language for plugin (and python is very commonly used as well as Lua).

In the notation case a lot of languages make sense to have support without the pain to implement a specific language binding interface.

Back to ruby (and this is similar for all languages), one person is needed that has experience in this kind of language. Regarding me while I like ruby as language over python (2.x) I had no opportunities in my projects to use it.

Another problem is that Qt6 is getting more and more important and we need to do the switch relatively soon. On the other hand ruby does not have any qt5 support and is not listed as qt supported language.

This means anything you do on UI level requiring Qt you need to handle via an extra Ruby specific interface (i.e. "simple" types like qstring, qlist, qint needs to be converted to their ruby types).

Summarized currently ruby support cannot be done by Canorus because of lack of Qt by ruby itself. When somebody with ruby experience comes up with solutions how to interface ruby we will gladly support it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scripting Scripting issues (Python, Ruby...)
Projects
None yet
Development

No branches or pull requests

3 participants