PNG_INTEL_SSE defined on Mac platforms causing wxWidgets compilation to fail
Description
wxWidgets compiles fine using Apple Clang shipped with Xcode, but when trying to use the newest clang from homebrew, the compilation fails.
This does not seem to be libpng issue, as this library (cloned from GitHub as a standalone project) compiles fine with the same cmake settings. It looks like it's a problem with wxWidgets' CMake scripts.
luke@Lukes-MacBook-Pro wxBuild % cmake -G Ninja -DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++ -DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang ~/Developer/wxWidgets
-- Setting build type to 'Debug' as none was specified.
-- The C compiler identification is Clang 18.1.6
-- The CXX compiler identification is Clang 18.1.6
-- The OBJCXX compiler identification is Clang 18.1.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/homebrew/opt/llvm/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/homebrew/opt/llvm/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting OBJCXX compiler ABI info
-- Detecting OBJCXX compiler ABI info - done
-- Check for working OBJCXX compiler: /opt/homebrew/opt/llvm/bin/clang++ - skipped
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of wchar_t
-- Check size of wchar_t - done
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/lib/libz.tbd (found version "1.2.12")
-- Found EXPAT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/lib/libexpat.tbd (found version "2.5.0")
-- Performing Test wxHAVE_CXX11
-- Performing Test wxHAVE_CXX11 - Success
-- Performing Test wxHAVE_CXX17
-- Performing Test wxHAVE_CXX17 - Success
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found Iconv: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/lib/libiconv.tbd
-- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/System/Library/Frameworks/OpenGL.framework
-- Could NOT find MSPACK (missing: MSPACK_LIBRARY MSPACK_INCLUDE_DIR)
-- libmspack not found
-- Looking for 4 include files stdlib.h, ..., float.h
-- Looking for 4 include files stdlib.h, ..., float.h - found
-- Performing Test HAVE_VISIBILITY
-- Performing Test HAVE_VISIBILITY - Success
-- Looking for va_copy
-- Looking for va_copy - found
-- Performing Test HAVE_GCC_ATOMIC_BUILTINS
-- Performing Test HAVE_GCC_ATOMIC_BUILTINS - Success
-- Looking for sigaction
-- Looking for sigaction - found
-- Performing Test wxHAVE_BACKTRACE
-- Performing Test wxHAVE_BACKTRACE - Success
-- Performing Test HAVE_CXA_DEMANGLE
-- Performing Test HAVE_CXA_DEMANGLE - Success
-- Looking for mkstemp
-- Looking for mkstemp - found
-- Looking for mktemp
-- Looking for mktemp - found
-- Performing Test HAVE_STATFS
-- Performing Test HAVE_STATFS - Success
-- Performing Test HAVE_STATVFS
-- Performing Test HAVE_STATVFS - Success
-- Looking for fcntl
-- Looking for fcntl - found
-- Looking for flock
-- Looking for flock - found
-- Looking for setenv
-- Looking for setenv - found
-- Looking for putenv
-- Looking for putenv - found
-- Looking for unsetenv
-- Looking for unsetenv - found
-- Looking for uname
-- Looking for uname - found
-- Looking for gethostname
-- Looking for gethostname - found
-- Looking for strtok_r
-- Looking for strtok_r - found
-- Looking for fdopen
-- Looking for fdopen - found
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for sysconf
-- Looking for sysconf - found
-- Looking for getpwuid_r
-- Looking for getpwuid_r - found
-- Looking for getgrgid_r
-- Looking for getgrgid_r - found
-- Looking for sys/soundcard.h
-- Looking for sys/soundcard.h - not found
-- Performing Test WX_SOCKLEN_T_IS_SOCKLEN_T
-- Performing Test WX_SOCKLEN_T_IS_SOCKLEN_T - Success
-- Performing Test SOCKOPTLEN_T_IS_SOCKLEN_T
-- Performing Test SOCKOPTLEN_T_IS_SOCKLEN_T - Success
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for gethostbyname_r
-- Looking for gethostbyname_r - not found
-- Looking for getservbyname
-- Looking for getservbyname - found
-- Looking for inet_aton
-- Looking for inet_aton - found
-- Looking for inet_addr
-- Looking for inet_addr - found
-- Performing Test wxHAVE_PTHREAD_CLEANUP
-- Performing Test wxHAVE_PTHREAD_CLEANUP - Success
-- Performing Test HAVE_PTHREAD_MUTEXATTR_T
-- Performing Test HAVE_PTHREAD_MUTEXATTR_T - Success
-- Performing Test HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL
-- Performing Test HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL - Success
-- Performing Test HAVE_ABI_FORCEDUNWIND
-- Performing Test HAVE_ABI_FORCEDUNWIND - Failed
-- Looking for localtime_r
-- Looking for localtime_r - found
-- Looking for gmtime_r
-- Looking for gmtime_r - found
-- Performing Test wxSIZE_T_IS_NOT_UINT
-- Performing Test wxSIZE_T_IS_NOT_UINT - Success
-- Performing Test wxSIZE_T_IS_NOT_ULONG
-- Performing Test wxSIZE_T_IS_NOT_ULONG - Failed
-- Performing Test wxWCHAR_T_IS_REAL_TYPE
-- Performing Test wxWCHAR_T_IS_REAL_TYPE - Success
-- Performing Test HAVE_PW_GECOS
-- Performing Test HAVE_PW_GECOS - Success
-- Looking for ftime
-- Looking for ftime - not found
-- Looking for wcsftime
-- Looking for wcsftime - found
-- Looking for wprintf
-- Looking for wprintf - found
-- Looking for putws
-- Looking for putws - not found
-- Looking for fputws
-- Looking for fputws - found
-- Looking for vswprintf
-- Looking for vswprintf - found
-- Looking for vswscanf
-- Looking for vswscanf - found
-- Looking for wcsdup
-- Looking for wcsdup - found
-- Looking for wcsnlen
-- Looking for wcsnlen - found
-- Looking for wcscasecmp
-- Looking for wcscasecmp - found
-- Looking for wcsncasecmp
-- Looking for wcsncasecmp - found
-- Looking for wcsrctombs
-- Looking for wcsrctombs - not found
-- Looking for wcstoull
-- Looking for wcstoull - found
-- Looking for wcslen
-- Looking for wcslen - found
-- Looking for fsync
-- Looking for fsync - found
-- Looking for snprintf
-- Looking for snprintf - found
-- Looking for vsnprintf
-- Looking for vsnprintf - found
-- Looking for strnlen
-- Looking for strnlen - found
-- Looking for strtoull
-- Looking for strtoull - found
-- Looking for setpriority
-- Looking for setpriority - found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for langinfo.h
-- Looking for langinfo.h - found
-- Looking for sched.h
-- Looking for sched.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for wchar.h
-- Looking for wchar.h - found
-- Looking for wcstr.h
-- Looking for wcstr.h - not found
-- Performing Test wxTEST_TZ_timezone
-- Performing Test wxTEST_TZ_timezone - Success
-- Performing Test WX_GMTOFF_IN_TM
-- Performing Test WX_GMTOFF_IN_TM - Success
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for dladdr
-- Looking for dladdr - found
-- Looking for dl_iterate_phdr
-- Looking for dl_iterate_phdr - not found
-- Looking for sys/select.h
-- Looking for sys/select.h - found
-- Looking for sys/inotify.h
-- Looking for sys/inotify.h - not found
-- Looking for sys/event.h
-- Looking for sys/event.h - found
-- Looking for xlocale.h
-- Looking for xlocale.h - found
-- Check size of locale_t
-- Check size of locale_t - done
-- Check size of size_t
-- Check size of size_t - done
-- Check size of int
-- Check size of int - done
-- Check size of long
-- Check size of long - done
-- Check size of short
-- Check size of short - done
-- Check size of long long
-- Check size of long long - done
-- Check size of ssize_t
-- Check size of ssize_t - done
-- Which libraries should wxWidgets use?
wxUSE_REGEX: builtin (enable support for wxRegEx class)
wxUSE_ZLIB: sys (use zlib for LZW compression)
wxUSE_EXPAT: sys (use expat for XML parsing)
wxUSE_LIBJPEG: builtin (use libjpeg (JPEG file format))
wxUSE_LIBPNG: builtin (use libpng (PNG image format))
wxUSE_LIBTIFF: builtin (use libtiff (TIFF file format))
wxUSE_NANOSVG: builtin (use NanoSVG for rasterizing SVG)
wxUSE_LIBLZMA: OFF (use liblzma for LZMA compression)
wxUSE_LIBSDL: OFF (use SDL for audio on Unix)
wxUSE_LIBMSPACK: OFF (use libmspack (CHM help files loading))
wxUSE_WEBVIEW: ON (enable wxWebview with WebKit)
-- Configured wxWidgets 3.3.0 for Darwin
Min OS Version required at runtime: macOS 10.10 arm64
Which GUI toolkit should wxWidgets use? osx_cocoa
Should wxWidgets be compiled into single library? OFF
Should wxWidgets be linked as a shared library? ON
Which wxWidgets API compatibility should be used? 3.2
-- Configuring done (7.5s)
-- Generating done (0.1s)
-- Build files have been written to: /Users/luke/Developer/wxBuild
luke@Lukes-MacBook-Pro wxBuild % cmake --build . -j
[69/1003] Building C object libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngerror.c.o
FAILED: libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngerror.c.o
/opt/homebrew/opt/llvm/bin/clang -DPNG_INTEL_SSE -D_FILE_OFFSET_BITS=64 -I/Users/luke/Developer/wxBuild/lib/wx/include/osx_cocoa-unicode-3.3 -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -mmacosx-version-min=10.10 -fPIC -MD -MT libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngerror.c.o -MF libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngerror.c.o.d -o libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngerror.c.o -c /Users/luke/Developer/wxWidgets/src/png/pngerror.c
In file included from /Users/luke/Developer/wxWidgets/src/png/pngerror.c:19:
/Users/luke/Developer/wxWidgets/src/png/pngpriv.h:536:16: fatal error: 'fp.h' file not found
536 | # include <fp.h>
| ^~~~~~
1 error generated.
[73/1003] Building C object libs/CMakeFiles/wxpng.dir/__/__/__/src/png/png.c.o
FAILED: libs/CMakeFiles/wxpng.dir/__/__/__/src/png/png.c.o
/opt/homebrew/opt/llvm/bin/clang -DPNG_INTEL_SSE -D_FILE_OFFSET_BITS=64 -I/Users/luke/Developer/wxBuild/lib/wx/include/osx_cocoa-unicode-3.3 -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -mmacosx-version-min=10.10 -fPIC -MD -MT libs/CMakeFiles/wxpng.dir/__/__/__/src/png/png.c.o -MF libs/CMakeFiles/wxpng.dir/__/__/__/src/png/png.c.o.d -o libs/CMakeFiles/wxpng.dir/__/__/__/src/png/png.c.o -c /Users/luke/Developer/wxWidgets/src/png/png.c
In file included from /Users/luke/Developer/wxWidgets/src/png/png.c:14:
/Users/luke/Developer/wxWidgets/src/png/pngpriv.h:536:16: fatal error: 'fp.h' file not found
536 | # include <fp.h>
| ^~~~~~
1 error generated.
[74/1003] Building C object libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngget.c.o
FAILED: libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngget.c.o
/opt/homebrew/opt/llvm/bin/clang -DPNG_INTEL_SSE -D_FILE_OFFSET_BITS=64 -I/Users/luke/Developer/wxBuild/lib/wx/include/osx_cocoa-unicode-3.3 -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -mmacosx-version-min=10.10 -fPIC -MD -MT libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngget.c.o -MF libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngget.c.o.d -o libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngget.c.o -c /Users/luke/Developer/wxWidgets/src/png/pngget.c
In file included from /Users/luke/Developer/wxWidgets/src/png/pngget.c:15:
/Users/luke/Developer/wxWidgets/src/png/pngpriv.h:536:16: fatal error: 'fp.h' file not found
536 | # include <fp.h>
| ^~~~~~
1 error generated.
[76/1003] Building C object libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngpread.c.o
FAILED: libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngpread.c.o
/opt/homebrew/opt/llvm/bin/clang -DPNG_INTEL_SSE -D_FILE_OFFSET_BITS=64 -I/Users/luke/Developer/wxBuild/lib/wx/include/osx_cocoa-unicode-3.3 -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -mmacosx-version-min=10.10 -fPIC -MD -MT libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngpread.c.o -MF libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngpread.c.o.d -o libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngpread.c.o -c /Users/luke/Developer/wxWidgets/src/png/pngpread.c
In file included from /Users/luke/Developer/wxWidgets/src/png/pngpread.c:14:
/Users/luke/Developer/wxWidgets/src/png/pngpriv.h:536:16: fatal error: 'fp.h' file not found
536 | # include <fp.h>
| ^~~~~~
1 error generated.
[77/1003] Building C object libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngrio.c.o
FAILED: libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngrio.c.o
/opt/homebrew/opt/llvm/bin/clang -DPNG_INTEL_SSE -D_FILE_OFFSET_BITS=64 -I/Users/luke/Developer/wxBuild/lib/wx/include/osx_cocoa-unicode-3.3 -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -mmacosx-version-min=10.10 -fPIC -MD -MT libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngrio.c.o -MF libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngrio.c.o.d -o libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngrio.c.o -c /Users/luke/Developer/wxWidgets/src/png/pngrio.c
In file included from /Users/luke/Developer/wxWidgets/src/png/pngrio.c:21:
/Users/luke/Developer/wxWidgets/src/png/pngpriv.h:536:16: fatal error: 'fp.h' file not found
536 | # include <fp.h>
| ^~~~~~
1 error generated.
[78/1003] Building C object libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngmem.c.o
FAILED: libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngmem.c.o
/opt/homebrew/opt/llvm/bin/clang -DPNG_INTEL_SSE -D_FILE_OFFSET_BITS=64 -I/Users/luke/Developer/wxBuild/lib/wx/include/osx_cocoa-unicode-3.3 -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -mmacosx-version-min=10.10 -fPIC -MD -MT libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngmem.c.o -MF libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngmem.c.o.d -o libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngmem.c.o -c /Users/luke/Developer/wxWidgets/src/png/pngmem.c
In file included from /Users/luke/Developer/wxWidgets/src/png/pngmem.c:20:
/Users/luke/Developer/wxWidgets/src/png/pngpriv.h:536:16: fatal error: 'fp.h' file not found
536 | # include <fp.h>
| ^~~~~~
1 error generated.
[79/1003] Building C object libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngread.c.o
FAILED: libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngread.c.o
/opt/homebrew/opt/llvm/bin/clang -DPNG_INTEL_SSE -D_FILE_OFFSET_BITS=64 -I/Users/luke/Developer/wxBuild/lib/wx/include/osx_cocoa-unicode-3.3 -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -mmacosx-version-min=10.10 -fPIC -MD -MT libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngread.c.o -MF libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngread.c.o.d -o libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngread.c.o -c /Users/luke/Developer/wxWidgets/src/png/pngread.c
In file included from /Users/luke/Developer/wxWidgets/src/png/pngread.c:17:
/Users/luke/Developer/wxWidgets/src/png/pngpriv.h:536:16: fatal error: 'fp.h' file not found
536 | # include <fp.h>
| ^~~~~~
1 error generated.
[80/1003] Building C object libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngset.c.o
FAILED: libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngset.c.o
/opt/homebrew/opt/llvm/bin/clang -DPNG_INTEL_SSE -D_FILE_OFFSET_BITS=64 -I/Users/luke/Developer/wxBuild/lib/wx/include/osx_cocoa-unicode-3.3 -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -mmacosx-version-min=10.10 -fPIC -MD -MT libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngset.c.o -MF libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngset.c.o.d -o libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngset.c.o -c /Users/luke/Developer/wxWidgets/src/png/pngset.c
In file included from /Users/luke/Developer/wxWidgets/src/png/pngset.c:19:
/Users/luke/Developer/wxWidgets/src/png/pngpriv.h:536:16: fatal error: 'fp.h' file not found
536 | # include <fp.h>
| ^~~~~~
1 error generated.
[83/1003] Building C object libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngrutil.c.o
FAILED: libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngrutil.c.o
/opt/homebrew/opt/llvm/bin/clang -DPNG_INTEL_SSE -D_FILE_OFFSET_BITS=64 -I/Users/luke/Developer/wxBuild/lib/wx/include/osx_cocoa-unicode-3.3 -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -mmacosx-version-min=10.10 -fPIC -MD -MT libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngrutil.c.o -MF libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngrutil.c.o.d -o libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngrutil.c.o -c /Users/luke/Developer/wxWidgets/src/png/pngrutil.c
In file included from /Users/luke/Developer/wxWidgets/src/png/pngrutil.c:17:
/Users/luke/Developer/wxWidgets/src/png/pngpriv.h:536:16: fatal error: 'fp.h' file not found
536 | # include <fp.h>
| ^~~~~~
1 error generated.
[84/1003] Building C object libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngrtran.c.o
FAILED: libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngrtran.c.o
/opt/homebrew/opt/llvm/bin/clang -DPNG_INTEL_SSE -D_FILE_OFFSET_BITS=64 -I/Users/luke/Developer/wxBuild/lib/wx/include/osx_cocoa-unicode-3.3 -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -mmacosx-version-min=10.10 -fPIC -MD -MT libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngrtran.c.o -MF libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngrtran.c.o.d -o libs/CMakeFiles/wxpng.dir/__/__/__/src/png/pngrtran.c.o -c /Users/luke/Developer/wxWidgets/src/png/pngrtran.c
In file included from /Users/luke/Developer/wxWidgets/src/png/pngrtran.c:19:
/Users/luke/Developer/wxWidgets/src/png/pngpriv.h:536:16: fatal error: 'fp.h' file not found
536 | # include <fp.h>
| ^~~~~~
1 error generated.
ninja: build stopped: subcommand failed.
Platform and version information
- wxWidgets version you use: pretty much all of them
- wxWidgets port you use: wxMac
- OS and its version: 14.5 (23F79)
Why can't it find fp.h? Is it missing an include path, or are the preprocessor defines different?
From pngpriv.h:
#if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
/* png.c requires the following ANSI-C constants if the conversion of
* floating point to ASCII is implemented therein:
*
* DBL_DIG Maximum number of decimal digits (can be set to any constant)
* DBL_MIN Smallest normalized fp number (can be set to an arbitrary value)
* DBL_MAX Maximum floating point number (can be set to an arbitrary value)
*/
# include <float.h>
# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
/* We need to check that <math.h> hasn't already been included earlier
* as it seems it doesn't agree with <fp.h>, yet we should really use
* <fp.h> if possible.
*/
# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
# include <fp.h>
# endif
# else
# include <math.h>
# endif
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
* MATH=68881
*/
# include <m68881.h>
# endif
#endif
Can you please check whether fp.h actually exists or not?
Our libpng version is not the latest, so the problem could be already fixed in the standalone library you use.
This is fixed in libpng 1.6.45, where it no longer tries to run include fp.h. The instructions that fp.h provided are now part of math.h.
but your compilation of wxWidgets is using the builtin libpng which is kind of ancient.
-- Which libraries should wxWidgets use?
wxUSE_REGEX: builtin (enable support for wxRegEx class)
wxUSE_ZLIB: sys (use zlib for LZW compression)
wxUSE_EXPAT: sys (use expat for XML parsing)
wxUSE_LIBJPEG: builtin (use libjpeg (JPEG file format))
wxUSE_LIBPNG: builtin (use libpng (PNG image format))
wxUSE_LIBTIFF: builtin (use libtiff (TIFF file format))
wxUSE_NANOSVG: builtin (use NanoSVG for rasterizing SVG)
wxUSE_LIBLZMA: OFF (use liblzma for LZMA compression)
wxUSE_LIBSDL: OFF (use SDL for audio on Unix)
wxUSE_LIBMSPACK: OFF (use libmspack (CHM help files loading))
wxUSE_WEBVIEW: ON (enable wxWebview with WebKit)
My current approach is to use the system's libpng.
@vadz maybe it's worth considering bumping your built-in fork of libpng?
Yes, sure, it would be nice to update it and any PRs doing it would be welcome.
AFAIR it should be simple to do it in master but doing it in 3.2 risks being tricky as we have our own changes for older MSVC versions that conflict with the changes in libpng.
I have no knowledge of MSVC whatsoever, so I won't risk working on 3.2. But I can definitely make a PR bumping in master until EOW.
To favor compatibility I'll figure out the earliest version containing the fix for the fp.h / math.h situation.
FYI Xcode 16.3 removes the fp.h header, so wxWidgets no longer compiles with the latest official toolchain.
Maybe we can just cherry-pick this fix for 3.2 https://github.com/pnggroup/libpng/commit/893b8113f04d408cc6177c6de19c9889a48faa24
diff --git a/pngpriv.h b/pngpriv.h
index 6c7280cf53..190eb85cbf 100644
--- a/pngpriv.h
+++ b/pngpriv.h
@@ -556,18 +556,8 @@
*/
# include <float.h>
-# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
- defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
- /* We need to check that <math.h> hasn't already been included earlier
- * as it seems it doesn't agree with <fp.h>, yet we should really use
- * <fp.h> if possible.
- */
-# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
-# include <fp.h>
-# endif
-# else
-# include <math.h>
-# endif
+# include <math.h>
+
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
* MATH=68881
This should be fixed in master now, with a4fdcc7c3b (Merge branch 'update-submodules-2025-04' of github.com:MaartenBent/wxWidgets, 2025-04-20) and I'll apply the proposed fix to 3.2, thanks Maarten!
Wait, sorry, this should have been already fixed by (an even more minimal) f92fe93c7 (Fix build for Xcode 16.3 by not testing TARGET_OS_MAC, 2025-04-04), wasn't it? I guess backporting the upstream fix could have been better, but I don't know if it's worth applying it on top of our own one now...