Bug 1968167 - LuminanceHDR does not build with OpenEXR 3.x
Summary: LuminanceHDR does not build with OpenEXR 3.x
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: luminance-hdr
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ben Beasley
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-06-06 12:34 UTC by Ben Beasley
Modified: 2021-08-05 17:26 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-08-05 17:26:36 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ben Beasley 2021-06-06 12:34:21 UTC
Description of problem:

It is not obvious how to adapt the luminance-hdr package to build with the new OpenEXR 3.x packages coming soon to Fedora Rawhide (35).

How reproducible:


Steps to Reproduce:
1. 

mkdir -p ~/.config/mock
cat > ~/.config/mock/fedora-rawhide-openexr3.cfg <<'EOF'
include('/etc/mock/fedora-rawhide-x86_64.cfg')

config_opts['root'] = 'fedora-rawhide-openexr3'

config_opts[f'{config_opts.package_manager}.conf'] += """

[openexr3]
name=Copr repo for openexr owned by hobbes1069
baseurl=https://download.copr.fedorainfracloud.org/results/hobbes1069/openexr/fedora-rawhide-$basearch/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://download.copr.fedorainfracloud.org/results/hobbes1069/openexr/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1
EOF

2. fedpkg co luminance-hdr
3. cd luminance-hdr
4. fedpkg srpm
5. mock -r fedora-rawhide-openexr3 --rebuild luminance-hdr-2.6.1.1-3.fc35.src.rpm

Actual results:

Build fails

Expected results:

Build succeeds

Additional info:

I tried removing the lines

```cmake
FIND_PACKAGE(OpenEXR REQUIRED)
INCLUDE_DIRECTORIES(${OPENEXR_INCLUDE_DIR} "${OPENEXR_INCLUDE_DIR}/OpenEXR")
```

from `CMakeLists.txt` to patch out the OpenEXR 2.x specific configuration from upstream. Instead, I added the output of `pkgconf --cflags OpenEXR` to the global `CFLAGS` and `CXXFLAGS`, and the output of `pkgconf --libs OpenEXR` to `LDFLAGS`.

The result was a panoply of linker errors.

I inferred that the problem might be that openexr was built using the compiler’s default C++ standard, which is gnu++17, while LuminanceHDR forces C++11. There is no (reliable) ABI compatibility across C++ versions, so I patched `CMAKE_CXX_STANDARD 17` (instead of 11) into `build_files/Modules/CompilerSettings.cmake`; just setting `-DCMAKE_CXX_STANDARD=17` did not override the contents of this file.

Switching to C++17 meant `std::clamp` appeared in `<algorithm>`, which was ambiguous with the `clamp` in an unnamed namespace in `src/Libpfs/manip/gamma_levels.cpp`. To resolve this, I could either remove the definition of `clamp` and add `using std::clamp;` (or call `std::clamp(` every time), or rename `clamp`, e.g. to `xclamp`, and call that instead. I chose the former.

After all that, I was back to staring at a bunch of linker errors of the form:

> undefined reference to `Imf_3_0::…`

even though

> -lOpenEXR-3_0 -lOpenEXRUtil-3_0 -lIex-3_0 -lIlmThread-3_0 -lImath-3_0

are in the linker invocation.

-----

I am not sure I will be able to fix this with a reasonable amount of effort. Help is more than welcome.

Comment 1 Ben Beasley 2021-06-06 12:36:57 UTC
Filed upstream: https://github.com/LuminanceHDR/LuminanceHDR/issues/244

Comment 2 Richard Shaw 2021-06-06 12:47:46 UTC
Well that sucks... Depending on how many packages I'm unable to port to 3.x I wonder if a openexr2 package should be considered?

Comment 3 Ben Beasley 2021-06-06 14:04:27 UTC
> Well that sucks... Depending on how many packages I'm unable to port to 3.x I wonder if a openexr2 package should be considered?

From just a LuminanceHDR perspective… the last upstream commit was almost a year and a half ago. It’s hard to tell if it’s maintained now or not. If upstream is dead, building against a compat version of OpenEXR is probably just prolonging the inevitable retirement. On the other hand, it’s entirely possible that upstream will spring back to life at some point in the next year or two, in which case maintaining a compat package to avoid retiring will look like it was a good choice.

Have a crystal ball handy?

-----

While I’ve about exhausted the time I’m willing to spend trying to patch the build, it’s also possible that there is some simple workaround I’ve missed.

Comment 4 Ben Beasley 2021-07-07 20:54:37 UTC
Richard, I’ve been tracking your efforts to deal with the broader OpenEXR compatibility fiasco. Thanks! I’ve updated LuminanceHDR to use the brand-new compatibility package in Rawhide, and it seems to build well enough (https://koji.fedoraproject.org/koji/taskinfo?taskID=71481847).

I‘m leaving this issue open, as the lack of upstream 3.x compatibility is still a problem in the medium term.

Comment 5 Ben Beasley 2021-08-05 17:26:36 UTC
I’ll go ahead and close this as CANTFIX. Patches welcome—or maybe upstream will resume development at some point.


Note You need to log in before you can comment on or make changes to this bug.