Skip to content

build(4.x) OpenEXR 2.2 or earlier cannot be used with C++17 or later#26678

Merged
asmorkalov merged 8 commits intoopencv:4.xfrom
Kumataro:fix26673
Jan 24, 2025
Merged

build(4.x) OpenEXR 2.2 or earlier cannot be used with C++17 or later#26678
asmorkalov merged 8 commits intoopencv:4.xfrom
Kumataro:fix26673

Conversation

@Kumataro
Copy link
Copy Markdown
Contributor

@Kumataro Kumataro commented Dec 29, 2024

Close #26673
Close #25313

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

if(NOT OPENEXR_VERSION)
SET(OPENEXR_VERSION "Unknown")
else()
if(HAVE_CXX17 AND OPENEXR_VERSION STRLESS "2_3")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

STRLESS
"2_3"

Why is not VERSION_LESS?

OPENEXR_VERSION=2.3.0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your comment!

I think usually ‘VERSION_LESS` is better to compare version strings, but OpenCV use not standard version string for system OpenEXR, which is splited with "_" instead of ".".

Like built-in OpenEXR. I'll try to fix this at this pull request.

IF (OPENEXR_VERSION_MAJOR AND OPENEXR_VERSION_MINOR)
set(OPENEXR_VERSION "${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}")
ENDIF ()

https://cmake.org/cmake/help/latest/command/if.html#version-comparisons

if(<variable|string> VERSION_LESS <variable|string>)
Component-wise integer version number comparison (version format is major[.minor[.patch[.tweak]]], omitted components are treated as zero).

Build-in OpenEXR (Ver 2.3.0)

--     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.43)
--     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.5.1)
--     JPEG 2000:                   OpenJPEG (ver 2.5.0)
--     OpenEXR:                     build (ver 2.3.0)

System OpenEXR (Ver 2_2)

--     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.43)
--     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.5.1)
--     JPEG 2000:                   OpenJPEG (ver 2.5.0)
--     OpenEXR:                     /usr/local/lib/libImath-2_2.so /usr/local/lib/libIlmImf-2_2.so /usr/local/lib/libIex-2_2.so /usr/local/lib/libHalf.so /usr/local/lib/libIlmThread-2_2.so (ver 2_2)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it. Currently OPENEXR_VERSION had been also used to search libraries.
So I split it into OPENEXR_VERSION_MM to search and OPENEXR_VERSION to show and comparing.

--     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.43)
--     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.5.1)
--     JPEG 2000:                   OpenJPEG (ver 2.5.0)
--     OpenEXR:                     /usr/local/lib/libImath-2_2.so /usr/local/lib/libIlmImf-2_2.so /usr/local/lib/libIex-2_2.so /usr/local/lib/libHalf.so /usr/local/lib/libIlmThread-2_2.so (ver 2.2.0)

And I also fixed potential problem.

    IF (OPENEXR_VERSION_MAJOR AND OPENEXR_VERSION_MINOR)
        set(OPENEXR_VERSION "${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}")
    ENDIF ()

If OpenEXR Ver x.0.y is used, this set(OPENEXR_VERSION) statement will not be executed.

    IF (OPENEXR_VERSION_MAJOR AND OPENEXR_VERSION_MINOR)

    IF (4 AND 0)

    IF (TRUE AND FALSE)  # non-zero means TRUE, zero means FALSE

    IF (FALSE)

@Kumataro
Copy link
Copy Markdown
Contributor Author

Test in PR:4.x / macOS-ARM64-Vulkan / BuildAndTest is failed, but this test is failed in other pull quest too(from about 12/22 ?) . So I believe they are not related.

[ RUN      ] Test_TFLite.face_landmark/0, where GetParam() = VKCOM/VULKAN
/Users/opencv-cn/GHA-OCV-3/_work/opencv/opencv/opencv/modules/dnn/test/test_common.impl.hpp:84: Failure
Expected: (normL1) <= (l1), actual: 2.13794e-05 vs 2e-05
conv2d_20  |ref| = 164.86170959472656
[  FAILED  ] Test_TFLite.face_landmark/0, where GetParam() = VKCOM/VULKAN (31 ms)

void normAssert(
cv::InputArray ref, cv::InputArray test, const char *comment /*= ""*/,
double l1 /*= 0.00001*/, double lInf /*= 0.0001*/)
{
double normL1 = cvtest::norm(ref, test, cv::NORM_L1) / ref.getMat().total();
EXPECT_LE(normL1, l1) << comment << " |ref| = " << cvtest::norm(ref, cv::NORM_INF);
double normInf = cvtest::norm(ref, test, cv::NORM_INF);
EXPECT_LE(normInf, lInf) << comment << " |ref| = " << cvtest::norm(ref, cv::NORM_INF);
}

@asmorkalov
Copy link
Copy Markdown
Contributor

Vulkan issue addressed in #26691.

@asmorkalov asmorkalov added this to the 4.12.0 milestone Jan 4, 2025
@asmorkalov
Copy link
Copy Markdown
Contributor

@Kumataro please rebase the PR and fix the conflicts. Is the PR ready for integration?

@Kumataro
Copy link
Copy Markdown
Contributor Author

Umm ... I feel there are something wrongs.
I'm not familiar to git rebase. git log shows my expected result.
However it seems that this pull request contains 108 commit ...?

Should I recreate new pull request and/or branch again ?

commit 8bd3127e88ff49f2eefdbbb4db4bc6c35eea8c46 (HEAD -> fix26673, priv/fix26673)
Merge: 5e07bf7af6 3ac42c0102
Author: Kumataro <Kumataro@users.noreply.github.com>
Date:   Thu Jan 23 22:35:28 2025 +0900

    fix to conflict

commit 5e07bf7af67190c56030043b5452d1fd1871fb15
Author: Kumataro <Kumataro@users.noreply.github.com>
Date:   Thu Jan 23 22:30:48 2025 +0900

    fix to conflict

commit a6c22dc49591cdc1018082cd30b047c914000360
Author: Kumataro <Kumataro@users.noreply.github.com>
Date:   Sun Dec 29 19:03:15 2024 +0900

    replace tab to space

commit 909c3ea55632f2fa86f7b76d40c869b853edfceb
Author: Kumataro <Kumataro@users.noreply.github.com>
Date:   Sun Dec 29 12:37:55 2024 +0900

    change version string format

commit 2c820757a1c813931db40f34cc5e973c7e09783f
Author: Kumataro <Kumataro@users.noreply.github.com>
Date:   Sun Dec 29 11:01:28 2024 +0900

    imgcodecs: OpenEXR 2.2 or earlier cannot be used combination with C++17 or later.

commit 4a4031dc48475ec3354d28a3cdedda57a8913443 (origin/master, origin/HEAD, origin/4.x, 4.x)
Merge: c623a5afc1 f825b4d1ab
Author: Alexander Smorkalov <2536374+asmorkalov@users.noreply.github.com>
Date:   Wed Jan 22 20:48:29 2025 +0300

    Merge pull request #26601 from dai-xin:4.x

    VideoCapture open camera slow

@sturkmen72
Copy link
Copy Markdown
Contributor

image
i think you should click edit and select target branch

@Kumataro
Copy link
Copy Markdown
Contributor Author

Thank you very much for your advice !! I fixed it now.

Copy link
Copy Markdown
Member

@fengyuentau fengyuentau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@asmorkalov asmorkalov merged commit ab77e1c into opencv:4.x Jan 24, 2025
@asmorkalov asmorkalov mentioned this pull request Feb 19, 2025
NanQin555 pushed a commit to NanQin555/opencv that referenced this pull request Feb 24, 2025
OpenEXR 2.2 or earlier cannot be used with C++17 or later opencv#26678

Close opencv#26673
Close opencv#25313

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build (5.x): system OpenEXR may cause build failure due to switching to C++17 Compilation error with C++17 standard

5 participants