All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: "Raphaël Mélotte" <raphael.melotte@mind.be>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 1/1] package/mupdf: fix building with zlib-ng
Date: Mon, 8 May 2023 23:02:39 +0200	[thread overview]
Message-ID: <20230508210239.GU252090@scaer> (raw)
In-Reply-To: <20230425070923.1294644-1-raphael.melotte@mind.be>

Raphaël, All,

On 2023-04-25 09:09 +0200, Raphaël Mélotte spake thusly:
> The current mupdf version fails to build when zlib-ng is used as the
> zlib implementation. Add a patch to fix it.
> 
> This fixes the following build failure raised since the bump to
> version 1.21.0 of the mupdf package in commit
> 3c2033cd2ace077e7dfaf58a2589b2a93a5fd7b0:
> 
> source/fitz/encode-basic.c: In function 'deflate_write':
> source/fitz/encode-basic.c:343:27: error: 'UINT_MAX' undeclared (first use in this function)
>   343 |         newbufsize = n >= UINT_MAX ? UINT_MAX : deflateBound(&state->z, n);
>       |                           ^~~~~~~~
> source/fitz/encode-basic.c:26:1: note: 'UINT_MAX' is defined in header '<limits.h>'; did you forget to '#include <limits.h>'?
> 
> Fixes: http://autobuild.buildroot.net/results/87128e9967cff20078c65ab847877aa44cc409d9
> 
> Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
>  ...issing-limits.h-include-for-UINT_MAX.patch | 70 +++++++++++++++++++
>  1 file changed, 70 insertions(+)
>  create mode 100644 package/mupdf/0001-Add-missing-limits.h-include-for-UINT_MAX.patch
> 
> diff --git a/package/mupdf/0001-Add-missing-limits.h-include-for-UINT_MAX.patch b/package/mupdf/0001-Add-missing-limits.h-include-for-UINT_MAX.patch
> new file mode 100644
> index 0000000000..95f2f86666
> --- /dev/null
> +++ b/package/mupdf/0001-Add-missing-limits.h-include-for-UINT_MAX.patch
> @@ -0,0 +1,70 @@
> +From ebce9f1b129ebc8f2b17afa02a4ffcb9453c11d9 Mon Sep 17 00:00:00 2001
> +From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@mind.be>
> +Date: Mon, 24 Apr 2023 17:27:35 +0200
> +Subject: [PATCH] Add missing limits.h include for UINT_MAX
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +encode-basic.c uses 'UINT_MAX', which is available in the 'limits.h'
> +header.
> +
> +In some configurations that build with zlib from [1], by chance
> +limits.h gets indirectly included when including 'z-imp.h' (the
> +includes are: 'z-imp.h' -> 'zlib.h' -> 'zconf.h' -> 'limits.h'), so
> +the build succeeds.
> +
> +When using other zlib implementations however (for example from [2]),
> +limits.h is not necessarily included indirectly, which leads to the
> +build failing in the following way:
> +
> +source/fitz/encode-basic.c: In function 'deflate_write':
> +source/fitz/encode-basic.c:343:27: error: 'UINT_MAX' undeclared (first use in this function)
> +  343 |         newbufsize = n >= UINT_MAX ? UINT_MAX : deflateBound(&state->z, n);
> +      |                           ^~~~~~~~
> +source/fitz/encode-basic.c:26:1: note: 'UINT_MAX' is defined in header '<limits.h>'; did you forget to '#include <limits.h>'?
> +
> +Add the missing include, so that the build succeeds no matter if zlib
> +indirectly includes 'limit.h' or not.
> +
> +Similarly, also add it in output-ps.c where it's also missing.
> +
> +[1]: https://zlib.net/
> +[2]: https://github.com/zlib-ng/zlib-ng
> +
> +Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
> +Upstream: https://bugs.ghostscript.com/show_bug.cgi?id=706667
> +---
> + source/fitz/encode-basic.c | 2 ++
> + source/fitz/output-ps.c    | 2 ++
> + 2 files changed, 4 insertions(+)
> +
> +diff --git a/source/fitz/encode-basic.c b/source/fitz/encode-basic.c
> +index 03a4ff76b..84f0c35e6 100644
> +--- a/source/fitz/encode-basic.c
> ++++ b/source/fitz/encode-basic.c
> +@@ -24,6 +24,8 @@
> + 
> + #include "z-imp.h"
> + 
> ++#include <limits.h>
> ++
> + struct ahx
> + {
> + 	fz_output *chain;
> +diff --git a/source/fitz/output-ps.c b/source/fitz/output-ps.c
> +index ef22c3cd6..3dc8ea17d 100644
> +--- a/source/fitz/output-ps.c
> ++++ b/source/fitz/output-ps.c
> +@@ -24,6 +24,8 @@
> + 
> + #include "z-imp.h"
> + 
> ++#include <limits.h>
> ++
> + typedef struct ps_band_writer_s
> + {
> + 	fz_band_writer super;
> +-- 
> +2.39.1
> +
> -- 
> 2.39.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2023-05-08 21:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-25  7:09 [Buildroot] [PATCH 1/1] package/mupdf: fix building with zlib-ng Raphaël Mélotte
2023-05-08 21:02 ` Yann E. MORIN [this message]
2023-05-09 11:58 ` [Buildroot] [PATCH v2 1/1] package: busybox: backport fix for missing getrandom() Raphaël Mélotte via buildroot
2023-05-09 18:50   ` Yann E. MORIN
2023-06-09  9:10   ` Peter Korsgaard
2023-06-09  8:11 ` [Buildroot] [PATCH 1/1] package/mupdf: fix building with zlib-ng Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230508210239.GU252090@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=raphael.melotte@mind.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.