Skip to content

Commit

Permalink
Update zconf.h prefixes to match zlib v1.2.12 update
Browse files Browse the repository at this point in the history
Historically Qt has used `Z_PREFIX` within zconf.h of its bundled zlib
copy to prefix all zlib symbols with `z_` in order to prevent clashes
with a potential system install of the library when linking statically;
however, v1.2.12 introduced 3 new functions that were erroneously not
accounted for in the upstream repository:

- crc32_combine_gen
- crc32_combine_gen64
- crc32_combine_op

`403020` updated our bundled zlib to this new version and therefore
Qt has inherited this oversight, now clashing with external zlib
builds.

Manually add prefix macro definitions for these three symbols to
restore built-in zlib to its previous clash free state while waiting
for the issue to be addressed upstream.

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I83f88109a08cf7e7117f1c94b4557a2c36f519c3
Reviewed-by: Kai Koehne <[email protected]>
  • Loading branch information
oblivioncth committed Sep 3, 2022
1 parent a7657d3 commit 54ea627
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/3rdparty/zlib/qtpatches.diff
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,25 @@ diff -ruN orig/zconf.h src/zconf.h
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
@@ -136,6 +139,7 @@
@@ -38,6 +41,9 @@
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
+# define crc32_combine_gen z_crc32_combine_gen
+# define crc32_combine_gen64 z_crc32_combine_gen64
+# define crc32_combine_op z_crc32_combine_op
# define crc32_z z_crc32_z
# define deflate z_deflate
# define deflateBound z_deflateBound
@@ -136,6 +142,7 @@
# endif
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
+# define z_errmsg z_z_errmsg

/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
@@ -431,7 +435,7 @@
@@ -431,7 +438,7 @@
typedef unsigned long z_crc_t;
#endif

Expand Down
3 changes: 3 additions & 0 deletions src/3rdparty/zlib/src/zconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
# define crc32_combine_gen z_crc32_combine_gen
# define crc32_combine_gen64 z_crc32_combine_gen64
# define crc32_combine_op z_crc32_combine_op
# define crc32_z z_crc32_z
# define deflate z_deflate
# define deflateBound z_deflateBound
Expand Down

0 comments on commit 54ea627

Please sign in to comment.