Monday, November 16, 2020

Re: SWIG doesn't recognize argument in make()

You're not crazy. I've seen similar behavior. Does it work if you remove the underscore? The number?

Who can fathom the esoteric secrets of SWIG?

On Mon, Nov 16, 2020 at 3:06 PM Lukas Haase <lukashaase@gmx.at> wrote:
Additional detail: I tried it again:

$ gr_modtool rm tx_msg2tag
$
$ gr_modtool add test
$ rm -rf build; mkdir build; cd build; cmake ..; make

--> WORKS!!

$ gr_modtool add tx_msg2tag
$ rm -rf build; mkdir build; cd build; cmake ..; make

--> FAILS with the error below.


(of course, I edited the files to replace the <+...+> to make it compile).

It really seems it's the name of the block (tx_msg2tag) that makes things fail.
How can that be?

Lukas

Lukas wrote:
> Hi Cinaed,
>
> *I* am the author of gr-petro ;-)
> This is indeed a SWIG question. Or a question about OOT modules.
>
> I created the module with gr_modtool. I inserted bunch of blocks with "add"
> command. Just this one below does not work. I have no idea why (and it drives
> me crazy).
>
> Hence my questions:
> - What could be the issue?
> - What exactly generates *swigPYTHON_wrap.cxx files ?
> - How are the argument lists for the functions determined?
>
> Thanks,
> Lukas
>
>
>> Hi Lukas - gr-petro is a OOT module - an "out of tree "module - it's not
>> part of gnuradio.
>>
>> You need to contact the author of the module.
>>
>> It's highly unlikely it's a problem with make - it's more likely a
>> mismatch between gr-petro and your installed version of gnuradio.
>>
>> For instance, the OOT was written for a version of gnuradio prior to
>> 3.8.
>>
>> In any case, I couldn't find the gr-petro source code with a Google
>> search so I can't even guess what the problem might be. It also helps to
>> state which OS you're using.
>>
>> -- Cinaed
>>
>>> Hi everyone,
>>>
>>> It's driving me NUTS! SWIG just won't recognize an argument to my make()
>>> function and hence build fails. I have other nearly identical blocks in
>>> the same module that work without issues.
>>>
>>> What exactly generates the *swigPYTHON_wrap.cxx files and how are the
>>> argument lists for the functions determined?
>>>
>>> Here is how my make fails:
>>>
>>> [ 77%] Building CXX object
>>> swig/CMakeFiles/petro_swig.dir/CMakeFiles/petro_swig.dir/petro_swigPYTHO
>>> N_wrap.cxx.o
>>> /home/petro/src/gr38/gr-petro/build/swig/CMakeFiles/petro_swig.dir/petro
>>> _swigPYTHON_wrap.cxx: In function 'PyObject*
>>> _wrap_tx_msg2tag_make(PyObject*, PyObject*)':
>>> /home/petro/src/gr38/gr-petro/build/swig/CMakeFiles/petro_swig.dir/petro
>>> _swigPYTHON_wrap.cxx:18687:48: error: no matching function for call to
>>> 'gr::petro::tx_msg2tag::make()' 18687 | result =
>>> gr::petro::tx_msg2tag::make(); |
>>> ^ In file included from
>>> /home/petro/src/gr38/gr-petro/build/swig/CMakeFiles/petro_swig.dir/petro
>>> _swigPYTHON_wrap.cxx:2881:
>>> /home/petro/src/gr38/gr-petro/lib/../include/petro/tx_msg2tag.h:48:19:
>>> note: candidate: 'static gr::petro::tx_msg2tag::sptr
>>> gr::petro::tx_msg2tag::make(unsigned int)' 48 | static sptr
>>> make(unsigned int time_increment_factor); | ^~~~
>>> /home/petro/src/gr38/gr-petro/lib/../include/petro/tx_msg2tag.h:48:19:
>>> note: candidate expects 1 argument, 0 provided
>>> /home/petro/src/gr38/gr-petro/build/swig/CMakeFiles/petro_swig.dir/petro
>>> _swigPYTHON_wrap.cxx: In function 'PyObject*
>>> _wrap_tx_msg2tag_sptr_make(PyObject*, PyObject*)':
>>> /home/petro/src/gr38/gr-petro/build/swig/CMakeFiles/petro_swig.dir/petro
>>> _swigPYTHON_wrap.cxx:18914:30: error: no matching function for call to
>>> 'gr::petro::tx_msg2tag::make()' 18914 | result = (*arg1)->make();
>>> | ^ In file included from
>>> /home/petro/src/gr38/gr-petro/build/swig/CMakeFiles/petro_swig.dir/petro
>>> _swigPYTHON_wrap.cxx:2881:
>>> /home/petro/src/gr38/gr-petro/lib/../include/petro/tx_msg2tag.h:48:19:
>>> note: candidate: 'static gr::petro::tx_msg2tag::sptr
>>> gr::petro::tx_msg2tag::make(unsigned int)' 48 | static sptr
>>> make(unsigned int time_increment_factor); | ^~~~
>>> /home/petro/src/gr38/gr-petro/lib/../include/petro/tx_msg2tag.h:48:19:
>>> note: candidate expects 1 argument, 0 provided make[2]: ***
>>> [swig/CMakeFiles/petro_swig.dir/build.make:63:
>>> swig/CMakeFiles/petro_swig.dir/CMakeFiles/petro_swig.dir/petro_swigPYTHO
>>> N_wrap.cxx.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:466:
>>> swig/CMakeFiles/petro_swig.dir/all] Error 2 make: *** [Makefile:141:
>>> all] Error 2
>>>
>>> As can be very, very clearly seen, tx_msg2tag::make(unsigned int) has
>>> ONE parameter (time_increment_factor). Yet SWIG wants to call
>>> gr::petro::tx_msg2tag::make().
>>>
>>> I have tried regenerating the file, deleting build directory and
>>> starting from scratch but this error follows me like a nightmare.
>>>
>>> Thanks for suggestions!
>>>
>>> Lukas



No comments:

Post a Comment