Bug 350061

Summary: Fails to build on ubuntu armhf (OpenGL != OpenGLES)
Product: [Applications] kdenlive Reporter: Philip Muškovac <yofel>
Component: Setup & InstallationAssignee: Vincent PINON <vpinon>
Status: RESOLVED FIXED    
Severity: normal CC: egorov_egor, endymion+kde, funtoos, heri+kde, kripton, rdieter, sitter, stupor_scurvy343
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 15.12.0
Sentry Crash Report:
Attachments: build with OpenGLES on armhf
kdenlive-15.08.0-fix-opengles.patch
build.log
kdenlive-15.08.3-define-gl-unpack-row-length-if-missing.patch
kdenlive-15.08.3-only-delete-opengl-3.2-core-functions-on-windows.patch

Description Philip Muškovac 2015-07-09 18:09:55 UTC
Kubuntu wily (dev)
Kdenlive 15.04.2

On Ubuntu, QtOpenGL5 is build against OpenGLES on armhf but kdenlive only looks for OpenGL. As you can't use both at the same time the build fails:

In file included from /usr/include/GL/gl.h:2055:0,
                 from /usr/include/GL/glu.h:38,
                 from ../../src/monitor/videoglwidget.cpp:26:
/usr/include/GL/glext.h:468:19: error: conflicting declaration 'typedef ptrdiff_t GLsizeiptr'
 typedef ptrdiff_t GLsizeiptr;
                   ^
In file included from /usr/include/arm-linux-gnueabihf/qt5/QtGui/qopengl.h:97:0,
                 from /usr/include/arm-linux-gnueabihf/qt5/QtOpenGL/qgl.h:39,
                 from /usr/include/arm-linux-gnueabihf/qt5/QtOpenGL/QGLWidget:1,
                 from ../../src/monitor/videoglwidget.h:24,
                 from ../../src/monitor/videoglwidget.cpp:21:
/usr/include/GLES3/gl3.h:69:25: note: previous declaration as 'typedef khronos_ssize_t GLsizeiptr'
 typedef khronos_ssize_t GLsizeiptr;
                         ^
In file included from /usr/include/GL/gl.h:2055:0,
                 from /usr/include/GL/glu.h:38,
                 from ../../src/monitor/videoglwidget.cpp:26:
/usr/include/GL/glext.h:469:19: error: conflicting declaration 'typedef ptrdiff_t GLintptr'
 typedef ptrdiff_t GLintptr;
                   ^
In file included from /usr/include/arm-linux-gnueabihf/qt5/QtGui/qopengl.h:97:0,
                 from /usr/include/arm-linux-gnueabihf/qt5/QtOpenGL/qgl.h:39,
                 from /usr/include/arm-linux-gnueabihf/qt5/QtOpenGL/QGLWidget:1,
                 from ../../src/monitor/videoglwidget.h:24,
                 from ../../src/monitor/videoglwidget.cpp:21:
/usr/include/GLES3/gl3.h:70:26: note: previous declaration as 'typedef khronos_intptr_t GLintptr'
 typedef khronos_intptr_t GLintptr;

Reproducible: Always

Steps to Reproduce:
Build on ubuntu armhf
Comment 1 Philip Muškovac 2015-07-09 18:24:04 UTC
Created attachment 93538 [details]
build with OpenGLES on armhf

cmake file taken from plasma-desktop
Comment 2 Harald Sitter 2015-07-16 11:30:56 UTC
FWIW it might be worth sticking the finder into ECM at this point. apparently kinfocenter and plasma-desktop also have a copy.

alternatively I think kwin gets away with not looking for GL at all by using libepoxy, so maybe that would be a worthwhile thing to look into.

also this patch should go on reviewboard :P
Comment 3 kripton 2015-08-22 16:58:09 UTC
This bug hit me with a different compiler error message on Gentoo amd64 architecture and qtgui (and everything else qt) built with the "gles2" USE flag. See https://bugs.gentoo.org/show_bug.cgi?id=558356 (kdenlive 15.08.0). It compiled fine after I removed the gles2 USE-flag and rebuilt Qt5.
Comment 4 Dennis Schridde 2015-08-30 10:01:00 UTC
Created attachment 94284 [details]
kdenlive-15.08.0-fix-opengles.patch

I adapted attachment #93538 [details] to apply to Kdenlive 15.08.0.

However, as kripton mentioned in comment #3, this does not fix Gentoo-bug #558356.
Comment 5 Vincent PINON 2015-09-04 20:55:32 UTC
Git commit 92a25020e706537aec4d3ec7cf1ab5282b159989 by Vincent Pinon, on behalf of Jonathan Riddell.
Committed on 04/09/2015 at 20:53.
Pushed by vpinon into branch 'Applications/15.08'.

link with OpenGLES if Qt uses that

REVIEW: 125002

Signed-off-by: Vincent Pinon <vpinon@kde.org>

M  +17   -1    src/CMakeLists.txt

http://commits.kde.org/kdenlive/92a25020e706537aec4d3ec7cf1ab5282b159989
Comment 6 Jonathan Riddell 2015-09-23 12:25:02 UTC
Git commit 146e66c534b7d10871b6abb6ff5d11b41f623e80 by Jonathan Riddell.
Committed on 23/09/2015 at 12:24.
Pushed by jriddell into branch 'Applications/15.08'.

Add missing FindOpenGLES cmake file

REVIEW: 125002

A  +52   -0    cmake/modules/FindOpenGLES.cmake

http://commits.kde.org/kdenlive/146e66c534b7d10871b6abb6ff5d11b41f623e80
Comment 7 Jonathan Riddell 2015-09-23 12:27:08 UTC
Git commit 5c2e8538b680eca0067f156f63855dc449614fd6 by Jonathan Riddell.
Committed on 23/09/2015 at 12:27.
Pushed by jriddell into branch 'master'.

Add missing FindOpenGLES cmake file

REVIEW: 125002

A  +52   -0    cmake/modules/FindOpenGLES.cmake

http://commits.kde.org/kdenlive/5c2e8538b680eca0067f156f63855dc449614fd6
Comment 8 Dennis Schridde 2015-11-10 17:09:22 UTC
It still fails: https://bugs.gentoo.org/show_bug.cgi?id=558356#c18 (Also confirmed by Michael "kensington" Palimaka.)
Comment 9 Dennis Schridde 2015-11-13 08:58:32 UTC
Created attachment 95474 [details]
build.log

kdenlive-15.08.3 still fails with the same error. Please reopen.

/var/tmp/portage/kde-apps/kdenlive-15.08.3/work/kdenlive-15.08.3/src/monitor/glwidget.cpp: In function ‘void uploadTextures(QOpenGLContext*, SharedFrame&, GLuint*)’:
/var/tmp/portage/kde-apps/kdenlive-15.08.3/work/kdenlive-15.08.3/src/monitor/glwidget.cpp:315:22: error: ‘GL_UNPACK_ROW_LENGTH’ was not declared in this scope
     f->glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
                      ^
/var/tmp/portage/kde-apps/kdenlive-15.08.3/work/kdenlive-15.08.3/src/monitor/glwidget.cpp: In member function ‘void GLWidget::paintGL()’:
/var/tmp/portage/kde-apps/kdenlive-15.08.3/work/kdenlive-15.08.3/src/monitor/glwidget.cpp:363:23: warning: unused variable ‘f’ [-Wunused-variable]
     QOpenGLFunctions* f = openglContext()->functions();
                       ^
/var/tmp/portage/kde-apps/kdenlive-15.08.3/work/kdenlive-15.08.3/src/monitor/glwidget.cpp: In destructor ‘virtual FrameRenderer::~FrameRenderer()’:
/var/tmp/portage/kde-apps/kdenlive-15.08.3/work/kdenlive-15.08.3/src/monitor/glwidget.cpp:1168:12: warning: possible problem detected in invocation of delete operator: [-Wdelete-incomplete]
     delete m_gl32;
            ^
/var/tmp/portage/kde-apps/kdenlive-15.08.3/work/kdenlive-15.08.3/src/monitor/glwidget.cpp:1168:12: warning: invalid use of incomplete type ‘class QOpenGLFunctions_3_2_Core’
In file included from /var/tmp/portage/kde-apps/kdenlive-15.08.3/work/kdenlive-15.08.3/src/monitor/glwidget.cpp:29:0:
/var/tmp/portage/kde-apps/kdenlive-15.08.3/work/kdenlive-15.08.3/src/monitor/glwidget.h:36:7: warning: forward declaration of ‘class QOpenGLFunctions_3_2_Core’
 class QOpenGLFunctions_3_2_Core;
       ^
/var/tmp/portage/kde-apps/kdenlive-15.08.3/work/kdenlive-15.08.3/src/monitor/glwidget.cpp:1168:12: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined
     delete m_gl32;
            ^
src/CMakeFiles/kdenlive.dir/build.make:3047: recipe for target 'src/CMakeFiles/kdenlive.dir/monitor/glwidget.cpp.o' failed
Comment 10 Dennis Schridde 2015-11-14 14:31:05 UTC
Created attachment 95494 [details]
kdenlive-15.08.3-define-gl-unpack-row-length-if-missing.patch
Comment 11 Dennis Schridde 2015-11-14 14:31:45 UTC
Created attachment 95495 [details]
kdenlive-15.08.3-only-delete-opengl-3.2-core-functions-on-windows.patch

The last two patches fix all serious warnings in the glwidget.cpp file and make kdenlive-15.08.3 compile.

GL_UNPACK_ROW_LENGTH is part of OpenGL ES 3.2 (https://www.khronos.org/registry/gles/specs/3.2/es_spec_3.2.pdf), but not of OpenGL ES 2.0 (https://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf). This it is defined in different headers (gl3.h) in OpenGL ES 3.2 and as an extension with _EXT suffix (gl2ext.h) to OpenGL ES 2.0. I chose the route to fallback to the _EXT definition, in case the regular one is unavailable.

The other patch fixes a warning about calling operator delete on QOpenGLFunctions_3_2_Core (its class definition is incomplete). It is only ever instantiated on Windows anyway, so I took the liberty to also guard the deletion with Q_OS_WIN.

Please reopen.
Comment 12 devsk 2015-12-11 02:16:42 UTC
Any chance of seeing the last patch bundled in the upstream code? This bug should be reopened because the build is still broken,
Comment 13 Vincent PINON 2015-12-11 07:28:27 UTC
Git commit f9c12b96228ca397e59dc07ce8f7fbe4d70055c4 by Vincent Pinon, on behalf of Dennis Schridde.
Committed on 11/12/2015 at 07:24.
Pushed by vpinon into branch 'Applications/15.12'.

Allow building on ubuntu armhf (OpenGL!=OpenGLES)

applying:
kdenlive-15.08.3-define-gl-unpack-row-length-if-missing.patch
kdenlive-15.08.3-only-delete-opengl-3.2-core-functions-on-windows.patch

The two patches fix all serious warnings in the glwidget.cpp file
and make kdenlive-15.08.3 compile.

GL_UNPACK_ROW_LENGTH is part of OpenGL ES 3.2, but not of OpenGL ES 2.0.
This it is defined in different headers (gl3.h) in OpenGL ES 3.2 and as an
extension with _EXT suffix (gl2ext.h) to OpenGL ES 2.0.
I chose the route to fallback to the _EXT definition, in case the regular one
is unavailable.

The other patch fixes a warning about calling operator delete on
QOpenGLFunctions_3_2_Core (its class definition is incomplete).
It is only ever instantiated on Windows anyway,
so I took the liberty to also guard the deletion with Q_OS_WIN.

M  +11   -0    src/monitor/glwidget.cpp

http://commits.kde.org/kdenlive/f9c12b96228ca397e59dc07ce8f7fbe4d70055c4
Comment 14 Vincent PINON 2015-12-11 07:31:25 UTC
Many thanks for analyzing the problem, provinding the patch, and reminding me of it ;)
Hope everything is fine now...