octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #59422] SWIG failure against Octave 6.0


From: Rafael Laboissiere
Subject: [Octave-bug-tracker] [bug #59422] SWIG failure against Octave 6.0
Date: Fri, 6 Nov 2020 01:51:52 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?59422>

                 Summary: SWIG failure against Octave 6.0
                 Project: GNU Octave
            Submitted by: rlaboiss
            Submitted on: Fri 06 Nov 2020 06:51:50 AM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Other
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 6.0.90
         Discussion Lock: Any
        Operating System: GNU/Linux

    _______________________________________________________

Details:

This is not a bug in Octave, per se. I just noticed that SWIG (a bindings
generator) fails to generate wrappers for Octave 6.0.  I have already reported
<https://github.com/swig/swig/issues/1893> the bug to the upstream authors of
SWIG.  I am also filing the present bug report and hope that the Octave
developers may have insights on how to fix the problem.  Also, notice that the
example below works with Octave 5.2.  The files shown below can also be found
in the ZIP file attached to this bug report.

Let us say that we have the C file below, containing functions that we want to
interface with Octave (example.c):


int fact(int n) {
  if (n <= 1) return 1;
  else return n*fact(n-1);
}

int my_mod(int x, int y) {
   return (x%y);
}


We then create the following interface file (example.i):


%module swig_test
%{
  extern int fact(int n);
  extern int my_mod(int x, int y);
%}

 extern int fact(int n);
 extern int my_mod(int x, int y);


The SWIG bindings would be obtained with these commands:


swig -octave -c++ example.i 
mkoctfile example_wrap.cxx example.c > swig-mkoctfile.log 2>&1 


However, the call to mkoctfile fails.  Here are the contents of the
swig-mkoctfile.log file:


In file included from /usr/include/octave-6.0.90/octave/../octave/ov.h:63,
                 from /usr/include/octave-6.0.90/octave/../octave/ovl.h:38,
                 from
/usr/include/octave-6.0.90/octave/../octave/ov-fcn.h:36,
                 from
/usr/include/octave-6.0.90/octave/../octave/ov-builtin.h:35,
                 from
/usr/include/octave-6.0.90/octave/../octave/defun-int.h:33,
                 from
/usr/include/octave-6.0.90/octave/../octave/defun-dld.h:35,
                 from /usr/include/octave-6.0.90/octave/../octave/oct.h:35,
                 from example_wrap.cxx:175:
example_wrap.cxx: In static member function ‘static void
octave_swig_bound_func::register_type(octave::type_info&)’:
/usr/include/octave-6.0.90/octave/../octave/ov-base.h:193:28: error: invalid
new-expression of abstract class type ‘octave_swig_bound_func’
  193 |     octave_value v (new t ());                                  \
      |                            ^
example_wrap.cxx:1078:3: note: in expansion of macro
‘DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA’
 1078 |   DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_swig_bound_func,
"octave_swig_bound_func", "octave_swig_bound_func");
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
example_wrap.cxx:1026:9: note:   because the following virtual functions are
pure within ‘octave_swig_bound_func’:
 1026 |   class octave_swig_bound_func : public octave_function {
      |         ^~~~~~~~~~~~~~~~~~~~~~
In file included from
/usr/include/octave-6.0.90/octave/../octave/ov-builtin.h:35,
                 from
/usr/include/octave-6.0.90/octave/../octave/defun-int.h:33,
                 from
/usr/include/octave-6.0.90/octave/../octave/defun-dld.h:35,
                 from /usr/include/octave-6.0.90/octave/../octave/oct.h:35,
                 from example_wrap.cxx:175:
/usr/include/octave-6.0.90/octave/../octave/ov-fcn.h:247:3: note:    
‘virtual octave_value_list octave_function::execute(octave::tree_evaluator&,
int, const octave_value_list&)’
  247 |   execute (octave::tree_evaluator& tw, int nargout = 0,
      |   ^~~~~~~
example_wrap.cxx: At global scope:
example_wrap.cxx:1753:10: error: ‘oct_mach_info’ has not been declared
 1753 |          oct_mach_info::float_format fmt) {
      |          ^~~~~~~~~~~~~
example_wrap.cxx:1753:38: error: expected ‘,’ or ‘...’ before
‘fmt’
 1753 |          oct_mach_info::float_format fmt) {
      |                                      ^~~
example_wrap.cxx: In member function ‘octave_value_list
octave_swig_type::member_deref(octave_swig_type::member_value_pair*, const
octave_value_list&)’:
example_wrap.cxx:1025:94: error: invalid new-expression of abstract class type
‘octave_swig_bound_func’
 1025 | #define SWIG_OCTAVE_BOUND_FUNC(func, args) octave_value(new
octave_swig_bound_func(func, args))
      |                                                                       
                      ^
example_wrap.cxx:1257:18: note: in expansion of macro
‘SWIG_OCTAVE_BOUND_FUNC’
 1257 |           return SWIG_OCTAVE_BOUND_FUNC(m->second.function_value(),
args);
      |                  ^~~~~~~~~~~~~~~~~~~~~~
example_wrap.cxx:1025:94: error: invalid new-expression of abstract class type
‘octave_swig_bound_func’
 1025 | #define SWIG_OCTAVE_BOUND_FUNC(func, args) octave_value(new
octave_swig_bound_func(func, args))
      |                                                                       
                      ^
example_wrap.cxx:1265:18: note: in expansion of macro
‘SWIG_OCTAVE_BOUND_FUNC’
 1265 |           return SWIG_OCTAVE_BOUND_FUNC(new
octave_builtin(m->first->method), args);
      |                  ^~~~~~~~~~~~~~~~~~~~~~
example_wrap.cxx: In member function ‘virtual dim_vector
octave_swig_type::dims() const’:
example_wrap.cxx:1338:15: warning: ‘error_state’ is deprecated: [6]: this
variable is obsolete and always has the value 0 [-Wdeprecated-declarations]
 1338 |           if (error_state) return dim_vector(1,1);
      |               ^~~~~~~~~~~
In file included from /usr/include/octave-6.0.90/octave/../octave/oct.h:36,
                 from example_wrap.cxx:175:
/usr/include/octave-6.0.90/octave/../octave/error.h:495:26: note: declared
here
  495 | extern OCTINTERP_API int error_state;
      |                          ^~~~~~~~~~~
example_wrap.cxx:1348:16: warning: ‘error_state’ is deprecated: [6]: this
variable is obsolete and always has the value 0 [-Wdeprecated-declarations]
 1348 |            if (error_state) return dim_vector(1,1);
      |                ^~~~~~~~~~~
In file included from /usr/include/octave-6.0.90/octave/../octave/oct.h:36,
                 from example_wrap.cxx:175:
/usr/include/octave-6.0.90/octave/../octave/error.h:495:26: note: declared
here
  495 | extern OCTINTERP_API int error_state;
      |                          ^~~~~~~~~~~
example_wrap.cxx: At global scope:
example_wrap.cxx:2015:10: error: ‘oct_mach_info’ has not been declared
 2015 |          oct_mach_info::float_format fmt)
      |          ^~~~~~~~~~~~~
example_wrap.cxx:2015:38: error: expected ‘,’ or ‘...’ before
‘fmt’
 2015 |          oct_mach_info::float_format fmt)
      |                                      ^~~
example_wrap.cxx: In member function ‘virtual bool
octave_swig_ref::load_binary(std::istream&, bool, int)’:
example_wrap.cxx:2016:43: error: ‘fmt’ was not declared in this scope; did
you mean ‘fma’?
 2016 |       { return ptr->load_binary(is, swap, fmt); }
      |                                           ^~~
      |                                           fma
example_wrap.cxx: At global scope:
example_wrap.cxx:2125:10: error: ‘oct_mach_info’ has not been declared
 2125 |          oct_mach_info::float_format fmt) {
      |          ^~~~~~~~~~~~~
example_wrap.cxx:2125:38: error: expected ‘,’ or ‘...’ before
‘fmt’
 2125 |          oct_mach_info::float_format fmt) {
      |                                      ^~~
example_wrap.cxx: In function ‘octave_value
SWIG_Octave_GetGlobalValue(std::string)’:
example_wrap.cxx:2377:35: warning: ‘octave_value
octave::symbol_table::global_varval(const string&) const’ is deprecated:
[6]: use 'interpreter::global_varval' instead [-Wdeprecated-declarations]
 2377 |   return symtab.global_varval(name);
      |                                   ^
In file included from
/usr/include/octave-6.0.90/octave/../octave/interpreter.h:58,
                 from /usr/include/octave-6.0.90/octave/../octave/pt-bp.h:35,
                 from
/usr/include/octave-6.0.90/octave/../octave/pt-cmd.h:35,
                 from
/usr/include/octave-6.0.90/octave/../octave/pt-decl.h:36,
                 from
/usr/include/octave-6.0.90/octave/../octave/pt-misc.h:32,
                 from /usr/include/octave-6.0.90/octave/../octave/parse.h:41,
                 from example_wrap.cxx:266:
/usr/include/octave-6.0.90/octave/../octave/symtab.h:199:18: note: declared
here
  199 |     octave_value global_varval (const std::string& name) const;
      |                  ^~~~~~~~~~~~~
example_wrap.cxx: In function ‘void SWIG_Octave_SetGlobalValue(std::string,
const octave_value&)’:
example_wrap.cxx:2386:35: warning: ‘void
octave::symbol_table::global_assign(const string&, const octave_value&)’ is
deprecated: [6]: use 'interpreter::global_assign' instead
[-Wdeprecated-declarations]
 2386 |   symtab.global_assign(name, value);
      |                                   ^
In file included from
/usr/include/octave-6.0.90/octave/../octave/interpreter.h:58,
                 from /usr/include/octave-6.0.90/octave/../octave/pt-bp.h:35,
                 from
/usr/include/octave-6.0.90/octave/../octave/pt-cmd.h:35,
                 from
/usr/include/octave-6.0.90/octave/../octave/pt-decl.h:36,
                 from
/usr/include/octave-6.0.90/octave/../octave/pt-misc.h:32,
                 from /usr/include/octave-6.0.90/octave/../octave/parse.h:41,
                 from example_wrap.cxx:266:
/usr/include/octave-6.0.90/octave/../octave/symtab.h:238:10: note: declared
here
  238 |     void global_assign (const std::string& name,
      |          ^~~~~~~~~~~~~
example_wrap.cxx: In function ‘void
SWIG_Octave_LinkGlobalValue(std::string)’:
example_wrap.cxx:2396:12: error: ‘class octave::symbol_scope’ has no
member named ‘assign’
 2396 |   symscope.assign(name, symtab.global_varval(name));
      |            ^~~~~~
example_wrap.cxx:2396:50: warning: ‘octave_value
octave::symbol_table::global_varval(const string&) const’ is deprecated:
[6]: use 'interpreter::global_varval' instead [-Wdeprecated-declarations]
 2396 |   symscope.assign(name, symtab.global_varval(name));
      |                                                  ^
In file included from
/usr/include/octave-6.0.90/octave/../octave/interpreter.h:58,
                 from /usr/include/octave-6.0.90/octave/../octave/pt-bp.h:35,
                 from
/usr/include/octave-6.0.90/octave/../octave/pt-cmd.h:35,
                 from
/usr/include/octave-6.0.90/octave/../octave/pt-decl.h:36,
                 from
/usr/include/octave-6.0.90/octave/../octave/pt-misc.h:32,
                 from /usr/include/octave-6.0.90/octave/../octave/parse.h:41,
                 from example_wrap.cxx:266:
/usr/include/octave-6.0.90/octave/../octave/symtab.h:199:18: note: declared
here
  199 |     octave_value global_varval (const std::string& name) const;
      |                  ^~~~~~~~~~~~~
example_wrap.cxx:2397:12: error: ‘class octave::symbol_scope’ has no
member named ‘mark_global’
 2397 |   symscope.mark_global(name);
      |            ^~~~~~~~~~~
example_wrap.cxx: In function ‘bool SWIG_Octave_LoadModule(std::string)’:
example_wrap.cxx:2841:23: error: ‘discard_error_messages’ was not declared
in this scope
 2841 |     frame.protect_var(discard_error_messages);         
discard_error_messages = true;
      |                       ^~~~~~~~~~~~~~~~~~~~~~
example_wrap.cxx:2842:23: error: ‘discard_warning_messages’ was not
declared in this scope
 2842 |     frame.protect_var(discard_warning_messages);       
discard_warning_messages = true;
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~
example_wrap.cxx: In function ‘bool
SWIG_Octave_InstallFunction(octave_function*, std::string)’:
example_wrap.cxx:2884:23: error: ‘discard_error_messages’ was not declared
in this scope
 2884 |     frame.protect_var(discard_error_messages);         
discard_error_messages = true;
      |                       ^~~~~~~~~~~~~~~~~~~~~~
example_wrap.cxx:2885:23: error: ‘discard_warning_messages’ was not
declared in this scope
 2885 |     frame.protect_var(discard_warning_messages);       
discard_warning_messages = true;
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~
example_wrap.cxx: In function ‘octave_value_list Fswig_test(const
octave_value_list&, int)’:
example_wrap.cxx:3125:73: error: ‘class octave::interpreter’ has no member
named ‘get_call_stack’
 3125 |     octave::call_stack& stack =
octave::interpreter::the_interpreter()->get_call_stack();
      |                                                                       
 ^~~~~~~~~~~~~~
example_wrap.cxx:3126:33: error: ‘class octave::call_stack’ has no member
named ‘current’
 3126 |     octave_function *me = stack.current();
      |                                 ^~~~~~~





    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 06 Nov 2020 06:51:50 AM UTC  Name: octave-swig-example.zip  Size:
3KiB   By: rlaboiss

<http://savannah.gnu.org/bugs/download.php?file_id=50214>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59422>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]