bugGNU Octave - Bugs: bug #40252, Make GUI compatible with both Qt4...


bug #40252: Make GUI compatible with both Qt4 and Qt5

Submitted by:  Mike Miller <mtmiller>
Submitted on:  Sat 12 Oct 2013 07:40:35 PM UTC  
Category: Configuration and Build SystemSeverity: 2 - Minor
Priority: 5 - NormalItem Group: Feature Request
Status: PostponedAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: Any

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission Jump to the original submission)

Mon 02 May 2016 05:45:27 PM UTC, comment #12:

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.

(file #37049)

Dan Sebald <sebald>
Sun 19 Apr 2015 05:34:42 PM UTC, comment #11:

Since Octave is not ready to support Qt5 I've removed the configure checks for it here (http://hg.savannah.gnu.org/hgweb/octave/rev/d58ba8b9f709).

Rik <rik5>
Project Administrator
Sat 21 Feb 2015 10:11:35 PM UTC, comment #10:

Yeah, that's probably a good idea.

I don't even see a moc-qt5 on my Debian system with both Qt4 and Qt5. Instead Debian uses a package called qtchooser to dispatch to one of the two versions.

Mike Miller <mtmiller>
Project Administrator
Sat 21 Feb 2015 10:06:54 PM UTC, comment #9:

Currrently, configure looks for qmake-qt5, then qmake-qt4 and then qmake, the same with the other qxxxx tools.

Since it is not working for qt5 (yet) should qt5 be taken from the configure checks?

John Donoghue <lostbard>
Project Member
Sat 21 Feb 2015 08:25:20 PM UTC, comment #8:

I've got this partially done, but the hard part of this bug is the configuration part. When do we decide to use Qt 4 or Qt 5? Automatically prefer Qt 4 and fall back to Qt 5 if 4 isn't working, or vice versa? Or supply a user option to pick one or the other?

We will need different sets of pkg-config modules for each (e.g. QtGui vs Qt5Gui), potentially different sets of helper programs (e.g. moc-qt4, moc-qt5, or just moc).

Since I think all distributions will continue to have Qt 4 for a long time to come, I'm going to put this off until after the 4.0 release.

Mike Miller <mtmiller>
Project Administrator
Tue 03 Feb 2015 04:30:25 PM UTC, comment #7:

Thanks, I will do what I can.

I don't think any distros are shipping Qt 5 to the exclusion of Qt 4, but please do comment here if I'm wrong. Fedora 21, Ubuntu 14.10, and RHEL 7 all offer Qt 5 as an option, but Qt 4.8 is also provided. So I don't think it's as important as other bugs, but would be nice to release with at least the possibility to build against Qt 5.

Mike Miller <mtmiller>
Project Administrator
Tue 03 Feb 2015 04:00:31 PM UTC, comment #6:

@Mike: I marked this bug as In Progress. I just checked and Fedora 21 and Ubuntu 14.10 are both shipping with Qt5 so I think this is important to resolve for the next release.

Rik <rik5>
Project Administrator
Tue 03 Feb 2015 04:43:25 AM UTC, comment #5:

I revisited this bug again for a little bit tonight. I made some headway, and finally got Octave to build against Qt 5.3.

Attaching a diff of all the quick-n-dirty changes I had to make. Some of these are backwards compatible with Qt 4, some of these are new or renamed functions in Qt 5, some will need #ifdefs, etc. But it does compile and the GUI does come up.

I'm willing to pick this up again and work out the remaining issues, just wanted to share what I have for now.

Also worth noting that I had to manually mess with the include and library flags. So configure.ac will need some work as well, not included in this diff at all yet.

(file #32978)

Mike Miller <mtmiller>
Project Administrator
Sun 07 Dec 2014 07:06:03 AM UTC, comment #4:

Until this is done, can the Qt5 detection in configure.ac be turned off?


Sat 02 Nov 2013 01:32:46 AM UTC, comment #3:

Many more errors, a handful of member functions have been deprecated or removed with Qt5. I haven't gotten all the way through it yet, but here's a sample of what I've worked through so far:

And the appropriate pkg-config modules are (at least on Debian):

Marking as postponed for now, this looks pretty disruptive and unnecessary at this point in time.

Mike Miller <mtmiller>
Project Administrator
Fri 01 Nov 2013 08:15:41 PM UTC, comment #2:

Off the top of my head, I remember that the pkg-config files are named Qt5Gui, etc. I don't have it in front of me at the moment to check what else there was. I got around the different build flags by setting the QT_CPPFLAGS and QT_LIBS manually to get to the point I did before. I will try to recreate that build with your fix a little later today and see how far it gets me this time.

I can at least try to get a better idea of the full scope of what is needed so you can decide if this is something you want to try to address before the release. I saw this as more of a down-the-road goal, I don't know of any distros that are using Qt5 by default yet.

Mike Miller <mtmiller>
Project Administrator
Fri 01 Nov 2013 08:00:40 PM UTC, comment #1:

I fixed the include statements in this changeset:


What are the other issues? Woud you like to add them here or open separate reports about them?

John W. Eaton <jwe>
Project Administrator
Sat 12 Oct 2013 07:40:35 PM UTC, original submission:

The GUI does not compile with Qt5 currently. There are several issues ranging from include file compatibility to detecting the helper utilities and CPPFLAGS and LIBS correctly in configure.ac.

I got as far as hacking the results of configure to look at the right paths, but the changes in header files between Qt4 and Qt5 is blocking me from getting any further. The recommendations I've seen for compatibility are to not include the Qt module in #include statements, so for example use

instead of

We have quite a few of the latter variety of includes, especially in the libqterminal directory.

Mike Miller <mtmiller>
Project Administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #32978:  oct-qt5.diff added by mtmiller (12kB - text/x-patch)


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -unavailable- added by sebald (Updated the item)
  • -unavailable- added by opoplawski
  • -unavailable- added by lostbard (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by mtmiller (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 02 May 2016 05:45:27 PM UTCsebaldAttached File-=>Added octave-config_mint_qt5-djs_2016may02.diff, #37049
    Thu 30 Apr 2015 03:25:59 PM UTCopoplawskiCarbon-Copy-=>Added opoplawski
    Sat 18 Apr 2015 08:22:53 PM UTCmtmillerDependencies-=>bugs #44874 is dependent
    Sat 21 Feb 2015 08:25:20 PM UTCmtmillerStatusIn Progress=>Postponed
    Tue 03 Feb 2015 04:00:31 PM UTCrik5StatusPostponed=>In Progress
    Tue 03 Feb 2015 04:43:25 AM UTCmtmillerAttached File-=>Added oct-qt5.diff, #32978
    Sat 02 Nov 2013 01:32:46 AM UTCmtmillerStatusNone=>Postponed
    Sat 02 Nov 2013 01:32:45 AM UTCmtmillerSeverity3 - Normal=>2 - Minor

    Back to the top

    Powered by Savane 3.1-cleanup