Bug 421136 - Build failure on arm archs
Summary: Build failure on arm archs
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 4.4.5
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
: 427856 442146 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-05-07 07:51 UTC by Christophe Giboudeaux
Modified: 2021-09-13 08:16 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
more errors (66 bytes, text/plain)
2020-05-07 07:52 UTC, Christophe Giboudeaux
Details
krita_failure.txt (17.64 KB, text/plain)
2020-05-07 08:36 UTC, Christophe Giboudeaux
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Giboudeaux 2020-05-07 07:51:47 UTC
Short summary: krita fails to build on arm (armv6l, armv7l, aarch64) because of openGL specific code. The first error is:

[ 1688s] /home/abuild/rpmbuild/BUILD/krita-4.2.9/libs/ui/opengl/kis_opengl_image_textures.cpp: In function 'void {anonymous}::initializeRGBA16FTextures(QOpenGLContext*, KisGLTexturesInfo&, KoID&)':
[ 1688s] /home/abuild/rpmbuild/BUILD/krita-4.2.9/libs/ui/opengl/kis_opengl_image_textures.cpp:480:39: error: 'GL_RGBA16F_ARB' was not declared in this scope; did you mean 'GL_RGBA16F_EXT'?
[ 1688s]   480 |         texturesInfo.internalFormat = GL_RGBA16F_ARB;
[ 1688s]       |                                       ^~~~~~~~~~~~~~
[ 1688s]       |                                       GL_RGBA16F_EXT
[ 1688s] /home/abuild/rpmbuild/BUILD/krita-4.2.9/libs/ui/opengl/kis_opengl_image_textures.cpp:484:39: error: 'GL_RGBA_FLOAT16_ATI' was not declared in this scope
[ 1688s]   484 |         texturesInfo.internalFormat = GL_RGBA_FLOAT16_ATI;
[ 1688s]       |                                       ^~~~~~~~~~~~~~~~~~~
Comment 1 Christophe Giboudeaux 2020-05-07 07:52:31 UTC
Created attachment 128216 [details]
more errors
Comment 2 Halla Rempt 2020-05-07 08:03:36 UTC
That attachment only says "NVIDIA Corporation, GeForce GTX 660/PCIe/SSE2, 4.6.0 NVIDIA 440.82" ?
Comment 3 Christophe Giboudeaux 2020-05-07 08:36:55 UTC
Created attachment 128217 [details]
krita_failure.txt

(In reply to Boudewijn Rempt from comment #2)
> That attachment only says "NVIDIA Corporation, GeForce GTX 660/PCIe/SSE2,
> 4.6.0 NVIDIA 440.82" ?

oops, wrong one :) Fixed
Comment 4 Halla Rempt 2020-05-20 11:47:00 UTC
Hm... I guess the arm hardware you're compiling to only has opengl es? And yet, HAS_ONLY_OPENGL_ES doesn't appear to be set, otherwise these errors wouldn't happen.
Comment 5 Christophe Giboudeaux 2020-05-20 14:42:23 UTC
the HAS_ONLY_OPENGL_ES flag is only defined 'if ANDROID' is true (in ui/CMakeLists.txt)
Comment 6 Wolfgang Bauer 2020-06-20 15:23:37 UTC
FYI, explicitly adding -DHAS_ONLY_OPENGL_ES to CXXFLAGS does make these errors disappear.



Then there still are similar errors in plugins/dockers/lut/ocio_display_filter.cpp though (which can be avoided by building without OpenColorIO):

[ 3160s] /home/abuild/rpmbuild/BUILD/krita-4.3.0/plugins/dockers/lut/ocio_display_filter.cpp: In member function 'virtual bool OcioDisplayFilter::updateShader()':
[ 3160s] /home/abuild/rpmbuild/BUILD/krita-4.3.0/plugins/dockers/lut/ocio_display_filter.cpp:276:9: error: 'QOpenGLFunctions_3_2_Core' was not declared in this scope; did you mean 'QOpenGLFunctionsPrivate'?
[ 3160s]   276 |         QOpenGLFunctions_3_2_Core *f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>();
[ 3160s]       |         ^~~~~~~~~~~~~~~~~~~~~~~~~
[ 3160s]       |         QOpenGLFunctionsPrivate
[ 3160s] /home/abuild/rpmbuild/BUILD/krita-4.3.0/plugins/dockers/lut/ocio_display_filter.cpp:276:36: error: 'f' was not declared in this scope
[ 3160s]   276 |         QOpenGLFunctions_3_2_Core *f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>();
[ 3160s]       |                                    ^
[ 3160s] /home/abuild/rpmbuild/BUILD/krita-4.3.0/plugins/dockers/lut/ocio_display_filter.cpp:276:118: error: no matching function for call to 'QOpenGLContext::versionFunctions<QOpenGLFunctions_3_2_Core>()'
[ 3160s]   276 |         QOpenGLFunctions_3_2_Core *f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>();
[ 3160s]       |                                                                                                                      ^
[ 3160s] In file included from /usr/include/qt5/QtGui/QOpenGLContext:1,
[ 3160s]                  from /home/abuild/rpmbuild/BUILD/krita-4.3.0/plugins/dockers/lut/ocio_display_filter.cpp:31:
[ 3160s] /usr/include/qt5/QtGui/qopenglcontext.h:194:11: note: candidate: 'template<class TYPE> TYPE* QOpenGLContext::versionFunctions() const'
[ 3160s]   194 |     TYPE *versionFunctions() const
[ 3160s]       |           ^~~~~~~~~~~~~~~~
[ 3160s] /usr/include/qt5/QtGui/qopenglcontext.h:194:11: note:   template argument deduction/substitution failed:
[ 3160s] /home/abuild/rpmbuild/BUILD/krita-4.3.0/plugins/dockers/lut/ocio_display_filter.cpp:287:9: error: 'QOpenGLFunctions_3_0' was not declared in this scope; did you mean 'QOpenGLFunctions'?
[ 3160s]   287 |         QOpenGLFunctions_3_0 *f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_0>();
[ 3160s]       |         ^~~~~~~~~~~~~~~~~~~~
[ 3160s]       |         QOpenGLFunctions
[ 3160s] /home/abuild/rpmbuild/BUILD/krita-4.3.0/plugins/dockers/lut/ocio_display_filter.cpp:287:31: error: 'f' was not declared in this scope
[ 3160s]   287 |         QOpenGLFunctions_3_0 *f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_0>();
[ 3160s]       |                               ^
[ 3160s] /home/abuild/rpmbuild/BUILD/krita-4.3.0/plugins/dockers/lut/ocio_display_filter.cpp:287:108: error: no matching function for call to 'QOpenGLContext::versionFunctions<QOpenGLFunctions_3_0>()'
[ 3160s]   287 |         QOpenGLFunctions_3_0 *f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_0>();
[ 3160s]       |                                                                                                            ^
[ 3160s] In file included from /usr/include/qt5/QtGui/QOpenGLContext:1,
[ 3160s]                  from /home/abuild/rpmbuild/BUILD/krita-4.3.0/plugins/dockers/lut/ocio_display_filter.cpp:31:
[ 3160s] /usr/include/qt5/QtGui/qopenglcontext.h:194:11: note: candidate: 'template<class TYPE> TYPE* QOpenGLContext::versionFunctions() const'
[ 3160s]   194 |     TYPE *versionFunctions() const
[ 3160s]       |           ^~~~~~~~~~~~~~~~
[ 3160s] /usr/include/qt5/QtGui/qopenglcontext.h:194:11: note:   template argument deduction/substitution failed:
[ 3160s] /home/abuild/rpmbuild/BUILD/krita-4.3.0/plugins/dockers/lut/ocio_display_filter.cpp: In member function 'bool OcioDisplayFilter::updateShaderImpl(F*)':
[ 3160s] /home/abuild/rpmbuild/BUILD/krita-4.3.0/plugins/dockers/lut/ocio_display_filter.cpp:336:43: error: 'GL_RGB16F_ARB' was not declared in this scope; did you mean 'GL_RGB16F_EXT'?
[ 3160s]   336 |         f->glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB16F_ARB,
[ 3160s]       |                                           ^~~~~~~~~~~~~
[ 3160s]       |                                           GL_RGB16F_EXT
Comment 7 Halla Rempt 2021-02-13 12:49:47 UTC
I don't have access this hardware, but could you please this patch?

diff --git a/libs/ui/CMakeLists.txt b/libs/ui/CMakeLists.txt
index 1dd227e432..25db539747 100644
--- a/libs/ui/CMakeLists.txt
+++ b/libs/ui/CMakeLists.txt
@@ -7,7 +7,8 @@ include_directories(SYSTEM
     ${OCIO_INCLUDE_DIR}
 )
 
-if (ANDROID)
+# This is going to break when we start building on Windows ARM...
+if (ANDROID OR (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|arm64.*|ARM64.*)" AND NOT APPLE))
     add_definitions(-DQT_OPENGL_ES_3)
     add_definitions(-DHAS_ONLY_OPENGL_ES)
     include_directories (${Qt5AndroidExtras_INCLUDE_DIRS})
Comment 8 Bug Janitor Service 2021-02-28 04:33:15 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 9 Christophe Giboudeaux 2021-03-10 08:19:56 UTC
I'll finally take a moment to test, sorry for the delay
Comment 10 Christophe Giboudeaux 2021-03-10 11:45:53 UTC
armv7l built successfully, aarch64 is still building but should also be fine
Comment 11 Halla Rempt 2021-03-10 11:49:58 UTC
thanks for testing!
Comment 12 Halla Rempt 2021-03-10 11:50:45 UTC
Git commit 2d92ee5b01a0069cc33debdcb3c29dc817c2d6f3 by Halla Rempt.
Committed on 10/03/2021 at 11:50.
Pushed by rempt into branch 'krita/4.4.3'.

Use opengl es on Arm Linux
(cherry picked from commit c91d020b244f012e09203c14d80d8e8774362a57)

M  +1    -1    libs/ui/CMakeLists.txt

https://invent.kde.org/graphics/krita/commit/2d92ee5b01a0069cc33debdcb3c29dc817c2d6f3
Comment 13 Halla Rempt 2021-03-10 11:51:19 UTC
Git commit 61d01f08da8e7fc3a8e20316348f3dc10b5ffbc6 by Halla Rempt.
Committed on 10/03/2021 at 11:51.
Pushed by rempt into branch 'krita/4.3'.

Use opengl es on Arm Linux
(cherry picked from commit c91d020b244f012e09203c14d80d8e8774362a57)

M  +1    -1    libs/ui/CMakeLists.txt

https://invent.kde.org/graphics/krita/commit/61d01f08da8e7fc3a8e20316348f3dc10b5ffbc6
Comment 14 Halla Rempt 2021-03-10 11:52:00 UTC
Git commit c91d020b244f012e09203c14d80d8e8774362a57 by Halla Rempt.
Committed on 10/03/2021 at 11:49.
Pushed by rempt into branch 'master'.

Use opengl es on Arm Linux

M  +1    -1    libs/ui/CMakeLists.txt

https://invent.kde.org/graphics/krita/commit/c91d020b244f012e09203c14d80d8e8774362a57
Comment 15 Christophe Giboudeaux 2021-03-10 19:37:17 UTC
I tried adding the opencolorio dependency back on ARM builds and sadly that still breaks the build:

[ 3658s] /home/abuild/rpmbuild/BUILD/krita-4.4.2/plugins/dockers/lut/ocio_display_filter.cpp: In member function 'virtual bool OcioDisplayFilter::updateShader()':
[ 3658s] /home/abuild/rpmbuild/BUILD/krita-4.4.2/plugins/dockers/lut/ocio_display_filter.cpp:276:9: error: 'QOpenGLFunctions_3_2_Core' was not declared in this scope; did you mean 'QOpenGLFunctionsPrivate'?
[ 3658s]   276 |         QOpenGLFunctions_3_2_Core *f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>();
[ 3658s]       |         ^~~~~~~~~~~~~~~~~~~~~~~~~
[ 3658s]       |         QOpenGLFunctionsPrivate
[ 3658s] /home/abuild/rpmbuild/BUILD/krita-4.4.2/plugins/dockers/lut/ocio_display_filter.cpp:276:36: error: 'f' was not declared in this scope
[ 3658s]   276 |         QOpenGLFunctions_3_2_Core *f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>();
[ 3658s]       |                                    ^
[ 3658s] /home/abuild/rpmbuild/BUILD/krita-4.4.2/plugins/dockers/lut/ocio_display_filter.cpp:276:118: error: no matching function for call to 'QOpenGLContext::versionFunctions<QOpenGLFunctions_3_2_Core>()'
[ 3659s]   276 |         QOpenGLFunctions_3_2_Core *f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>();
Comment 16 Christophe Giboudeaux 2021-03-11 08:53:03 UTC
investigating. Instead of disabling opencolorio based on the platform, I'll check if QT_OPENGL_ES_2 is defined.
Comment 17 Bug Janitor Service 2021-03-11 15:13:28 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/746
Comment 18 Alvin Wong 2021-03-12 12:52:36 UTC
*** Bug 427856 has been marked as a duplicate of this bug. ***
Comment 19 Alvin Wong 2021-03-12 13:02:43 UTC
(In reply to Halla Rempt from comment #7)
> I don't have access this hardware, but could you please this patch?
> 
> diff --git a/libs/ui/CMakeLists.txt b/libs/ui/CMakeLists.txt
> index 1dd227e432..25db539747 100644
> --- a/libs/ui/CMakeLists.txt
> +++ b/libs/ui/CMakeLists.txt
> @@ -7,7 +7,8 @@ include_directories(SYSTEM
>      ${OCIO_INCLUDE_DIR}
>  )
>  
> -if (ANDROID)
> +# This is going to break when we start building on Windows ARM...
> +if (ANDROID OR (CMAKE_SYSTEM_PROCESSOR MATCHES
> "^(aarch64.*|AARCH64.*|arm64.*|ARM64.*)" AND NOT APPLE))
>      add_definitions(-DQT_OPENGL_ES_3)
>      add_definitions(-DHAS_ONLY_OPENGL_ES)
>      include_directories (${Qt5AndroidExtras_INCLUDE_DIRS})


I want to say this patch is not exactly correct. This assumes any Linux ARM systems can only use OpenGL ES, but it is in fact possible to build Qt to use desktop OpenGL on ARM/AArch64. AFAICT Debian on AArch64 provides system Qt packages configured with desktop OpenGL.

I think there should be ways to determine from Qt's defines whether it is built with desktop OpenGL or OpenGL ES support, instead of guessing based on OS and CPU architecture.
Comment 20 Constantine-D. Kardaris 2021-03-26 18:18:04 UTC
Hello, i got hit by the relevant change that came with krita 4.4.3 forcing opengles based on cpu architecture while Qt is built with opengl.
On Gentoo aarch64, Qt built with gles2-only DISABLED, when canvas is loading krita crashes with:

ASSERT (krita): "ASSERT failure in KisOpenGLImageTextures::updateTextureFormat: "Unexpected KisOpenGL::hasOpenGLES returned false" (false)" in file /var/tmp/portage/media-gfx/krita-4.4.3/work/krita-4.4.3/libs/ui/opengl/kis_opengl_image_textures.cpp, line 557
Aborted

Reverting 2d92ee5b01a0069cc33debdcb3c29dc817c2d6f3 brings everything back to normal.

I guess im going to switch Qt+Krita to opengles anyway but, on par with Alvin Wong's comment, just matching cpu architecture is not enough.
Comment 21 Fabian 2021-06-21 00:31:14 UTC
This is on a Pinebook Pro running Manjaro-ARM (aarch64).
I'm seeing a crash when creating a new image, if OpenGL canvas is enabled, but not when it's disabled.

ASSERT (krita): "ASSERT failure in KisOpenGLImageTextures::updateTextureFormat: "Unexpected KisOpenGL::hasOpenGLES returned false" (false)" in file /build/krita/src/krita-4.4.5/libs/ui/opengl/kis_opengl_image_textures.cpp, line 557
KCrash: crashing... crashRecursionCounter = 2
Comment 22 Halla Rempt 2021-09-08 09:36:29 UTC
*** Bug 442146 has been marked as a duplicate of this bug. ***
Comment 23 Bug Janitor Service 2021-09-08 12:03:36 UTC Comment hidden (obsolete)
Comment 24 Bug Janitor Service 2021-09-08 12:03:39 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1043
Comment 25 Alvin Wong 2021-09-08 12:08:04 UTC
Can someone with an ARM Linux environment try the above MR and see if it fixes the crash issue?
Comment 26 Alvin Wong 2021-09-13 08:14:16 UTC
Git commit 82f9ae948f910f22556d5095eaf37ffb5f21438d by Alvin Wong.
Committed on 13/09/2021 at 08:13.
Pushed by alvinwong into branch 'master'.

Fix ARM builds using Qt with desktop OpenGL support

Qt sets QT_OPENGL_ES_2 only if configured with OpenGL ES, so we can use
it to substitute our HAS_ONLY_OPENGL_ES define.

Windows builds sets QT_OPENGL_ES_2_ANGLE and QT_OPENGL_DYNAMIC instead,
so it should be safe.

M  +5    -2    libs/ui/CMakeLists.txt
M  +2    -1    libs/ui/canvas/kis_mirror_axis.cpp
M  +7    -7    libs/ui/opengl/kis_opengl_canvas2.cpp
M  +9    -9    libs/ui/opengl/kis_opengl_image_textures.cpp

https://invent.kde.org/graphics/krita/commit/82f9ae948f910f22556d5095eaf37ffb5f21438d
Comment 27 Alvin Wong 2021-09-13 08:14:26 UTC
Git commit eb5fe152b721efaf624f99e8f506a94dc7d9fb93 by Alvin Wong, on behalf of L. E. Segovia.
Committed on 13/09/2021 at 08:13.
Pushed by alvinwong into branch 'master'.

OpenColorIO: support only OpenGL ES present

M  +11   -1    plugins/dockers/lut/ocio_display_filter.cpp

https://invent.kde.org/graphics/krita/commit/eb5fe152b721efaf624f99e8f506a94dc7d9fb93
Comment 28 Alvin Wong 2021-09-13 08:15:54 UTC
Git commit 61ec45b776e39dd4fcc233a0636b0a1c346ba00f by Alvin Wong.
Committed on 13/09/2021 at 08:15.
Pushed by alvinwong into branch 'krita/5.0'.

Fix ARM builds using Qt with desktop OpenGL support

Qt sets QT_OPENGL_ES_2 only if configured with OpenGL ES, so we can use
it to substitute our HAS_ONLY_OPENGL_ES define.

Windows builds sets QT_OPENGL_ES_2_ANGLE and QT_OPENGL_DYNAMIC instead,
so it should be safe.
(cherry picked from commit 82f9ae948f910f22556d5095eaf37ffb5f21438d)

M  +5    -2    libs/ui/CMakeLists.txt
M  +2    -1    libs/ui/canvas/kis_mirror_axis.cpp
M  +7    -7    libs/ui/opengl/kis_opengl_canvas2.cpp
M  +9    -9    libs/ui/opengl/kis_opengl_image_textures.cpp

https://invent.kde.org/graphics/krita/commit/61ec45b776e39dd4fcc233a0636b0a1c346ba00f
Comment 29 Alvin Wong 2021-09-13 08:16:03 UTC
Git commit 7fe8cd59ef756a93be672099868948eecf6e4fe8 by Alvin Wong, on behalf of L. E. Segovia.
Committed on 13/09/2021 at 08:15.
Pushed by alvinwong into branch 'krita/5.0'.

OpenColorIO: support only OpenGL ES present
(cherry picked from commit eb5fe152b721efaf624f99e8f506a94dc7d9fb93)

M  +11   -1    plugins/dockers/lut/ocio_display_filter.cpp

https://invent.kde.org/graphics/krita/commit/7fe8cd59ef756a93be672099868948eecf6e4fe8