Skip to content

Commit 0a3631f

Browse files
committed
depends: fix Qt macOS build with Clang 18
Patch Qts internal libpng to resolve the failure. I would like to have this patched, so we can continue working on the removal of `FORCE_USE_SYSTEM_CLANG`. Otherwise builds will be broken using the default clang (18) on the current Ubuntu LTS (24.04).
1 parent b018bd7 commit 0a3631f

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

depends/packages/qt.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ $(package)_patches += duplicate_lcqpafonts.patch
2020
$(package)_patches += guix_cross_lib_path.patch
2121
$(package)_patches += fix-macos-linker.patch
2222
$(package)_patches += memory_resource.patch
23+
$(package)_patches += clang_18_libpng.patch
2324
$(package)_patches += utc_from_string_no_optimize.patch
2425
$(package)_patches += windows_lto.patch
2526
$(package)_patches += zlib-timebits64.patch
@@ -229,6 +230,7 @@ define $(package)_preprocess_cmds
229230
patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \
230231
patch -p1 -i $($(package)_patch_dir)/memory_resource.patch && \
231232
patch -p1 -i $($(package)_patch_dir)/no_warnings_for_symbols.patch && \
233+
patch -p1 -i $($(package)_patch_dir)/clang_18_libpng.patch && \
232234
patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \
233235
patch -p1 -i $($(package)_patch_dir)/duplicate_lcqpafonts.patch && \
234236
patch -p1 -i $($(package)_patch_dir)/utc_from_string_no_optimize.patch && \
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
fix Qt macOS build with Clang 18
2+
3+
See:
4+
https://github.com/pnggroup/libpng/commit/893b8113f04d408cc6177c6de19c9889a48faa24.
5+
6+
In a similar manner as zlib (madler/zlib#895),
7+
libpng contains a header configuration that's no longer valid and
8+
hasn't been exercised for the macOS target.
9+
10+
- The target OS conditional macros are misused. Specifically
11+
`TARGET_OS_MAC` covers all Apple targets, including iOS, and it
12+
should not be checked with `#if defined` as they would always be
13+
defined (to either 1 or 0) on Apple platforms.
14+
- `#include <fp.h>` no longer works for the macOS target and results
15+
in a compilation failure. macOS ships all required functions in
16+
`math.h`, and clients should use `math.h` instead.
17+
18+
--- a/qtbase/src/3rdparty/libpng/pngpriv.h
19+
+++ b/qtbase/src/3rdparty/libpng/pngpriv.h
20+
@@ -514,18 +514,8 @@
21+
*/
22+
# include <float.h>
23+
24+
-# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
25+
- defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
26+
- /* We need to check that <math.h> hasn't already been included earlier
27+
- * as it seems it doesn't agree with <fp.h>, yet we should really use
28+
- * <fp.h> if possible.
29+
- */
30+
-# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
31+
-# include <fp.h>
32+
-# endif
33+
-# else
34+
-# include <math.h>
35+
-# endif
36+
+# include <math.h>
37+
+
38+
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
39+
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
40+
* MATH=68881

0 commit comments

Comments
 (0)