Try putting an extra None for parent parameter as the last arg in those
instantiations. Take a look at the flow graph generation for any of the qt
GUI widgets. For some reason pybind doesn’t like the last default param.

On Fri, Jul 3, 2020 at 11:14 AM Volker Schroer <dl1...@gmx.de> wrote:

> Yes,
> __PIC__ is required, and ENABLE_PYTHON, too.
>
> With hardcoded  include directories to add_include in
>   bindtool/core/generator.py I'm able to generate the bindings and build
> the module.
>
> But trying to run the blocks fails with typeError.
>
> For instance
>
>    File
>
> "/home/schroer/gnuradiocomponents/gr-display.orig/python/qa_display_text_msg.py",
> line 30, in test_instance
>      instance = text_msg('TestString')
> TypeError: __init__(): incompatible constructor arguments. The following
> argument types are supported:
>      1. display.display_python.text_msg(label: str, parent: QWidget = 0)
>
> Invoked with: 'TestString'
>
> Or
>
> Traceback (most recent call last):
>    File
> "/home/schroer/gnuradiocomponents/gr-display.orig/python/qa_show_image.py",
> line 32, in test_instance
>      instance = show_image(imagewidth ,
> TypeError: __init__(): incompatible constructor arguments. The following
> argument types are supported:
>      1. display.display_python.show_image(imagewidth: int, imageheight:
> int, parent: QWidget = 0)
>
> Invoked with: 1024, 512, None
>
>
> What am I doing wrong, or what is missing ?
>
> The only difference I can see to my working gr-funcube is the use of a
> QWidget as parameter.
>
> Any hints ?
>
> -- Volker
>
> > In parseheader_generic.py, there is fpic defined, but I think it might
> > need the __PIC__
> >
> >              generator_path, generator_name = utils.find_xml_generator()
> >              xml_generator_config = parser.xml_generator_configuration_t(
> >                  xml_generator_path=generator_path,
> >                  xml_generator=generator_name,
> >                  include_paths=self.include_paths,
> >                  compiler='gcc',
> >                  undefine_symbols=['__PIE__'],
> >
> > #define_symbols=['BOOST_ATOMIC_DETAIL_EXTRA_BACKEND_GENERIC', '__PIC__'],
> >
> > define_symbols=['BOOST_ATOMIC_DETAIL_EXTRA_BACKEND_GENERIC'],
> >                  cflags='-std=c++11 -fPIC')
> >
> > On Wed, Jul 1, 2020 at 11:38 AM Volker Schroer <dl1...@gmx.de
> > <mailto:dl1...@gmx.de>> wrote:
> >
> >     Josh,
> >
> >     meanwhile I found the add_include parameter
> >     in bindtool/core/generator.py and hardcoded there the qt includes.
> >
> >     That leads to
> >
> >     INFO Parsing source file
> >
>  
> "/home/schroer/gnuradiocomponents/gr-display.orig/include/display/display_text_msg.h"
> >     ...
> >     In file included from
> >
>  
> /home/schroer/gnuradiocomponents/gr-display.orig/include/display/display_text_msg.h:33:
> >     In file included from
> >     /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qapplication.h:43:
> >     In file included from
> >     /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qtwidgetsglobal.h:43:
> >     In file included from
> >     /usr/include/x86_64-linux-gnu/qt5/QtGui/qtguiglobal.h:43:
> >     /usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:1187:4: error:
> "You
> >     must build your code with position
> >             independent code if Qt was built with -reduce-relocations. "
> >          "Compile your code with -fPIC
> >             (-fPIE is not enough)."
> >     #  error "You must build your code with position independent code if
> Qt
> >     was built with -reduce-rel...
> >          ^
> >     1 error generated.
> >     Error occurred while running CASTXML:  status:1
> >
> >
> >     So I think , some compiler flags are needed, too.
> >
> >     I'm going to find out how to come across.
> >
> >     In the long run the bind tool will need an additional
> include-directory
> >     parameter.
> >
> >     -- Volker
> >
> >
> >     Am 01.07.20 um 17:02 schrieb Josh:
> >      > Volker,
> >      >
> >      > Glad that the first one worked.  I had to do a little bit of
> >     gymnastics
> >      > to get the gr-qtgui files binded in-tree.  If you look at the
> >     notes in
> >      > gr-utils/bindtool/scripts/bind_gr_module.py, QTGUI required
> >     passing as
> >      > args the include directories to the QT installation.  This is
> because
> >      > pygccxml does some sort of sandboxed compile of the target header
> >     file.
> >      > So gr_modtool bind will need to have those arguments or some other
> >      > script to get around it.  I can take a look at this, but there
> >     might be
> >      > a workaround for getting the bindings generated now.
> >      >
> >      > Josh
> >      >
> >      >
> >      >
> >      >
> >      >
> >      >
> >      > On Wed, Jul 1, 2020 at 5:50 AM Volker Schroer <dl1...@gmx.de
> >     <mailto:dl1...@gmx.de>
> >      > <mailto:dl1...@gmx.de <mailto:dl1...@gmx.de>>> wrote:
> >      >
> >      >     Hi,
> >      >
> >      >     I'm just started to port some of my oot modules to gr 3.9 and
> >     pybind. I
> >      >     followed
> >      >
> >
> https://wiki.gnuradio.org/index.php/GNU_Radio_3.9_OOT_Module_Porting_Guide
> >      >
> >      >     and it worked flawless for my first module gr-funcube.
> >      >
> >      >     Now I'm trying to port gr-display , which requires qt5 to be
> >     built.
> >      >     When I run
> >      >
> >      >     gr_modtool bind display_text_msg
> >      >
> >      >     I get:
> >      >     GNU Radio module name identified: display
> >      >     INFO Parsing source file
> >      >
> >
>  
> "/home/schroer/gnuradiocomponents/gr-display.orig/include/display/display_text_msg.h"
> >      >     ...
> >      >
> >
>  
> /home/schroer/gnuradiocomponents/gr-display.orig/include/display/display_text_msg.h:33:10:
> >      >     fatal error:
> >      >             'qapplication.h' file not found
> >      >     #include <qapplication.h>
> >      >                ^~~~~~~~~~~~~~~~
> >      >     1 error generated.
> >      >     Error occurred while running CASTXML:  status:1
> >      >
> >      >
> >      >     How can I come across this error ?
> >      >
> >      >     -- Volker
> >      >
> >      >
> >      >
> >
>
>

Reply via email to