bugGNU Octave - Bugs: bug #55735, QGLWidget not detected with Qt 4,...

 
 

bug #55735: QGLWidget not detected with Qt 4, so Qt graphics toolkit is not compiled

Submitted by:  None
Submitted on:  Mon 18 Feb 2019 03:39:57 AM UTC  
 
Category:  Configuration and Build System Severity:  2 - Minor
Priority:  3 - Low Item Group:  Build Failure
Status:  Ready For Test Assigned to:  None
Originator Name:  jwoithe Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  5.1.0
Operating System:  GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

( Jump to the original submission)

Mon 11 Mar 2019 09:48:58 PM UTC, comment #12:

As I also just posted in bug #55883, I see now that the QOpenGLWidget object is actually defined in libQt5Widgets.so, not a separate library. So my idea of only linking the graphics widget library with OpenGL-related things won't exactly matter. But I do still want to have that as a separate library that is loaded dynamically in the same way that the fltk widget is.

John W. Eaton <jwe>
Project Administrator
Mon 11 Mar 2019 09:36:15 PM UTC, comment #11:

I pushed the following changeset for stable and merged with default:

http://hg.savannah.gnu.org/hgweb/octave/rev/4af9840f9ce5

I also pushed an additional change for default so that we could also build the default branch with Qt4 again:

http://hg.savannah.gnu.org/hgweb/octave/rev/e247ecdee41d

Works for me now with either stable or default on my Debian system when using the --with-qt=4 configure option.

I do want to limit linking the Qt OpenGL library to the graphics library separate from the rest of the GUI.

The first changeset above adds the missing -I options to CPPFLAGS. It isn't needed with Qt5, at least the way it is installed on my system, but it is with Qt4, and I think it makes sense to use a separate variable for that anyway.

John W. Eaton <jwe>
Project Administrator
Mon 11 Mar 2019 04:52:42 PM UTC, comment #10:

Thanks for taking a detailed look at this, I think your observations are correct and very helpful. I think that Octave uses Qt5OpenGL to support versions of Qt earlier than 5.4, when QOpenGLWidget was added. In Qt 5.4 and later, this library is unnecessary overlinking.

You're right, in Octave 4.4.1 it was included in QT_MODULES, so it was required. It was factored out in 332be8be16eb (https://hg.savannah.gnu.org/hgweb/octave/rev/332be8be16eb) as part of the change to make the qt graphics toolkit module separate from the Qt GUI library.

So from my re-reading of that change, the reason for factoring it out wasn't to make it optional, but to make sure that the GUI is not overlinked with libQtOpenGL, only the loadable '__init_qt__' module is linked with it. Adding it back into QT_MODULES would add it back into QT_LIBS, and overlink liboctgui. Does that help explain why QT_OPENGL_LIBS is a separate variable?

Mike Miller <mtmiller>
Project Administrator
Mon 11 Mar 2019 04:50:38 AM UTC, comment #9:

Original patch author here. I'd like to improve on my patch by addressing the concerns that QtOpenGL/Qt5OpenGL would no longer be optional. However I can't figure out what part of the Octave build process makes it optional. Some observations:

1. If Qt[5]OpenGL supplies CPPFLAGS or LDFLAGS, it seems like bad form to leave these out. All of the Qt libraries are probably installed to the same directory (where a -L flag from any Qt module would satisfy them all), but if they're not, then you'll likely need Qt[5]OpenGL-specific LDFLAGS so the linker will know where to find that library.

2. The Qt5OpenGL headers all live in their own directory (at least on my machine) and somehow it builds without having that directory in the include path (since we've left it out of QT_CPPFLAGS). So we're linking to the library but not using its headers in any way? This has me wondering what is requiring us to link to it.

3. Moving Qt[5]OpenGL out of QT_MODULES (see r25931) has a side-effect that this module is no longer checked for existence by PKG_CHECK_MODULES, nor the QT_MODULES_AVAILABLE/MISSING stuff. It looks like we're just assuming it exists when we call `$PKG_CONFIG --libs-only-l $QT_OPENGL_MODULE`. If it doesn't exist, the command should give some error.

I tried renaming Qt5OpenGL.pc so that pkg-config couldn't find it, and indeed it does give an error message.

Surprisingly, configure kept running, and I couldn't find any other errors related to this. QT_OPENGL_LIBS is blank, and there is no warning that Qt with OpenGL would be disabled. It also compiled fine.

I've come to these conclusions:

For Qt5, it doesn't appear that Octave uses the Qt5OpenGL module at all (please double-check me on this). The Qt documentation categorizes this as an "add-on" (not guaranteed to exist) and is deprecated.

For Qt4, the QtOpenGL module is needed if you want OpenGL support. I don't see any distinction in the Qt4 docs that it might not exist, and Octave 4.4.1 didn't consider it to be optional.

So I think the easiest way to fix this is to remove QT_OPENGL_MODULE and QT_OPENGL_LIBS, deleting Qt5OpenGL, and re-adding QtOpenGL to QT_MODULES for Qt4 only (to preserve the behavior of 4.4.1). Unless you want to make OpenGL optional with Qt4, but from the comments here it doesn't seem like Qt4 is a high priority.

Anonymous
Tue 05 Mar 2019 10:13:23 PM UTC, comment #8:

There's no problem leaving this bug report open until at least Octave 5.2, the first bug fix release on the Octave 5 branch, and until Qt 4 is dropped from the development branch.

Mike Miller <mtmiller>
Project Administrator
Sun 03 Mar 2019 11:52:01 PM UTC, comment #7:

As the bug originator, the patch supplied by the contributor in comment #5 appears to work around the problem. However, I agree with the feedback in comment #6. While it may be useful for those of us still compiling against qt4, making OpenGL a required module goes against the current dependency policy which treats it as optional.

In may case, configuring octave using

works (this comes out of the suggestion in comment #3). While a little messy to type, it's quick, gets the job done and does not require any edits to the source tree. I have adopted the above configure command approach myself and don't intend to work on a patch.

Since there is a fairly straight forward workaround and (according to comment #1) the Qt4 support is likely to be dropped very soon, I would be happy if this bug were marked "wontfix". Of course if someone were to work up a robust patch I wouldn't oppose it.

Anonymous
Sun 03 Mar 2019 11:20:35 PM UTC, comment #6:

Glad you were able to patch it for your purposes.

I can't test this patch because I don't have Qt 4 available (and this patch isn't necessary for Qt 5), but by inspection, I don't think it's suitable to apply to Octave for everyone as written. This patch adds QtOpenGL into the same list with the other Qt modules, so QtOpenGL (or Qt5OpenGL) becomes a required module. That breaks the current behavior, which treats QtOpenGL as optional, and still builds the GUI even if the OpenGL libraries are not installed.

But it may be useful for users who know what they are doing and have a complete Qt 4 installation.

Mike Miller <mtmiller>
Project Administrator
Fri 01 Mar 2019 06:28:00 AM UTC, comment #5:

I've attached a quick & dirty fix to add the QtOpenGL stuff to QT_CPPFLAGS and QT_LDFLAGS (rather than creating new QT_OPENGL_* equivalents for these). This works for me for Qt4 from Slackware 14.2. I have not yet tried it with Qt5 but see no reason why it wouldn't work there too.

(file #46379)

Anonymous
Tue 19 Feb 2019 07:20:52 AM UTC, comment #4:

To be honest I hadn't tried. Using

to obtain the include paths required, I configured Octave 5.0.91-7b9a5ab8350f using

Configure appears to have found OpenGL in this case:

Based on this, I agree that this would be a reasonable workaround for future Octave 5 users who need to compile against Qt4. The need to do this would just need to be documented so the information can be found by those who need it.

Regarding the attachment (which evidently failed on the second attempt), the "configure" script is a touch over 2 MB (2276063 bytes), so you are probably right. The note on the page talking about a 16 MB limit had me thinking there was something else going on (perhaps it didn't like scripts for example).

Anonymous
Tue 19 Feb 2019 06:44:10 AM UTC, comment #3:

Have you been able to verify that you can build if CPPFLAGS is set correctly? For example

adjusting directories as necessary for your system. There's no need to hack or patch configure just to pass some extra -I options. If that works, then I think that is a reasonable workaround for users needing to build Octave 5 with Qt 4.

Your attachments probably aren't going through because they are too large, Savannah only accepts attachments under about 2 MB despite what the note on the page says. I'm not sure that attaching the configure script will provide us with any more information.

Mike Miller <mtmiller>
Project Administrator
Mon 18 Feb 2019 11:53:01 PM UTC, comment #2:

Given the potential to drop Qt4 support for Octave 6 I agree it's not worth fixing in the default branch. However, the stable branch will become Octave 5 if I interpret the release plan correctly. If that's the case, then the current situation is that OpenGL detection will be broken for a seemingly supported platform (qt4) in the Octave 5 releases when they happen. As a result, it seems to me that either "configure" needs to be fixed in stable, or it is declared that qt4 support will be dropped from Octave 5. The latter will ensure that people won't expect Octave 5 to be fully capable when compiled against qt4 unless "configure" is manually hacked by the user.

For completeness, I installed the most recent qt5 version easily available for Slackware 14.2 (5.9.6) and compiled Octave 5.0.91-7b9a5ab8350f with the original "configure" script using the same options as in the original report. As expected, OpenGL was correctly detected in this case since qt5 was picked up and used preferentially.

I've noticed that the configure script generated from 5.0.91-7b9a5ab8350f did not get attached to the report yesterday. I'm not sure why since the file was selected for attaching. Since it might be helpful for future reference I've tried it again today with this comment.

Anonymous
Mon 18 Feb 2019 08:23:47 PM UTC, comment #1:

This bug report looks accurate to me by inspection, but I test mainly with Qt 5, and Qt 5 is highly recommended for Octave 5.

The difference seems to be that QOpenGLWidget is in the Qt5Widgets module, not in the Qt5OpenGL module. So when building with Qt 5, QT_CPPFLAGS does contain the include path for Qt5Widgets, and QOpenGLWidget is found successfully. With Qt 4, QGLWidget is not found because it's only in the QtOpenGL module.

If someone thinks this is worth fixing, the fix looks like creating a new QT_OPENGL_CPPFLAGS variable and using it in the test for QGLWidget.

However, we may be dropping support for Qt 4 completely on the default branch soon for Octave 6, so I doubt that this is worth fixing at all.

Mike Miller <mtmiller>
Project Administrator
Mon 18 Feb 2019 03:39:57 AM UTC, original submission:

Affected distributions: Slackware64 14.2 with all updates applied, Slackware64-current from 2019/Feb/13.

Octave 5.0.91-7b9a5ab8350f was configured using

The configure script failed to detect the presence of QGLWidget on the system, concluded that OpenGL didn't work with Qt, and disabled OpenGL graphics with Qt GUI. Although it wasn't obvious from the messages, this meant the Qt graphics toolkit was not compiled. Attempting to use GUI elements in Octave code resulted in complaints from the gnuplot module that uicontrol was an unknown object.

The reason for the failure is that the test program from "configure" gave "no such file or directory" for QGLWidget's include line. Looking in config.log at the compiler flags, the include paths given to the compiler did not include those of the QtOpenGL module. This is because in "configure" only QT_CPPFLAGS is referenced, and this is constructed using only QT_MODULES: QT_OPENGL_MODULE is not included.

In "configure" from Octave 4.4.x, QT_OPENGL_MODULE did not exist and QtOpenGL was included in QT_MODULES. That is, Octave 4.4.x on the same system did not have this issue.

By editing "configure" and putting QtOpenGL in QT_MODULES I am able to obtain a version of Octave 5.0.91 which includes the qt toolkit.

The systems have Qt version 4.8.7 installed. However, the Qt5 case in "configure" also similarly separates Qt5OpenGL from QT_MODULES, so the issue may occur for Qt5 as well.

Unfortunately I am not familiar enough with autoconf to determine how this is occurring based on configure.ac. I note that the "configure" script from Octave 4.4.1 does not define QT_OPENGL_MODULE, with QtOpenGL included in QT_MODULES. Could this be due to an autoconf issue rather than Octave, given that 4.4.1's "configure" is supplied in the source tarball while 5.0.91's is locally generated by the bootstrap process? Both Slackware64-14.2 and Slackware64-current-20190213 systems have autoconf 2.69.

I have attached the "configure" script originally produced when bootstrapping 5.0.91 for reference.

I'm more than happy to assist in debugging this further.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #46379:  qt-opengl.diff added by None (1KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

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

    Only project members can vote.

     

     

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-11 jwe StatusNone => Ready For Test
    2019-03-01 None Attached File- => Added qt-opengl.diff, #46379
    2019-02-26 mtmiller Severity3 - Normal => 2 - Minor
        Item GroupIncorrect Result => Build Failure
        Release5.0.91 => 5.1.0
        SummaryQGLWidget not detected, so Qt graphics toolkit is not compiled => QGLWidget not detected with Qt 4, so Qt graphics toolkit is not compiled
    2019-02-18 mtmiller Priority5 - Normal => 3 - Low

    Back to the top


    Powered by Savane 3.4