asdf-community / asdf-community/asdf-php

PHP 7.4.23 fails to compile on Apple M1

Open
#94 14 comments 3 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
256
Forks
117
PR merge metrics
No merged PRs in 30d

Description

I'm trying to compile like this:

```
PHP_WITHOUT_PDO_PGSQL=yes asdf install php 7.4.23
```

I'm also having the same issue as [this](https://github.com/asdf-community/asdf-php/issues/88), but I'm ignoring it for now. I don't need Postgres support.

Compilation fails with the following error:

```
Generating phar.php
Generating phar.phar
PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.

Fatal error: Uncaught InvalidArgumentException: RegexIterator::__construct(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /private/var/folders/5x/j_rlyqhx2hddmn_ds3pj0t0h0000gn/T/php-src-php-7.4.23/ext/phar/phar.php:1133
Stack trace:
#0 /private/var/folders/5x/j_rlyqhx2hddmn_ds3pj0t0h0000gn/T/php-src-php-7.4.23/ext/phar/phar.php(1133): RegexIterator->__construct(Object(RecursiveIteratorIterator), '/\\.svn/')
#1 /private/var/folders/5x/j_rlyqhx2hddmn_ds3pj0t0h0000gn/T/php-src-php-7.4.23/ext/phar/phar.php(1077): PharCommand::phar_add(Object(Phar), 0, '/var/folders/5x...', NULL, '/\\.svn/', Object(SplFileInfo), NULL, true)
#2 /private/var/folders/5x/j_rlyqhx2hddmn_ds3pj0t0h0000gn/T/php-src-php-7.4.23/ext/phar/phar.php(225): PharCommand->cli_cmd_run_pack(Array)
#3 /private/var/folders/5x/j_rlyqhx2hddmn_ds3pj0t0h0000gn/T/php-src-php-7.4.23/ext/phar/phar.php(2089): CLICommand->__constru in /private/var/folders/5x/j_rlyqhx2hddmn_ds3pj0t0h0000gn/T/php-src-php-7.4.23/ext/phar/phar.php on line 1133
make: *** [ext/phar/phar.phar] Error 255
make: *** Waiting for unfinished jobs....
```

Clearly, I can't set `pcre.jit=0` because I don't have PHP installed yet, and I don't know what `grant PHP permission to allocate executable memory` means.

I tried adding `PHP_CONFIGURE_OPTIONS="--with-pcre-jit"` to compile command, to no avail.

I'm not sure what is causing it, I'm just hoping someone else also encountered this issue.

I've found issues searching for this error, but it seems people are having it while *running* some code. See also [this bug](https://bugs.php.net/bug.php?id=78630), but I don't know if it applies to me.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing `PHP_WITHOUT_PDO_PGSQL=yes asdf install php 7.4.23` on an Apple M1 and inspect the failure at `ext/phar/phar.php:1133`. Compare the behavior with issue 88 and PHP bug 78630. Done means identifying a plugin or build change that lets PHP 7.4.23 compile successfully without requiring an already-installed PHP.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, shell
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.