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

HEIF builds fail with latest distros #729

Closed
pierrejoye opened this issue Aug 20, 2021 · 11 comments · Fixed by #730
Closed

HEIF builds fail with latest distros #729

pierrejoye opened this issue Aug 20, 2021 · 11 comments · Fixed by #730
Labels
Milestone

Comments

@pierrejoye
Copy link
Contributor

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.

@vapier
Copy link
Member

vapier commented Aug 20, 2021

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

@vapier vapier added the build label Aug 20, 2021
@YakoYakoYokuYoku
Copy link
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.

@pierrejoye
Copy link
Contributor Author

pierrejoye commented Aug 21, 2021

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.

@pierrejoye
Copy link
Contributor Author

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.

@pierrejoye pierrejoye added this to the GD 2.3.3 milestone Aug 21, 2021
@YakoYakoYokuYoku
Copy link
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.

@pierrejoye
Copy link
Contributor Author

@YakoYakoYokuYoku Thanks :)

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

@vapier
Copy link
Member

vapier commented Aug 21, 2021

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.

@pierrejoye
Copy link
Contributor Author

pierrejoye commented Aug 21, 2021 via email

@pierrejoye
Copy link
Contributor Author

pierrejoye commented Aug 21, 2021 via email

@YakoYakoYokuYoku
Copy link
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:

@vapier
Copy link
Member

vapier commented Aug 21, 2021

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
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants