Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#194 Patch to move from QT3 to QT4[qt3support]

closed-fixed
None
5
2011-08-12
2010-10-20
Gert Wollny
No

It seems that QT3 is outdated and some distributions (like Gentoo) have phased out support for it. With the attached patch the GUI tool is moved to rely on Qt4 by using the qt3 support library. I haven't tested it much, I'm not a Qt expert and there are warnings about not connected signals, although the buttons seem to work like with the QT3 version (i.e. sampling starts stops and the data can be flushed, and the flags selected).

Discussion

1 2 > >> (Page 1 of 2)
    • assigned_to: nobody --> maynardj
     
  • I have no experience with qt development, so I'm going to post a message to the list asking for community help in reviewing your patch. However, some initial comments from me . . .

    1. OProfile currently builds OK with qt3 on my system. But adding this patch and running ./configure as normally, I get the following message:
    Warning: a working Qt not found or GUI disabled; no GUI will be built
    2. On systems where I have qt4 devel packages installed, I can run configure with --enable-qt4 successfully, but then the compilation fails. Unfortunately, the failure is not consistent between distros. On SLES 10 SP1/ppc64, I get the following compile error:
    -----------
    make[3]: Entering directory `/home/mpj/oprof-work/op-qt-update/gui/ui'
    if g++ -DHAVE_CONFIG_H -I. -I. -I../.. -DQT_SHARED -I/usr/include/Qt3Support -I/usr/include/QtGui -W -Wall -fno-common -ftemplate-depth-50 -Werror -DQT3_SUPPORT -g -O2 -MT oprof_start.base.o -MD -MP -MF ".deps/oprof_start.base.Tpo" -c -o oprof_start.base.o oprof_start.base.cpp; \ then mv -f ".deps/oprof_start.base.Tpo" ".deps/oprof_start.base.Po"; else rm -f ".deps/oprof_start.base.Tpo"; exit 1; fi
    In file included from oprof_start.base.cpp:1:
    oprof_start.base.h:4:22: error: qvariant.h: No such file or directory
    -------------------

    On RHEL 6 RC1/ppc64, I get this:
    ------------------
    make[3]: Entering directory `/home/mpj/oprofile/gui/ui'
    g++ -DHAVE_CONFIG_H -I. -I../.. -DQT_SHARED -DQT3_SUPPORT -I/usr/include/Qt3Support -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtNetwork -I/usr/include/QtSql -W -Wall -fno-common -ftemplate-depth-50 -Werror -DQT3_SUPPORT -g -O2 -MT oprof_start.base.o -MD -MP -MF .deps/oprof_start.base.Tpo -c -o oprof_start.base.o oprof_start.base.cpp
    mv -f .deps/oprof_start.base.Tpo .deps/oprof_start.base.Po
    o oprof_start.base.moc.cpp oprof_start.base.h
    make[3]: o: Command not found
    make[3]: [oprof_start.base.moc.cpp] Error 127 (ignored)
    g++ -DHAVE_CONFIG_H -I. -I../.. -DQT_SHARED -DQT3_SUPPORT -I/usr/include/Qt3Support -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtNetwork -I/usr/include/QtSql -W -Wall -fno-common -ftemplate-depth-50 -Werror -DQT3_SUPPORT -g -O2 -MT oprof_start.base.moc.o -MD -MP -MF .deps/oprof_start.base.moc.Tpo -c -o oprof_start.base.moc.o oprof_start.base.moc.cpp
    g++: oprof_start.base.moc.cpp: No such file or directory
    g++: no input files
    -----------------------

    Can you take a look at these issues and post a new patch that addresses these problems? Thanks.

     
  • William Cohen
    William Cohen
    2010-11-05

    I don't know much about qt either. However, I did find information about porting to qt4 at:

    http://doc.trolltech.com/4.2/porting4.html

    According to that qt4 is source and binary incompatible with qt3.

     
  • Gert Wollny
    Gert Wollny
    2010-11-05

    When I wrote that I'm not an QT expert I actually meant, that this is my first time I touch QT code.

    1. This was to be expected, because the patch removes the test for QT3 and changes to code to use the support includes instead of the old QT3 ones.

    2. Could you do a "locate qvariant.h" to see where the file is actually located on this system?

    3. configure didn't find moc and/or uic3, so I guess itÄs not in the system path (on Gentoo it is). Luckily I just found out that the pkg-config files define the location and one can read it out easily. Unfortunately uic3 is not in there, hopefully one can assume that's in the same location as moc.

     
  • I think configure should be a bit smarter -- i.e., automatically determining when to use qt3 versus qt4. I'm not too keen on adding the '--enable-qt4' option. Since qt4 seems to be present on most (all?) distros from the past few years, perhaps qt4 support should be the default and configure would fall back to looking for qt3 support if qt4 was not available (for those stuck on old distros). But then, the source file changes you made would probably be incompatible. So we may want to consider some #ifdef's. I'd rather not if we don't have to. We can try to get some input from the wider community on that question.

    As for the location of qvariant.h on my SLES 10 system, here's what I found:
    /usr/lib/qt3/include/qvariant.h (from qt3-devel-3.3.5-58.34.3 package)
    /usr/include/Qt/qvariant.h (from qt-devel-4.1.0-29.12 package)
    /usr/include/QtCore/qvariant.h (from qt-devel-4.1.0-29.12 package)

     
  • Gert Wollny
    Gert Wollny
    2010-11-05

    I don't think automatically selecting the QT version is a good idea (for a discussion see http://www.gentoo.org/doc/en/articles/autotools-practices.xml last section: Don't abuse "automagic" dependencies.).
    One could, however, enable qt4 by default.

    I think it's possible to achieve compatibility with exactly one #ifdef.

    As for the qvariant.h file, I guess one has to add QtCore to the pkg-config call.

     
  • Gert Wollny
    Gert Wollny
    2011-01-10

    New patch using either qt3 or qt4qt3support

     
  • Gert Wollny
    Gert Wollny
    2011-01-10

    Finally I had the time to review the patch. The following changes were made:
    * The GUI builds now with qt3 or qt4 using qt3support.
    * The command line parameter to enable a gui is --enable-gui. If this parameter is not given then the configure script will look for qt4. If this is not found, the script will exit.
    To compile with qt3, use --enable-gui=qt3. In addition one can give --enable-gui=qt4, --enable-gui - both result in the use of qt4. Finally, it is also possible to disable the gui with --disable-gui.
    * added QtCore to the pkg-config library and flags test
    * when using qt4. moc and uic3 are looked for using pkg-config

    I tested building it on my Gentoo amd64 box and all three version (qt3, qt4, no gui) compile fine.

     
  • The new patch still causes problems running 'configure' on my SLES 10 SP1 box. It works OK on my RHEL 6 box -- builds OK, too. Both systems have qt3-devel and qt-devel-4.x. The qt-related messages on my SLES system are:

    checking for QT... yes
    checking for moc ...
    checking for uic3 ... failed

    The configure quits at this point. Not too helpful of a failure message, I'm afraid. Looking at the pkgconfig/QtCore.pc file on my RHEL 6 system (where configure ran OK), I do see both moc_location and uic_location variables set. But on my SLES system, neither of those variables are set. This may be a bug in SLES 10 SP1, because on a SLES 10 SP2 system, I do see both moc_ and uic_location variables set in the QtCore.pc file. So on that SLES 10 SP2 box, 'configure' runs OK, telling me that QT4 will be used. But then I get the following compile failure in gui/ui:

    Making all in ui
    make[3]: Entering directory `/home/mpj/oprofile/gui/ui'
    if g++ -DHAVE_CONFIG_H -I. -I. -I../.. -DQT_SHARED -I/usr/include/Qt3Support -I/usr/include/QtGui -I/usr/include/QtCore -W -Wall -fno-common -ftemplate-depth-50 -Werror -g -O2 -MT oprof_start.base.o -MD -MP -MF ".deps/oprof_start.base.Tpo" -c -o oprof_start.base.o oprof_start.base.cpp; \ then mv -f ".deps/oprof_start.base.Tpo" ".deps/oprof_start.base.Po"; else rm -f ".deps/oprof_start.base.Tpo"; exit 1; fi
    /usr/include/Qt3Support/q3listview.h:135: error: expected ?,? or ?...? before ?&? token
    /usr/include/Qt3Support/q3listview.h:137: error: expected ?,? or ?...? before ?&? token
    /usr/include/Qt3Support/q3listview.h:138: error: expected ?,? or ?...? before ?&? token
    /usr/include/Qt3Support/q3listview.h:502: error: expected ?,? or ?...? before ?&? token
    /usr/include/Qt3Support/q3listview.h:504: error: expected ?,? or ?...? before ?&? token
    oprof_start.base.cpp: In constructor ?oprof_start_base::oprof_start_base(QWidget*, const char*, bool, Qt::WindowFlags)?:
    oprof_start.base.cpp:12: error: no matching function for call to ?QDialog::QDialog(QWidget*&, const char*&, bool&, Qt::WindowFlags&)?
    /usr/include/QtGui/qdialog.h:123: note: candidates are: QDialog::QDialog(const QDialog&)
    /usr/include/QtGui/qdialog.h:112: note: QDialog::QDialog(QDialogPrivate&, QWidget*, Qt::WindowFlags)
    /usr/include/QtGui/qdialog.h:66: note: QDialog::QDialog(QWidget*, Qt::WindowFlags)
    make[3]: *** [oprof_start.base.o] Error 1

    ---------------------

    By the way, if there's no qt-devel package installed, the configure ends with:
    Checking for QT... no
    This is not a very helpful message. Without your patch, configure ends with:
    Warning: a working Qt not found; no GUI will be built
    which is much better.

    The upshot is that it seems there are too many issues right now to switch to qt4 by default. Do you want to try reworking your patch to make qt3 the default, and provide a qt4 option? If so, please address the message texts I mention above.

     
1 2 > >> (Page 1 of 2)