-
Notifications
You must be signed in to change notification settings - Fork 156
Description
Now, php-build
is breaking on Mojave.
This is the upstream issue of PHP. However, php-build
supports many PHP versions ended of supports. So, we should discussion the road map to fix.
Reasons
TL;DR:
- Mojave changed the policy of library paths.
./configure
of PHP includes some bugs; on older macOS, these are not appeared.- Therefore, PHP
./configure
with current php-build options cannot detect some necessary library on Mojave.
Details:
Mojave changed the policy (https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035624):
The command line tools will search the SDK for system headers by default. However, some software may fail to build correctly against the SDK and require macOS headers to be installed in the base system under /usr/include. If you are the maintainer of such software, we encourage you to update your project to work with the SDK or file a bug report for issues that are preventing you from doing so. As a workaround, an extra package is provided which will install the headers to the base system. In a future release, this package will no longer be provided.
In the short term, we can use below command for fallback:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
On the other hand,
- current configure of PHP does not support recommended macOS SDK paths.
- PHP does not support current X11 paths of macOS.
- macOS SDK use
.tbd
extension for library, but, PHP does not support. - (LDAP library bundled Mojave is not included some necessary symbols for PHP.)
On macOS < Mojave, we use libxml2
/zlib
/bzip2
/libiconv
/libedit
/libpng
/libjpeg
/sqlite
/libcurl
bundled on macOS at /usr/include
.
However, on Mojave, we cannot use these libraries bundled at /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include
because PHP cannot detect them.
Now, Homebrew give up to use bundled libiconv
/libpng
/etc. on Mojave and use Homebrew's ones. We also can do same. (Fortunately, because some libraries such as zlib
/bzip2
avoid checking of PHP configure and are linked by PHP make, we can use them with just specifing /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr
as prefix path.)
We can select another way; patch php/php-src#3616 and remove =/usr
on default configure options.
See also
Filed bugs:
- All latest versions fail to build/install on OSX 10.14 Mojave phpenv/phpenv#90
- https://bugs.php.net/bug.php?id=76433
- https://bugs.php.net/bug.php?id=77011
- LDAP issues with Mojave PHP7.0+ Homebrew/homebrew-core#32916
Patches:
- Support shared libraries of macOS SDKs php/php-src#3616
- php: update zlib detection on Mojave Homebrew/homebrew-core#31498
- Fix #76403: MacOS compilation incorrectly linking to system libs php/php-src#3472
Related: