php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #79887 Building PHP on Silicon (ARM) Mac
Submitted: 2020-07-23 08:58 UTC Modified: 2020-12-05 18:53 UTC
Votes:6
Avg. Score:5.0 ± 0.0
Reproduced:5 of 5 (100.0%)
Same Version:3 (60.0%)
Same OS:5 (100.0%)
From: nicolas dot brachfogel at 4d dot com Assigned:
Status: Wont fix Package: *General Issues
PHP Version: Irrelevant OS: Mac OS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nicolas dot brachfogel at 4d dot com
New email:
PHP Version: OS:

 

 [2020-07-23 08:58 UTC] nicolas dot brachfogel at 4d dot com
Description:
------------
There is currently no way to build PHP on the new Apple Silicon (ARM) Mac.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-07-23 09:00 UTC] nikic@php.net
-Status: Open +Status: Feedback
 [2020-07-23 09:00 UTC] nikic@php.net
How did you try to build it, and how did it fail?
 [2020-07-23 09:04 UTC] nicolas dot brachfogel at 4d dot com
-Status: Feedback +Status: Open
 [2020-07-23 09:04 UTC] nicolas dot brachfogel at 4d dot com
Sorry, I may not have been clear. I just want the targets to be updated to compile the library without modifications.
It's not a bug, more of a request.
 [2020-07-23 10:23 UTC] cmb@php.net
Which targets?  Which library?
 [2020-07-23 12:40 UTC] nicolas dot brachfogel at 4d dot com
Sorry, I've seen with my developer, and it looks like I was not understanding everything.
I'm concerned about the release of the new Silicon Macs. We will need to compile and run PHP on these machine and my "issue" was more of a request to know if PHP will work on this platform (and when if you have to change things on your side).

I realize I may have chosen a bad way to ask this question, but I didn't find any other.
 [2020-12-05 18:38 UTC] Dygear at gmail dot com
I am also having this issue. An arm Mac Mini using a somewhat fresh install of macOS 11.1 Beta 2 (Version 11.1 Beta (20C5061b)), I have the current version of Xcode installed (Version 12.2 12B45b). It does have a pretty current version of PHP already installed, 7.3.24, only one away from current at time of writing for the 7.3.x branch. The problem is that I would love to actually build PHP 8.0.0 on there for obvious reasons. But there is another note that I can see inside of the `php -v` call.


```
WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
PHP 7.3.24-(to be removed in future macOS) (cli) (built: Nov 23 2020 08:18:04) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.24, Copyright (c) 1998-2018 Zend Technologies
```

That's kind of rude Apple. PHP 8.0.0 is great! But I digress. I downloaded the PHP 8.0.0.tar.gz file and extracted it into my Downloads folder and then opened a terminal and cd to that directory. The `./configure --enable-calendar --enable-pcntl --enable-soap` and the same with a simple `./configure` because I wasn't sure if the SOAP (Not my ideal answer to this, but I don't have a choice.) required libxml, but it seems to be required by the core. The error message for that is below ...

```
Configuring extensions
checking io.h usability... no
checking io.h presence... no
checking for io.h... no
checking for strtoll... yes
checking for atoll... yes
checking whether to build with LIBXML support... yes
checking for libxml-2.0 >= 2.9.0... no
configure: error: in `/Users/dygear/Downloads/php-8.0.0':
configure: error: The pkg-config script could not be found or is too old.  Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.

Alternatively, you may set the environment variables LIBXML_CFLAGS
and LIBXML_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See `config.log' for more details
```

Doing some of my own research, I looked to see what version of libxml comes with macOS. It does have one, but it's version 2.0.0 according to man libxml. As you can see under files, all of them point to a 2.0.0 version of libxml.

```
libxml(3)                                                                                                 libxml(3)

NAME
       libxml - library used to parse XML files

DESCRIPTION
       The libxml library is used to parse XML files.  Its internal document representation is as close as possible
       to the DOM (Document Object Model) interface, an API for accessing XML or HTML structured documents.

       The libxml library also has a SAX-like interface, which is designed to be compatible with  expat(1).   NOTE:
       SAX,  the Simple API for XML, is a standard interface for event-based XML parsing, developed collaboratively
       by the members of the XML-DEV mailing list, currently hosted by OASIS.  The  expat  library  is  a  XML  1.0
       parser written in C, which aims to be fully conforming.  It is currently not a validating XML processor.

       The  libxml library now includes a nearly complete XPath implementation.  The XPath (XML Path Language) is a
       language for addressing parts of an XML document, designed to be used by both XSLT and XPointer.

       The libxml library exports Push and Pull type parser interfaces for both XML and html.

FILES
       /depot/lib/libxml_2.0.0/libxml.a
                             static library

       /depot/lib/libxml_2.0.0/libxml.so
                             shared library

       /depot/package/libxml_2.0.0/bin/xmllint
                             binary application for parsing XML files

AUTHORS
       Daniel Veillard (daniel@veillard.com).  Red Hat Inc.  Manual page by Ziying  Sherwin  (sherwin@nlm.nih.gov),
```

With the note from the above `php -v` command, we are going to need to come up with a solution native to macOS ARM. Any foot hold that PHP had on that platform is about to be list as they remove PHP from the native build of macOS. If we as a community want to support the large number of developers who are using PHP on their Mac's as their dev platform of choice we have to give them an easy way to do that. And quite frankly, many people who are PHP dev don't want to compile from source in the first place. (I do, but that's because I'm comfortable with C and a command line -- and I need certain extensions built into the core -- I think the vast majority of the community doesn't want to go down that rabbit hole however.).
 [2020-12-05 18:53 UTC] nikic@php.net
-Status: Open +Status: Wont fix
 [2020-12-05 18:53 UTC] nikic@php.net
> The pkg-config script could not be found or is too old.

You need to install pkg-config in order to build PHP.

In any case, there is nothing actionable in this bug report... If there are specific issues relating to building PHP on ARM Macs, please report them as separate bug reports about specific problems.

Keep in mind that macOs is an incredibly developer-hostile system, and obtaining all the necessary libraries and configuring PHP to use them may not be easy.

Typically PHP on macos is installed via homebrew, but I don't believe that homebrew supports ARM Macs yet, or will do so in the near future. Similarly, when building PHP from source, you typically install libraries using homebrew and point PHP to use those instead of the outdated system libraries.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jan 22 13:01:24 2021 UTC