Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUILD] Build fails when enabling libjxl support #4558

Open
efleurant opened this issue Dec 4, 2024 · 11 comments
Open

[BUILD] Build fails when enabling libjxl support #4558

efleurant opened this issue Dec 4, 2024 · 11 comments

Comments

@efleurant
Copy link

I'm trying to build OpenImageIO 3.0.1.0 with libjxl support, but the build fails with the following error:

[ 62%] Building CXX object src/libOpenImageIO/CMakeFiles/OpenImageIO.dir/__/jpegxl.imageio/jxlinput.cpp.o
[ 62%] Building CXX object src/libOpenImageIO/CMakeFiles/OpenImageIO.dir/__/jpegxl.imageio/jxloutput.cpp.o
[ 62%] Building CXX object src/libOpenImageIO/CMakeFiles/OpenImageIO.dir/__/null.imageio/nullimageio.cpp.o
[ 63%] Building CXX object src/libOpenImageIO/CMakeFiles/OpenImageIO.dir/__/openexr.imageio/exrinput.cpp.o
[ 63%] Building CXX object src/libOpenImageIO/CMakeFiles/OpenImageIO.dir/__/openexr.imageio/exroutput.cpp.o
/foo/source/OpenImageIO/src/jpegxl.imageio/jxlinput.cpp: In member function ‘virtual bool OpenImageIO_v3_0::JxlInput::open(const string&, OpenImageIO_v3_0::ImageSpec&)’:
/foo/source/OpenImageIO/src/jpegxl.imageio/jxlinput.cpp:285:48: error: cannot convert ‘JxlColorProfileTarget’ to ‘const JxlPixelFormat*’
  285 |                                                JXL_COLOR_PROFILE_TARGET_DATA,
      |                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                |
      |                                                JxlColorProfileTarget
In file included from /foo/source/OpenImageIO/src/jpegxl.imageio/jxlinput.cpp:24:
/usr/include/jxl/decode.h:794:50: note:   initializing argument 2 of ‘JxlDecoderStatus JxlDecoderGetICCProfileSize(const JxlDecoder*, const JxlPixelFormat*, JxlColorProfileTarget, size_t*)’
  794 |     const JxlDecoder* dec, const JxlPixelFormat* unused_format,
      |                            ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/foo/source/OpenImageIO/src/jpegxl.imageio/jxlinput.cpp:293:51: error: cannot convert ‘JxlColorProfileTarget’ to ‘const JxlPixelFormat*’
  293 |                                                   JXL_COLOR_PROFILE_TARGET_DATA,
      |                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                   |
      |                                                   JxlColorProfileTarget
In file included from /foo/source/OpenImageIO/src/jpegxl.imageio/jxlinput.cpp:24:
/usr/include/jxl/decode.h:814:50: note:   initializing argument 2 of ‘JxlDecoderStatus JxlDecoderGetColorAsICCProfile(const JxlDecoder*, const JxlPixelFormat*, JxlColorProfileTarget, uint8_t*, size_t)’
  814 |     const JxlDecoder* dec, const JxlPixelFormat* unused_format,
      |                            ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
[ 64%] Building CXX object src/libOpenImageIO/CMakeFiles/OpenImageIO.dir/__/openexr.imageio/exrinput_c.cpp.o
/foo/source/OpenImageIO/src/jpegxl.imageio/jxloutput.cpp: In member function ‘virtual bool OpenImageIO_v3_0::JxlOutput::open(const string&, const OpenImageIO_v3_0::ImageSpec&, OpenImageIO_v3_0::ImageOutput::OpenMode)’:
/foo/source/OpenImageIO/src/jpegxl.imageio/jxloutput.cpp:134:5: error: ‘JxlEncoderAllowExpertOptions’ was not declared in this scope
  134 |     JxlEncoderAllowExpertOptions(m_encoder.get());
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 64%] Building CXX object src/libOpenImageIO/CMakeFiles/OpenImageIO.dir/__/openvdb.imageio/openvdbinput.cpp.o
[ 65%] Building CXX object src/libOpenImageIO/CMakeFiles/OpenImageIO.dir/__/png.imageio/pnginput.cpp.o
make[2]: *** [src/libOpenImageIO/CMakeFiles/OpenImageIO.dir/build.make:1168: src/libOpenImageIO/CMakeFiles/OpenImageIO.dir/__/jpegxl.imageio/jxlinput.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [src/libOpenImageIO/CMakeFiles/OpenImageIO.dir/build.make:1182: src/libOpenImageIO/CMakeFiles/OpenImageIO.dir/__/jpegxl.imageio/jxloutput.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2297: src/libOpenImageIO/CMakeFiles/OpenImageIO.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 65%] Linking CXX executable ../../bin/strutil_test
[ 65%] Built target strutil_test
make: *** [Makefile:166: all] Error 2

I had the same error when building OIIO 3.0.0.3

I'm using libjxl v0.11.1
GCC: 11.4.1
cmake: 3.27.8
OS: Rocky Linux 9.4

There's no mention of a supported version of libxl in the installation instruction, so maybe the issue is that the version I'm using is not supported?

Thanks for your help in advance,
Cheers

@efleurant efleurant changed the title [BUILD] Enabling libjxl [BUILD] Build fails when enabling libjxl support Dec 4, 2024
@lgritz
Copy link
Collaborator

lgritz commented Dec 4, 2024

Do you know what version of libjxl is being found/used?

@lgritz
Copy link
Collaborator

lgritz commented Dec 4, 2024

Never mind, I see you posted it. Sorry.

@lgritz
Copy link
Collaborator

lgritz commented Dec 4, 2024

@ssh4net or @1div0, do you have any insight about what might be going on here?

@1div0
Copy link
Contributor

1div0 commented Dec 4, 2024

Checking the JxlEncoderAllowExpertOptions() now. Will dig deeper tomorrow.

@lgritz
Copy link
Collaborator

lgritz commented Dec 4, 2024

The INSTALL.md does not mention libjxl, that was an oversight and should be added.

externalpackages.cmake implies that the minimum is libjxl 0.10.1. The report above indicates v0.11.1 is being used. So maybe our minimum is too low? Or is the 0.11.1 too new -- i.e., changes have occurred recently that are incompatible with what we have, and we need adjustment on our end? Those two choices are among the first things I'd recommend double-checking.

@1div0
Copy link
Contributor

1div0 commented Dec 4, 2024

This 0.11.1 is hot. So API/ABI impedance mismatch.

@lgritz
Copy link
Collaborator

lgritz commented Dec 4, 2024

Oh, I see, just released this past week!

So probably we just need to make adjustments on our end to accommodate recent changes on the libjxl side.

@lgritz
Copy link
Collaborator

lgritz commented Dec 4, 2024

We don't have a lot of historical experience with libjxl, so I don't know how frequently it's likely to break its APIs. But if we think breaking changes might be common for libjxl, it may be another library that we wish to build from scratch as part of our "bleeding edge" CI test, so that we can see any incompatibilities coming long before they are a tagged version.

@lgritz
Copy link
Collaborator

lgritz commented Dec 4, 2024

(The "bleeding edge" test is one corner of our CI where we build main/master top-of-tree of several key dependencies, to catch problems before they make releases.)

@1div0
Copy link
Contributor

1div0 commented Dec 4, 2024

Beware the libjxl build is quite a long process. So this should be made optional, and probably off by default.

So, YMMV.

@lgritz
Copy link
Collaborator

lgritz commented Dec 4, 2024

Aha, understood. I was just speculating.

The libraries we build from scratch for bleeding edge are chosen based on some balance of their degree of criticality, how likely they are to break compatibility, and the time and effort to build them. So maybe libtiff or OpenEXR are both highly critical and worth the relatively low expense to build, but possibly libjxl won't strike the right balance.

I mainly just wanted you to know that this is an option if it seems worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants