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

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

[Octave-bug-tracker] [bug #40252] Make GUI compatible with both Qt4 and


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #40252] Make GUI compatible with both Qt4 and Qt5
Date: Mon, 02 May 2016 17:45:27 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0

Follow-up Comment #12, bug #40252 (project octave):

This looks like a good place to comment on my experience compiling under Linux
Mint and only having Qt5 installed.  I will write a summary below, but the
executive summary is that I think it would make sense to put the configuration
in place for Qt5 or Qt4 and not worry about how Qt5 compiles for the moment. 
Those having Qt5 installed can easily help with debugging.  (I quit when
running into all sorts of compilation errors under Qt5, but they seemed very
repetitive with the same error showing up time and again.)  However, if Qt5 is
selected, be sure to have a message like

WARNING: Qt5 has been selected, but Qt5 support is in development and those
wanting a stable version should select option --with-qt=qt4.

The reason is that the GUI is compiled way at the end, so a message would
avoid an hour of recompiling.

Also, I'd say judging from the changeset that Rik removed, that Octave might
not be going about this configuration as sleekly as it could.  gnuplot seems
to have it right with simply basing Qt5 lrelease, uic, rcc and moc off of the
pkg-config result for searching for package Qt5Core, etc.  The reason is I'm
not sure that uic-qt5 will ever exist because I think package managers have
organized Qt5 a bit differently.  I think it is rather straightforward to just
first check for Qt5Core, etc., and if that exists then check for [qt5
base]/bin/lrelease, etc.  If those aren't present then give an error.  Don't
rely on the /usr/bin/uic, etc. because that seems to be tied directly to the
Qt4 sources, even if Qt4 isn't installed.

OK, below is my summary, and I'll attach a short diff file of changes I made.


I upgraded to Linux Mint (based on Ubuntu's database, I believe).  Compilation
generally went well, except for the Qt portion.  Because Qt4 was a bit out of
date for gnuplot, I used Qt5 to compile that project.

However, using Qt5 in Octave didn't work.  I'll described how I made
configuration and compilation work, and perhaps someone can shape what I did
into a few configuration tests to make things work out of the box for Linux
Mint.  The nice thing is that it only takes but a few minutes into compilation
to know if the whole configuration is correct.


The first problem was that the package configuration program couldn't find
these modules:

  QT_MODULES="QtCore QtGui QtNetwork QtOpenGL"

so configuration gave major warnings and complaints about including the path
where QtCore.pc is, etc.  However, I've checked my system's list of installed
packages and see

[snipped non-Qt packages from the following list]

sebald@ ~ $ pkg-config --list-all
Qt5Test                        Qt5 Test - Qt Unit Testing Library
Qt5Network                     Qt5 Network - Qt Network module
Qt5OpenGLExtensions            Qt5 OpenGLExtensions - Qt OpenGLExtensions
module
Qt5Sql                         Qt5 Sql - Qt Sql module
Qt5Bootstrap                   Qt5 Bootstrap - Qt Bootstrap module
Qt5Widgets                     Qt5 Widgets - Qt Widgets module
Qt5Core                        Qt5 Core - Qt Core module
Qt5PlatformSupport             Qt5 PlatformSupport - Qt PlatformSupport
module
Qt5Xml                         Qt5 Xml - Qt Xml module
Qt5Concurrent                  Qt5 Concurrent - Qt Concurrent module
Qt5Gui                         Qt5 Gui - Qt Gui module
Qt5DBus                        Qt5 DBus - Qt DBus module
Qt5Svg                         Qt5 Svg - Qt Svg module
Qt5OpenGL                      Qt5 OpenGL - Qt OpenGL module
Qt5PrintSupport                Qt5 PrintSupport - Qt PrintSupport module

In attempt to get a bit further along, I replaced the above module names in
the file "configure" with

  QT_MODULES="Qt5Core Qt5Gui Qt5Network Qt5OpenGL"

and to no surprise the warnings are gone. But then I get the error

configure: WARNING: Qt >= 4.0.0 not found; disabling Qt GUI

and the reason is the following test in "configure":

    if ! `$PKG_CONFIG --atleast-version=4.0.0 QtCore`; then

I changed the "QtCore" in the above test to "Qt5Core" and that warning is
gone.  The next error is complaints about the compilation test for Qt5, i.e.:

configure:19908: checking whether Qt has the
QAbstractItemModel::beginResetModel function
configure:19961: g++ -std=gnu++11 -c -g -O2 -pthread -fopenmp
-I/usr/include/qt5/QtCore -I/usr/include/qt5 -I/usr/include/qt5/QtGui
-I/usr/include/qt5/QtNetwork -I/usr/include/qt5/QtOpenGL
-I/usr/include/qt5/QtWidgets conftest.cpp >&5
In file included from /usr/include/qt5/QtCore/qatomic.h:42:0,
                 from /usr/include/qt5/QtCore/qvariant.h:45,
                 from /usr/include/qt5/QtCore/qabstractitemmodel.h:45,
                 from /usr/include/qt5/QtCore/QAbstractItemModel:1,
                 from conftest.cpp:90:
/usr/include/qt5/QtCore/qglobal.h:1008:4: error: #error "You must build your
code with position independent code if Qt was built with -reduce-relocations.
" "Compile your code with -fPIC or -fPIE."
# error "You must build your code with position independent code if Qt was
built with -reduce-relocations. "
^

OK, so I did what was suggested.  I added the option -fPIC to the QT_CPPFLAGS,
i.e., change

    QT_CPPFLAGS="`$PKG_CONFIG --cflags-only-I $QT_MODULES`"

to

    QT_CPPFLAGS="`$PKG_CONFIG --cflags-only-I $QT_MODULES` -fPIC"

and Qt configuration was complete.

Now on to compilation.  Only a minute or two after beginning compilation, I
ran into

uic: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/uic': No such file or
directory

Of course, my uic is in []/qt5/bin, not []/qt4/bin.  To me, this looks like it
might be a Linux Mint configuration error.  I kept searching in the Makefile
for what is generating such a message.  It looks like it comes from the
/usr/bin/lrelease command. I.e.,

sebald@ ~ $ lrelease
lrelease: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/lrelease': No such
file or directory

So, really the system /usr/bin/lrelease should be looking in the []/qt5/bin
when only the Qt5 resources are installed.  But maybe the system uic,
lrelease, etc. tools have more to do with the version of Qt used in building
Linux Mint.  Note that these four programs in Qt4 are spread across two
packages, whereas for Qt5 all four are in the same package and end up in [qt5
base]/bin.

On the other hand, the Octave configuration and/or make could check first for
[]/qt5/bin/lrelease before checking for 'uic-qt4' and 'uic'.  (Note, I'm not
sure there is or ever will be a uic-qt5.)  All four of those binaries are in
that directory.  Perhaps pkg-config can be used to get that information just
like the include directories are extracted from pkg-config.  In fact, going
back to the gnuplot configure, it appears that is exactly what is done there:
first use pkg-config to get the Qt5Core location if it exists and then check
for uic, moc, rcc and lrelease from that Qt5 location.

BUT, I'm going to cheat a bit here and just install the limited Qt4 libraries:
libqt4-dev-bin qt4-linguist-tools...  Well, that doesn't get very far when GUI
building rolls around.  Lots of errors, but mostly the same type.  Rather than
worry about that, it's probably better that the configuration be made robust
first.



(file #37049)
    _______________________________________________________

Additional Item Attachment:

File name: octave-config_mint_qt5-djs_2016may02.diff Size:0 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?40252>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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