Bug 419277 - krita-4.2.9: CMake Error at cmake/modules/FindOpenEXR.cmake:43, 49, 55: string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to command
Summary: krita-4.2.9: CMake Error at cmake/modules/FindOpenEXR.cmake:43, 49, 55: strin...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: File formats (show other bugs)
Version: 4.2.9
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: amyspark
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2020-03-27 00:53 UTC by Andreas Sturmlechner
Modified: 2021-10-10 02:55 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
build.log (30.07 KB, text/x-log)
2020-03-27 00:53 UTC, Andreas Sturmlechner
Details
krita-4.2.9-ecm-findopenexr.patch (12.32 KB, patch)
2020-04-02 13:08 UTC, Andreas Sturmlechner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Sturmlechner 2020-03-27 00:53:33 UTC
Created attachment 127037 [details]
build.log

This is a regression over 4.2.8.

cmake-3.17.0
ilmbase/openexr-2.3.0

...
CMake Error at cmake/modules/FindOpenEXR.cmake:43 (string):
  string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  CMakeLists.txt:569 (find_package)


CMake Error at cmake/modules/FindOpenEXR.cmake:49 (string):
  string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  CMakeLists.txt:569 (find_package)


CMake Error at cmake/modules/FindOpenEXR.cmake:55 (string):
  string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  CMakeLists.txt:569 (find_package)


-- Found OpenEXR: /usr/include;/usr/include/OpenEXR
Comment 1 Halla Rempt 2020-03-27 08:43:35 UTC
We build Krita with v2.4.0 on four platforms, and I build locally with v2.2.0, and I don't get these errors...
Comment 2 Halla Rempt 2020-03-27 11:40:47 UTC
I suspect it's not openexr, but the version of cmake you're using. I'm using 3.10.2 locally.
Comment 3 Andreas Sturmlechner 2020-03-27 12:23:58 UTC
That is possible, and I will give it a try in the evening, however 4.2.8.2 was fine with that version of cmake.
Comment 4 Andreas Sturmlechner 2020-03-28 11:02:48 UTC
Same result with cmake-3.16.5, 3.14.6 and 3.13.5 which is the oldest version I can test with. Happy to provide any additional information, I haven't had time myself to look into the particular failing lines yet.
Comment 5 Robert 2020-03-29 19:57:43 UTC
I have this same issue. 
But thing is I had a successful build prior to trying to update krita a few days ago. All using the same cmake version in gentoo cmake-3.16.5. 
I also downgraded the cmake version and have the same error.
The only thing that is different is that I have upgraded to kde-frameworks/extra-cmake-modules-5.68.0 since the last time that I built krita. But I do not know if that would affect the build.
Comment 6 Andreas Sturmlechner 2020-04-02 13:08:42 UTC
Created attachment 127190 [details]
krita-4.2.9-ecm-findopenexr.patch

fixed using the attached patches
Comment 7 Halla Rempt 2020-04-02 13:12:12 UTC
After my current rebuild, I'll reboot to windows and see what happens there.
Comment 8 Halla Rempt 2020-05-06 11:24:38 UTC
And that was a month ago... But I'm on Windows now, and if I apply that patch, openexr isn't found at all:

-- The following OPTIONAL packages have not been found:

 * OpenEXR, High dynamic-range (HDR) image file format, <https://www.openexr.com>
   Required by the Krita OpenEXR filter
Comment 9 Halla Rempt 2020-05-26 10:16:32 UTC
Stranger still, if I update to cmake 3.17.2, I still don't get these errors.
Comment 10 Robert 2020-05-28 22:37:52 UTC
@Boudewijn Rempt I have been still trying to build krita but I keep getting the error but I noticed that right after the error it checks openexr and marks it as found. Is the order of the build causing the errors?
Comment 11 vanyossi 2020-05-30 01:07:26 UTC
just to add more info to this thread

Compiled krita on tumbleweed no problems

cmake: 3.17.2
openexr: 2.4.1-1-.1

Please try with openexr 2.4.1. Gentoo can be overly enthusiat and include not so stable packages in "stable". Sometimes is needed to add a package.keyword to get the patched version. If not make sure you are not using any strange gentoo overlay. also check if in the ebuild steps there is no suspicious gentoo patch.
Comment 12 Robert 2020-05-30 06:59:11 UTC
@vanyossi 
Thank you very much for these pointers!! It was just what I needed to get it working.
I was able to find that not only was the version of openexr an older version but also that my binutils was masked and using an outdated version.
I had to use an overlay to get the openexr: 2.4.1-1-.1 version. I had already had cmake: 3.17.2 installed.
Now my cmake command is building and I am running make right now, and so far it is working a treat.
Thank you very much for pointing me in the right direction.
Comment 13 Andreas Sturmlechner 2020-05-30 16:10:49 UTC
I disagree.

$ equery l openexr
 * Searching for openexr ...
[IP-] [  ] media-libs/openexr-2.3.0

^ that's not from an overlay, that's certainly not 'overly enthusiast' a version. If krita's build system does not correctly detect that version, then maybe it should raise the minimum version, although it would be pity for something that 'just works' with the ECM version of openexr module detection.
Comment 14 Andreas Sturmlechner 2020-05-30 16:13:45 UTC
And, arguably, if the ECM cmake module for OpenEXR has a bug for detecting OpenEXR on Windows, that would be nice to get fixed in ECM itself for the benefit of all ECM based projects.
Comment 15 Robert 2020-05-30 19:36:32 UTC
The media-libs/openexr-2.3.0 was the only version that portage has, that is why I had to use an overlay for the newer version. I am not sure if that was the same version that had been working before.
Comment 16 Andreas Sturmlechner 2020-05-30 21:16:18 UTC
That's why we don't close bugs based on speculation or the Gentoo overly enthusiast trope.
Comment 17 Halla Rempt 2020-05-31 09:33:44 UTC
Note: Krita has never used ecm's FindOpenExr.cmake find module. The current one, from Pixar, replaces an older one that couldn't find openexr on Windows.
Comment 18 Andreas Sturmlechner 2020-05-31 14:37:23 UTC
Ah, I was misled by commit d978a33a then.
Comment 19 Andreas Sturmlechner 2020-07-21 20:19:06 UTC
So I had the chance to try with openexr-2.5.2 and krita git master detects it fine unmodified.

Which means the regex thing is just too brittle to reliably detect 2.3.0 for some reason, and I would not be too confident for this issue not to come up again in the future.
Comment 20 Halla Rempt 2021-02-19 15:46:57 UTC
Wasn't this fixed by now?
Comment 21 Andreas Sturmlechner 2021-02-24 20:12:11 UTC
(In reply to Halla Rempt from comment #20)
> Wasn't this fixed by now?
That depends how you look at it. cmake/modules/FindOpenEXR.cmake didn't receive any fix for that meanwhile.

I'm still applying the patch to use ECM FindOpenEXR to krita 4.4.2 because I know it works and our repository still provides the older openexr-2.3.0 (even if likely not used by krita users) besides >=2.5 where Pixar's module seems to work. 

- Can we be sure it won't break in the future?
- Shouldn't ideally be ECM's module be fixed to work with Windows?
Comment 22 Halla Rempt 2021-02-26 12:54:59 UTC
Yes, ideally we'd fix it in ECM, but I haven't got any idea how to properly fix this.
Comment 23 amyspark 2021-09-10 17:47:09 UTC
If the ECM module works everywhere *except for Windows*, I know what the issue is. Assigning.
Comment 24 Bug Janitor Service 2021-09-10 21:45:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1049
Comment 25 amyspark 2021-09-10 21:47:50 UTC
(In reply to Andreas Sturmlechner from comment #21)
> (In reply to Halla Rempt from comment #20)
> > Wasn't this fixed by now?
> That depends how you look at it. cmake/modules/FindOpenEXR.cmake didn't
> receive any fix for that meanwhile.
> 
> I'm still applying the patch to use ECM FindOpenEXR to krita 4.4.2 because I
> know it works and our repository still provides the older openexr-2.3.0
> (even if likely not used by krita users) besides >=2.5 where Pixar's module
> seems to work. 
> 
> - Can we be sure it won't break in the future?
> - Shouldn't ideally be ECM's module be fixed to work with Windows?

Andreas, it'd be great if you could check with the module in my MR. Let me know if you find any errors.
Comment 26 Dmitry Kazakov 2021-09-19 10:50:44 UTC
Git commit 7699e8a1cb0d18751ad02fb786c0d15562a76e51 by Dmitry Kazakov, on behalf of L. E. Segovia.
Committed on 19/09/2021 at 10:49.
Pushed by dkazakov into branch 'master'.

OpenEXR: upgrade our Find module

Currently, we use Pixar's find module to manage OpenEXR 2, which cannot
find either v2.3 and lower or v3. The suggestion in the bug report was
to use ECM, which in turn has the following issues:

* It completely ignores the versioned suffix that OpenEXR applies
to its libraries; this implies that it's relying on Linux's symlinks to
point it to the correct library. This is a blocker for any level of
support for Windows.

* Secondly, but also less serious, it doesn't cover the IexMath and
IlmImfUtil subcomponents.

This commit replaces our Find module with ECM's, and makes the following
modifications.

1. Find and use any CMake config module that OpenEXR provides.
2. Failing that, construct the library suffix, and manually look up each component.
3. Add IexMath and IlmImfUtil to the list of libraries.
4. Add support for OpenEXR v3 and its list of components.

Additionally, I've cleaned up our find and linking logic.

CCMAIL: kimageshop@kde.org

M  +6    -14   CMakeLists.txt
M  +358  -74   cmake/modules/FindOpenEXR.cmake
M  +0    -3    libs/pigment/CMakeLists.txt
M  +0    -3    plugins/color/lcms2engine/CMakeLists.txt
M  +0    -4    plugins/impex/exr/CMakeLists.txt
M  +0    -3    plugins/impex/raw/CMakeLists.txt

https://invent.kde.org/graphics/krita/commit/7699e8a1cb0d18751ad02fb786c0d15562a76e51
Comment 27 Bug Janitor Service 2021-10-10 02:55:48 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/195