Skip to content

Commit 2e266f3

Browse files
committed
depends: Fix build of Qt for 32-bit platforms
The 32 to 64-bit time_t transition causes a build failure in the built-in zlib about conflicting _TIME_BITS and _FILE_OFFSET_BITS. Note that zlib doesn't use time_t at all, so it is a false alarm. Take the following patch from upstream zlib: https://github.com/madler/zlib/commit/a566e156b3fa07b566ddbf6801b517a9dba04fa3.patch Closes #29980.
1 parent 3aaf732 commit 2e266f3

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

depends/packages/qt.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ $(package)_patches += fix-macos-linker.patch
2222
$(package)_patches += memory_resource.patch
2323
$(package)_patches += utc_from_string_no_optimize.patch
2424
$(package)_patches += windows_lto.patch
25+
$(package)_patches += zlib-timebits64.patch
2526

2627
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
2728
$(package)_qttranslations_sha256_hash=24d4c58bc2a40c0f44f59ee64af4192c7d0038c1e45af61646cfc5b65058f271
@@ -251,6 +252,7 @@ define $(package)_preprocess_cmds
251252
patch -p1 -i $($(package)_patch_dir)/utc_from_string_no_optimize.patch && \
252253
patch -p1 -i $($(package)_patch_dir)/guix_cross_lib_path.patch && \
253254
patch -p1 -i $($(package)_patch_dir)/windows_lto.patch && \
255+
patch -p1 -i $($(package)_patch_dir)/zlib-timebits64.patch && \
254256
mkdir -p qtbase/mkspecs/macx-clang-linux &&\
255257
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
256258
cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From a566e156b3fa07b566ddbf6801b517a9dba04fa3 Mon Sep 17 00:00:00 2001
2+
From: Mark Adler <madler@alumni.caltech.edu>
3+
Date: Sat, 29 Jul 2023 22:13:09 -0700
4+
Subject: [PATCH] Avoid compiler complaints if _TIME_BITS defined when building
5+
zlib.
6+
7+
zlib does not use time_t, so _TIME_BITS is irrelevant. However it
8+
may be defined anyway as part of a sledgehammer indiscriminately
9+
applied to all builds.
10+
11+
From https://github.com/madler/zlib/commit/a566e156b3fa07b566ddbf6801b517a9dba04fa3.patch
12+
---
13+
qtbase/src/3rdparty/zlib/src/gzguts.h | 5 ++---
14+
1 file changed, 2 insertions(+), 3 deletions(-)
15+
16+
diff --git a/qtbase/src/3rdparty/zlib/src/gzguts.h b/qtbase/src/3rdparty/zlib/src/gzguts.h
17+
index e23f831f5..f9375047e 100644
18+
--- a/qtbase/src/3rdparty/zlib/src/gzguts.h
19+
+++ b/qtbase/src/3rdparty/zlib/src/gzguts.h
20+
@@ -26,9 +26,8 @@
21+
# ifndef _LARGEFILE_SOURCE
22+
# define _LARGEFILE_SOURCE 1
23+
# endif
24+
-# ifdef _FILE_OFFSET_BITS
25+
-# undef _FILE_OFFSET_BITS
26+
-# endif
27+
+# undef _FILE_OFFSET_BITS
28+
+# undef _TIME_BITS
29+
#endif
30+
31+
#ifdef HAVE_HIDDEN

0 commit comments

Comments
 (0)