Skip to content

HEIF builds fail with latest distros #729

Closed

Description

@pierrejoye

We need to either update configure/cmake to check for the min version or wrap the 8bit conversion part with whatever was there before. Only recent HEIF have it and most if not all distros do not distribute these versions yet.

Activity

  1. vapier commented on Aug 20, 2021

    @vapier
    Member

    can you post a build snippet of the failure you're seeing & the version you're using ? then maybe @YakoYakoYokuYoku can take a look.

  2. YakoYakoYokuYoku commented on Aug 20, 2021

    @YakoYakoYokuYoku
    Contributor

    I can't replicate on my system, I've built and run (2.3.2 and master) with both CMake and Autotools the project with the test suite while using the latest release of HEIF.

  3. pierrejoye commented on Aug 21, 2021

    @pierrejoye
    ContributorAuthor

    Hi :)

    Ubuntu 20.04 LTS
    bullseye/sid
    libheif1/focal 1.6.1-1build1 amd64

    CI: https://github.com/libgd/libgd/runs/3382353339?check_suite_focus=true

    convert_hdr_to_8bit is only available from 1.7 upwards, which is not available widely yet in the distributions.

    In any case, whether we support <1.7 or not, we should add checks, in CMake to disable it all if no suitable version has been found, or also in the code if we like to support <1.7.

    Run cmake --build /home/runner/work/libgd/libgd/build --config Release
    [  0%] Building C object src/CMakeFiles/gd.dir/gd.c.o
    [  0%] Building C object src/CMakeFiles/gd.dir/gd_avif.c.o
    [  0%] Building C object src/CMakeFiles/gd.dir/gd_bmp.c.o
    [  1%] Building C object src/CMakeFiles/gd.dir/gd_color.c.o
    [  1%] Building C object src/CMakeFiles/gd.dir/gd_color_map.c.o
    [  1%] Building C object src/CMakeFiles/gd.dir/gd_color_match.c.o
    [  1%] Building C object src/CMakeFiles/gd.dir/gd_crop.c.o
    [  1%] Building C object src/CMakeFiles/gd.dir/gd_filename.c.o
    [  2%] Building C object src/CMakeFiles/gd.dir/gd_filter.c.o
    [  2%] Building C object src/CMakeFiles/gd.dir/gd_gd.c.o
    [  2%] Building C object src/CMakeFiles/gd.dir/gd_gd2.c.o
    [  2%] Building C object src/CMakeFiles/gd.dir/gd_gif_in.c.o
    [  2%] Building C object src/CMakeFiles/gd.dir/gd_gif_out.c.o
    [  3%] Building C object src/CMakeFiles/gd.dir/gd_heif.c.o
    /home/runner/work/libgd/libgd/src/gd_heif.c: In function ‘_gdImageCreateFromHeifCtx’:
    /home/runner/work/libgd/libgd/src/gd_heif.c:187:15: error: ‘struct heif_decoding_options’ has no member named ‘convert_hdr_to_8bit’
      187 |  heif_dec_opts->convert_hdr_to_8bit = GD_TRUE;
          |               ^~
    make[2]: *** [src/CMakeFiles/gd.dir/build.make:258: src/CMakeFiles/gd.dir/gd_heif.c.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:1946: src/CMakeFiles/gd.dir/all] Error 2
    make: *** [Makefile:166: all] Error 2
    Error: Process completed with exit code 2.
    
  4. pierrejoye commented on Aug 21, 2021

    @pierrejoye
    ContributorAuthor

    Sidenote, if you use SET(CMAKE_C_FLAGS_DEBUG "-g -Wall -Wextra -O0 -fsanitize=address"), libheif latest versions leak. It does not unregister its plugins. I reported a bug to them, no answer so far. I will see if I can provide a PR.

  5. added this to the GD 2.3.3 milestone on Aug 21, 2021
  6. YakoYakoYokuYoku commented on Aug 21, 2021

    @YakoYakoYokuYoku
    Contributor

    Knowing the fact that version 1.4.0 is affected by CVE-2019-11471 I'd recommend to put the minimum version to 1.5.0. In the case that a precompiler version check for that struct member cannot be used then it would be 1.7.0. Regarding HDR to 8 bit conversion my best idea is to just bail out with versions below 1.7.0.

  7. pierrejoye commented on Aug 21, 2021

    @pierrejoye
    ContributorAuthor

    @YakoYakoYokuYoku Thanks :)

    do I understand correctly that you are ok to require 1.7 or later? If <1.7 we disable HEIF codec, correct?

  8. vapier commented on Aug 21, 2021

    @vapier
    Member

    if the user has explicitly requested heif support, we should fail the build if the needed versions weren't found, not just warn+disable.

    afaik, no version of Debian or Ubuntu includes libheif. not sure where GH containers are getting this.

    so if no distros are shipping it, requiring 1.7.0+ sounds fine to me. that was released almost 2 years ago at this point.

  9. pierrejoye commented on Aug 21, 2021

    @pierrejoye
    ContributorAuthor
  10. pierrejoye commented on Aug 21, 2021

    @pierrejoye
    ContributorAuthor
  11. YakoYakoYokuYoku commented on Aug 21, 2021

    @YakoYakoYokuYoku
    Contributor

    I'd go by putting a hard requirement on 1.7.0 and later, as it wouldn't involve a compile or runtime check.

    Also there are packages for libheif for both Debian and Ubuntu:

  12. vapier commented on Aug 21, 2021

    @vapier
    Member

    oh, i typod the package name in the search. oddly i typed it multiple times, but maybe my keyboard is being squishy when i press "i".

    Debian bullseye is going to stable now and includes 1.11.0.
    the latest Ubuntu LTS has 1.6, but all newer distros have 1.8+.

    i''m fine requiring 1.7+ if it makes our lives easier. we're cutting new gd releases now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions