darktable-org / darktable

darktable is an open source photography workflow application and raw developer
https://www.darktable.org
GNU General Public License v3.0
9.72k stars 1.14k forks source link

Ubuntu 22.04 build failure #15103

Closed manu-p closed 1 year ago

manu-p commented 1 year ago

Describe the bug

Hi,

Trying to build dt 4.4.2 from the source on a Ubuntu 22.04.3 machine, I get an error message related to JPEG XL at 51%.

When I remove the lines from the c program that causes this 1st failure, I then get another error message at 93%, also related to JPEG XL.

Steps to reproduce

  1. download source code from https://www.darktable.org/install/
  2. follow build instructions from https://github.com/darktable-org/darktable/wiki/Build-instructions-for-Ubuntu
  3. get the following 1st error message
  4. modify src/imageio/imageio_jpegxl.c to remove the #if and #endif lines that cause the error
  5. replay 2.
  6. get the 2nd error message

More info:

ii  libjxl:amd64                                      0.7.0-20220426.105500-0xiota0~ubuntu22.04           amd64        JPEG XL Image Coding System - "JXL" (shared libraries)
ii  libjxl-dev                                        0.7.0-20220426.105500-0xiota0~ubuntu22.04           amd64        JPEG XL Image Coding System - "JXL" (development files)

Expected behavior

dt should build without error(s)

Logfile | Screenshot | Screencast

1st error message:

[ 51%] Building C object bin/CMakeFiles/lib_darktable.dir/imageio/imageio_avif.c.o
/darktable-4.4.2/src/imageio/imageio_jpegxl.c: In function ‘dt_imageio_open_jpegxl’:
/darktable-4.4.2/src/imageio/imageio_jpegxl.c:227:60: error: missing binary operator before token "("
  227 | #if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
      |                                                            ^
/darktable-4.4.2/src/imageio/imageio_jpegxl.c:230:38: warning: passing argument 2 of ‘JxlDecoderGetICCProfileSize’ makes pointer from integer without a cast [-Wint-conversion]
  230 |                                      JXL_COLOR_PROFILE_TARGET_DATA,
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                      |
      |                                      int
In file included from /darktable-4.4.2/src/imageio/imageio_jpegxl.c:21:
/usr/include/jxl/decode.h:684:74: note: expected ‘const JxlPixelFormat *’ but argument is of type ‘int’
  684 | JxlDecoderGetICCProfileSize(const JxlDecoder* dec, const JxlPixelFormat* format,
      |                                                    ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/darktable-4.4.2/src/imageio/imageio_jpegxl.c:231:38: error: incompatible type for argument 3 of ‘JxlDecoderGetICCProfileSize’
  231 |                                      &icc_size)
      |                                      ^~~~~~~~~
      |                                      |
      |                                      size_t * {aka long unsigned int *}
/usr/include/jxl/decode.h:685:51: note: expected ‘JxlColorProfileTarget’ but argument is of type ‘size_t *’ {aka ‘long unsigned int *’}
  685 |                             JxlColorProfileTarget target, size_t* size);
      |                             ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/darktable-4.4.2/src/imageio/imageio_jpegxl.c:226:10: error: too few arguments to function ‘JxlDecoderGetICCProfileSize’
  226 |       if(JxlDecoderGetICCProfileSize(decoder,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/jxl/decode.h:684:1: note: declared here
  684 | JxlDecoderGetICCProfileSize(const JxlDecoder* dec, const JxlPixelFormat* format,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/imageio_jpegxl.c:239:60: error: missing binary operator before token "("
  239 | #if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
      |                                                            ^
/darktable-4.4.2/src/imageio/imageio_jpegxl.c:242:42: warning: passing argument 2 of ‘JxlDecoderGetColorAsICCProfile’ makes pointer from integer without a cast [-Wint-conversion]
  242 |                                          JXL_COLOR_PROFILE_TARGET_DATA,
      |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                          |
      |                                          int
/usr/include/jxl/decode.h:705:50: note: expected ‘const JxlPixelFormat *’ but argument is of type ‘int’
  705 |     const JxlDecoder* dec, const JxlPixelFormat* format,
      |                            ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/darktable-4.4.2/src/imageio/imageio_jpegxl.c:243:45: error: incompatible type for argument 3 of ‘JxlDecoderGetColorAsICCProfile’
  243 |                                          img->profile,
      |                                          ~~~^~~~~~~~~
      |                                             |
      |                                             uint8_t * {aka unsigned char *}
/usr/include/jxl/decode.h:706:27: note: expected ‘JxlColorProfileTarget’ but argument is of type ‘uint8_t *’ {aka ‘unsigned char *’}
  706 |     JxlColorProfileTarget target, uint8_t* icc_profile, size_t size);
      |     ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/darktable-4.4.2/src/imageio/imageio_jpegxl.c:244:42: warning: passing argument 4 of ‘JxlDecoderGetColorAsICCProfile’ makes pointer from integer without a cast [-Wint-conversion]
  244 |                                          icc_size);
      |                                          ^~~~~~~~
      |                                          |
      |                                          size_t {aka long unsigned int}
/usr/include/jxl/decode.h:706:44: note: expected ‘uint8_t *’ {aka ‘unsigned char *’} but argument is of type ‘size_t’ {aka ‘long unsigned int’}
  706 |     JxlColorProfileTarget target, uint8_t* icc_profile, size_t size);
      |                                   ~~~~~~~~~^~~~~~~~~~~
/darktable-4.4.2/src/imageio/imageio_jpegxl.c:238:11: error: too few arguments to function ‘JxlDecoderGetColorAsICCProfile’
  238 |           JxlDecoderGetColorAsICCProfile(decoder,
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/jxl/decode.h:704:29: note: declared here
  704 | JXL_EXPORT JxlDecoderStatus JxlDecoderGetColorAsICCProfile(
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gmake[2]: *** [bin/CMakeFiles/lib_darktable.dir/build.make:2140 : bin/CMakeFiles/lib_darktable.dir/imageio/imageio_jpegxl.c.o] Erreur 1
gmake[2]: *** Attente des tâches non terminées....
gmake[1]: *** [CMakeFiles/Makefile2:1980 : bin/CMakeFiles/lib_darktable.dir/all] Erreur 2
gmake: *** [Makefile:156 : all] Erreur 2

2nd error message:

[ 93%] Building C object lib/darktable/plugins/imageio/format/CMakeFiles/avif_format.dir/avif.c.o
[ 93%] Linking C shared module libtiff.so
[ 93%] Linking C shared module libchannelmixerrgb.so
/darktable-4.4.2/src/imageio/format/jxl.c: In function ‘write_image’:
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: error: unknown type name ‘JxlEncoderError’; did you mean ‘JxlEncoder’?
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: note: in definition of macro ‘LIBJXL_ASSERT’
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
[ 93%] Linking C shared module libwebp.so
/darktable-4.4.2/src/imageio/format/jxl.c:122:29: warning: implicit declaration of function ‘JxlEncoderGetError’; did you mean ‘JxlEncoderDestroy’? [-Wimplicit-function-declaration]
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |                             ^~~~~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:29: note: in definition of macro ‘LIBJXL_ASSERT’
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |                             ^~~~~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: error: unknown type name ‘JxlEncoderError’; did you mean ‘JxlEncoder’?
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: note: in definition of macro ‘LIBJXL_ASSERT’
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: error: unknown type name ‘JxlEncoderError’; did you mean ‘JxlEncoder’?
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: note: in definition of macro ‘LIBJXL_ASSERT’
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: error: unknown type name ‘JxlEncoderError’; did you mean ‘JxlEncoder’?
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: note: in definition of macro ‘LIBJXL_ASSERT’
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: error: unknown type name ‘JxlEncoderError’; did you mean ‘JxlEncoder’?
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: note: in definition of macro ‘LIBJXL_ASSERT’
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: error: unknown type name ‘JxlEncoderError’; did you mean ‘JxlEncoder’?
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: note: in definition of macro ‘LIBJXL_ASSERT’
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: error: unknown type name ‘JxlEncoderError’; did you mean ‘JxlEncoder’?
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: note: in definition of macro ‘LIBJXL_ASSERT’
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: error: unknown type name ‘JxlEncoderError’; did you mean ‘JxlEncoder’?
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: note: in definition of macro ‘LIBJXL_ASSERT’
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: error: unknown type name ‘JxlEncoderError’; did you mean ‘JxlEncoder’?
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: note: in definition of macro ‘LIBJXL_ASSERT’
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: error: unknown type name ‘JxlEncoderError’; did you mean ‘JxlEncoder’?
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: note: in definition of macro ‘LIBJXL_ASSERT’
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: error: unknown type name ‘JxlEncoderError’; did you mean ‘JxlEncoder’?
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: note: in definition of macro ‘LIBJXL_ASSERT’
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: error: unknown type name ‘JxlEncoderError’; did you mean ‘JxlEncoder’?
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: note: in definition of macro ‘LIBJXL_ASSERT’
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: error: unknown type name ‘JxlEncoderError’; did you mean ‘JxlEncoder’?
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
/darktable-4.4.2/src/imageio/format/jxl.c:122:7: note: in definition of macro ‘LIBJXL_ASSERT’
  122 |       JxlEncoderError err = JxlEncoderGetError(encoder);                                                          \
      |       ^~~~~~~~~~~~~~~
gmake[2]: *** [lib/darktable/plugins/imageio/format/CMakeFiles/jxl_format.dir/build.make:76 : lib/darktable/plugins/imageio/format/CMakeFiles/jxl_format.dir/jxl.c.o] Erreur 1
gmake[1]: *** [CMakeFiles/Makefile2:6169 : lib/darktable/plugins/imageio/format/CMakeFiles/jxl_format.dir/all] Erreur 2

Commit

No response

Where did you install darktable from?

darktable.org

darktable version

4.4.2

What OS are you using?

Linux

What is the version of your OS?

Ubuntu 22.04.3

Describe your system?

Intel(R) Core(TM) i7-3740QM CPU @ 2.70GHz RAM : 14GiB X11 GTK3

Are you using OpenCL GPU in darktable?

No

If yes, what is the GPU card and driver?

NVIDIA GK107GLM [Quadro K1000M] nvidia-driver-390

Please provide additional context if applicable. You can attach files too, but might need to rename to .txt or .zip

No response

MStraeten commented 1 year ago

maybe your libjxl is outdated (on macports it's already 0.8.2)

manu-p commented 1 year ago

Thanks @MStraeten for taking care!

Maybe yes, but if you take a look at https://github.com/darktable-org/darktable#dependencies you'll find:

Optional dependencies (minimum version):

[ . . . ]
libjxl 0.7.0 (for JPEG XL import & export)

And I must add that, I already have dt 4.4.2 running on this same machine, which I previously compiled following the exact same method.

The reason why I do it again (somewhere else /opt/darktable) is that I'm trying to build a deb package for this version, which is still not available at the moment, and in that process I'm facing the same issues. So I just tried to build dt back again in order to see if it was the same. And it is.

manu-p commented 1 year ago

Even the latest version of Ubuntu, mantic, is using libjxl 0.7.0...

parafin commented 1 year ago

Note that it's optional dependency, so you can just disable it at configuration stage (something like ./build.sh --disable-jxl) if you don't need JPEG XL support.

manu-p commented 1 year ago

You're right @parafin and too bad for jxl ! ;-)

So I could build dt 4.4.2 with the support of many file types, and I could do something for the deb package.

victoryforce commented 1 year ago

The reason why I do it again is that I'm trying to build a deb package for this version, which is still not available at the moment

If the only motivation is to get a deb for the latest version, then this can be obtained from third-party PPAs such as https://launchpad.net/~ubuntuhandbook1/+archive/ubuntu/darktable

libjxl 0.7.0 (for JPEG XL import & export)

JPEGXL_NUMERIC_VERSION and JPEGXL_COMPUTE_NUMERIC_VERSION macros were introduced in libjxl 0.7.0. Older versions do not define this macro. But at the build environment configuration stage, we require at least version 0.7.0 for libjxl, so we can safely use these macros in the source code.

Your problem is the wrong libjxl-dev package from the xiota PPA: it doesn't actually contain the release version 0.7.0, but only some pre-release snapshot (the package name even shows from which date) that didn't contain this macro yet (otherwise the build wouldn't have the specified problems). But the bug of this package is that it seems to report itself as version 0.7.0 (otherwise it would have been rejected at the stage of configuring the darktable build environment as unsuitable).

victoryforce commented 1 year ago

If you want to build darktable yourself with JXL support on Ubuntu 22.04, you might consider removing the xiota PPA and adding the savoury1 PPA (https://launchpad.net/~savoury1/+archive/ubuntu/graphics) which contains the appropriate version of libjxl.

Nilvus commented 1 year ago

I suppose that you have your solution here @manu-p and as is also not an issue in the code, I so close. Congrats for your try to create a deb on your own.