GauiStori / PyQt-Qwt

Python PyQt wrapper for Qwt6
Other
54 stars 18 forks source link

Compile Error #3

Closed ekigwana closed 6 years ago

ekigwana commented 6 years ago

I tried building the project and ran into some build issues Configuration output:

ekigwana@test ~/PyQt-Qwt $ python configure.py --qwt-incdir=/usr/include/qwt6/
/usr/include/qwt6
Configuring Qwt 6.1.3...
Qwt 6.1.3 is being used.
The Qwt .sip files will be installed in
/usr/lib/python-exec/python2.7/../../../share/sip/PyQt5.
Qwt will be installed in /usr/lib64/python2.7/site-packages/PyQt5.
PyQt 5.10.1 is being used.
Qt 5.10.1 is being used.
sip 4.19.8 is being used.
The sip executable is /usr/bin/sip.
Qwt is being built with 'protected' redefined as 'public'.
The PEP 484 stubs will be installed in
/usr/lib64/python2.7/site-packages/PyQt5.
The Qwt API file will be installed in /usr/share/qt5/qwt/api/python.
Generating the C++ source for the Qwt module...
Generating the .pro file for the Qwt module...
Generating the Qwt API file...
Generating the top-level .pro file...
Generating the Makefiles...

Build output:

g++ -c -pipe -fno-exceptions -O2 -Wall -W -D_REENTRANT -fPIC -DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQWT_PYTHON_WRAPPER -DQWT_DLL -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include/qwt6 -isystem /usr/include/python2.7 -isystem /usr/include/python2.7 -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtSvg -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -I. -isystem /usr/include/libdrm -I/usr/lib64/qt5/mkspecs/linux-g++ -o sipQwtQwtSeriesStoreQwtSetSample.o sipQwtQwtSeriesStoreQwtSetSample.cpp
/home/ekigwana/PyQt-Qwt/Qwt/sipQwtQwtSeriesStoreQwtSetSample.cpp: In function ‘void* array_QwtSeriesStoreQwtSetSample(Py_ssize_t)’:
/home/ekigwana/PyQt-Qwt/Qwt/sipQwtQwtSeriesStoreQwtSetSample.cpp:363:55: error: invalid new-expression of abstract class type ‘QwtSeriesStore<QwtSetSample>’
     return new  ::QwtSeriesStoreQwtSetSample[sipNrElem];
                                                       ^
In file included from sip/qwt_series_store.sip:68:0:
/usr/include/qwt6/qwt_series_store.h:57:7: note:   because the following virtual functions are pure within ‘QwtSeriesStore<QwtSetSample>’:
 class QwtSeriesStore: public virtual QwtAbstractSeriesStore
       ^~~~~~~~~~~~~~
/usr/include/qwt6/qwt_series_store.h:31:18: note:       virtual void QwtAbstractSeriesStore::dataChanged()
     virtual void dataChanged() = 0;
                  ^~~~~~~~~~~
/home/ekigwana/PyQt-Qwt/Qwt/sipQwtQwtSeriesStoreQwtSetSample.cpp: In function ‘void* copy_QwtSeriesStoreQwtSetSample(const void*, Py_ssize_t)’:
/home/ekigwana/PyQt-Qwt/Qwt/sipQwtQwtSeriesStoreQwtSetSample.cpp:370:120: error: invalid new-expression of abstract class type ‘QwtSeriesStore<QwtSetSample>’
     return new  ::QwtSeriesStoreQwtSetSample(reinterpret_cast<const  ::QwtSeriesStoreQwtSetSample *>(sipSrc)[sipSrcIdx]);
                                                                                                                        ^
make[1]: [Makefile:1475: sipQwtQwtSeriesStoreQwtSetSample.o] Error 1 (ignored)
g++ -c -pipe -fno-exceptions -O2 -Wall -W -D_REENTRANT -fPIC -DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQWT_PYTHON_WRAPPER -DQWT_DLL -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include/qwt6 -isystem /usr/include/python2.7 -isystem /usr/include/python2.7 -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtSvg -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -I. -isystem /usr/include/libdrm -I/usr/lib64/qt5/mkspecs/linux-g++ -o sipQwtQwtSeriesStoreQwtIntervalSample.o sipQwtQwtSeriesStoreQwtIntervalSample.cpp
/home/ekigwana/PyQt-Qwt/Qwt/sipQwtQwtSeriesStoreQwtIntervalSample.cpp: In function ‘void* array_QwtSeriesStoreQwtIntervalSample(Py_ssize_t)’:
/home/ekigwana/PyQt-Qwt/Qwt/sipQwtQwtSeriesStoreQwtIntervalSample.cpp:363:60: error: invalid new-expression of abstract class type ‘QwtSeriesStore<QwtIntervalSample>’
     return new  ::QwtSeriesStoreQwtIntervalSample[sipNrElem];
                                                            ^
In file included from sip/qwt_series_store.sip:28:0:
/usr/include/qwt6/qwt_series_store.h:57:7: note:   because the following virtual functions are pure within ‘QwtSeriesStore<QwtIntervalSample>’:
 class QwtSeriesStore: public virtual QwtAbstractSeriesStore
       ^~~~~~~~~~~~~~
/usr/include/qwt6/qwt_series_store.h:31:18: note:       virtual void QwtAbstractSeriesStore::dataChanged()
     virtual void dataChanged() = 0;
                  ^~~~~~~~~~~
/home/ekigwana/PyQt-Qwt/Qwt/sipQwtQwtSeriesStoreQwtIntervalSample.cpp: In function ‘void* copy_QwtSeriesStoreQwtIntervalSample(const void*, Py_ssize_t)’:
/home/ekigwana/PyQt-Qwt/Qwt/sipQwtQwtSeriesStoreQwtIntervalSample.cpp:370:130: error: invalid new-expression of abstract class type ‘QwtSeriesStore<QwtIntervalSample>’
     return new  ::QwtSeriesStoreQwtIntervalSample(reinterpret_cast<const  ::QwtSeriesStoreQwtIntervalSample *>(sipSrc)[sipSrcIdx]);
                                                                                                                                  ^
make[1]: [Makefile:1655: sipQwtQwtSeriesStoreQwtIntervalSample.o] Error 1 (ignored)
g++ -c -pipe -fno-exceptions -O2 -Wall -W -D_REENTRANT -fPIC -DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQWT_PYTHON_WRAPPER -DQWT_DLL -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include/qwt6 -isystem /usr/include/python2.7 -isystem /usr/include/python2.7 -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtSvg -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -I. -isystem /usr/include/libdrm -I/usr/lib64/qt5/mkspecs/linux-g++ -o sipQwtQwtSeriesStoreQPointF.o sipQwtQwtSeriesStoreQPointF.cpp
/home/ekigwana/PyQt-Qwt/Qwt/sipQwtQwtSeriesStoreQPointF.cpp: In function ‘void* array_QwtSeriesStoreQPointF(Py_ssize_t)’:
/home/ekigwana/PyQt-Qwt/Qwt/sipQwtQwtSeriesStoreQPointF.cpp:363:50: error: invalid new-expression of abstract class type ‘QwtSeriesStore<QPointF>’
     return new  ::QwtSeriesStoreQPointF[sipNrElem];
                                                  ^
In file included from sip/qwt_series_store.sip:48:0:
/usr/include/qwt6/qwt_series_store.h:57:7: note:   because the following virtual functions are pure within ‘QwtSeriesStore<QPointF>’:
 class QwtSeriesStore: public virtual QwtAbstractSeriesStore
       ^~~~~~~~~~~~~~
/usr/include/qwt6/qwt_series_store.h:31:18: note:       virtual void QwtAbstractSeriesStore::dataChanged()
     virtual void dataChanged() = 0;
                  ^~~~~~~~~~~
/home/ekigwana/PyQt-Qwt/Qwt/sipQwtQwtSeriesStoreQPointF.cpp: In function ‘void* copy_QwtSeriesStoreQPointF(const void*, Py_ssize_t)’:
/home/ekigwana/PyQt-Qwt/Qwt/sipQwtQwtSeriesStoreQPointF.cpp:370:110: error: invalid new-expression of abstract class type ‘QwtSeriesStore<QPointF>’
     return new  ::QwtSeriesStoreQPointF(reinterpret_cast<const  ::QwtSeriesStoreQPointF *>(sipSrc)[sipSrcIdx]);
GauiStori commented 6 years ago

Hi

Did you patch the qwt header files or copy the qwt_series_data.h qwt_series_store.h to the qwt headers? I will make it more clear in the documentation.

You only need the patched header files to compile the PyQt-Qwt, not Qwt itself.

Regards Gudjon

ekigwana commented 6 years ago

So even better I did the following:

diff --git a/configure.py b/configure.py
index d2ba86d..a7972b8 100755
--- a/configure.py
+++ b/configure.py
@@ -1558,6 +1558,8 @@ INSTALLS += sip
     if includepath:
         pro.write('INCLUDEPATH += %s\n' % includepath)

+    pro.write('INCLUDEPATH += %s\n' % "../header")
+
     # Make sure the SIP include directory is searched before the Python include
     # directory if they are different.
     pro.write('INCLUDEPATH += %s\n' % quote(target_config.sip_inc_dir))
GauiStori commented 6 years ago

Great, thanks. This makes compiling easier.

I hope sometime I can get rid of the patch but until then I will use this addition.

Can I close the case now?

/Gudjon

ekigwana commented 6 years ago

So I got it build but I have a run time error

Traceback (most recent call last):
  File "sysinfo.py", line 5, in <module>
    from PyQt5 import Qwt
ImportError: /usr/lib64/python2.7/site-packages/PyQt5/Qwt.so: undefined symbol: _ZNK22QwtAbstractSeriesStore8dataSizeEv

I ran nm -C -u /usr/lib64/python2.7/site-packages/PyQt5/Qwt.so and got

...
U QwtAbstractSeriesStore::setRectOfInterest(QRectF const&)
...
U QwtAbstractSeriesStore::dataRect() const
U QwtAbstractSeriesStore::dataSize() const
...

ldd shows libqwt6-qt5.so.6 => /usr/lib64/libqwt6-qt5.so.6 (0x00007fa591e67000)

Not sure what to look at next - I'll try recompiling qwt without stripping as look at it as well

GauiStori commented 6 years ago

What Linux version are you using? I tried on my Debian unstable $ for name in *.py; do python $name; done and all the examples work.

Did you clean before adding your configure.py patch?

My nm returns: nm /usr/lib/python2.7/dist-packages/PyQt5/Qwt.so |grep QwtAbstractSeriesStore8dataSize 0000000000074bf0 t _ZNK22QwtAbstractSeriesStore8dataSizeEv 00000000000b5660 t _ZNK25sipQwtAbstractSeriesStore8dataSizeEv

Hope this helps

ekigwana commented 6 years ago

I use Gentoo I'll try from scratch ad see if I can get a better result. I think you can close this issue now thanks for all your help.

Note my nm returns:

nm /usr/lib64/python2.7/site-packages/PyQt5/Qwt.so  |grep QwtAbstractSeriesStore8dataSize
                 U _ZNK22QwtAbstractSeriesStore8dataSizeEv
000000000008cbd0 t _ZNK25sipQwtAbstractSeriesStore8dataSizeEv

gcc version 7.3.0 (Gentoo 7.3.0-r1 p1.1) GNU ld (Gentoo 2.30 p1) 2.30.0

ekigwana commented 6 years ago

The patch above is slick and might work better if a few other things are taken care of.

The compile command is:

g++ -c -pipe -fno-exceptions -O2 -Wall -W -D_REENTRANT -fPIC -DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQWT_PYTHON_WRAPPER -DQWT_DLL -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include/qwt6 -I../header -isystem /usr/include/python2.7 -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtSvg -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -I. -isystem /usr/include/libdrm -I/usr/lib64/qt5/mkspecs/linux-g++ -o sipQwtQwtAbstractLegend.o sipQwtQwtAbstractLegend.cpp

And as you can see -isystem /usr/include/qwt6 comes before -I../header reverse those and the build should work without any issues.

GauiStori commented 6 years ago

I will keep my original way for a while but I will check your way better. I have updated the README file explaining better how to overwrite the original headers.

The -qt4/5 extension to the Qwt library is Debian specific. I added this to be able to install both Qt4 and Qt5 version of the Qwt library at the same time. This is unfortunately not a default behavior of Qwt.

Please let me know if everything works for you now.

ekigwana commented 6 years ago

I manually made links to handle the -qt5 so maybe you could choose at installation to creat the expected soft link and still support multiple slots. I got it work thanks.