Skip to content

Build the IP Intelligence extension on macOS again - #100

Merged
jwrosewell merged 1 commit into
rcfrom
fix/ipi-wrapper-macos
Nov 14, 2026
Merged

jwrosewell merged 1 commit into
rcfrom
fix/ipi-wrapper-macos

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

The IP Intelligence extension stopped compiling on macOS with #88. This draft makes it compile again, so that the release build of rc, which runs on macOS, can pass.

Problem

ipi_register_earlier_names in ipi-php.i lines 63 to 74 at rc 70424ea5, from #88, reads each class entry with ZEND_HASH_FOREACH_STR_KEY_PTR(CG(class_table), key, ce), where ce is a zend_class_entry *. PHP's macro assigns the entry with _ptr = Z_PTR_P(_z); (php-src PHP-8.4 Zend/zend_hash.h lines 1279 to 1282), and Z_PTR is the entry's void * (Zend/zend_types.h lines 1066 to 1067). C++ turns a void * into another pointer type only with a cast. Both config.m4 files pass -fpermissive, under which g++ gives only a warning, so Linux builds. clang, which builds the extension on macOS, gives an error.

#88's full build left macOS out under the 9 November decision, so it did not show there. A Nightly Pipeline dry run of every PHP draft merged together, run 43553806074, failed in its macOS PHP 8.4 job with

ipi_wrap.cxx:1631:9: error: assigning to 'zend_class_entry *' (aka '_zend_class_entry *') from incompatible type 'void *'
##[error]ip-intelligence: make failed

and fail-fast stopped the other four macOS jobs. So the release build of rc with macOS would fail.

What changed

ipi-php.i takes the entry as void *entry and casts it with static_cast<zend_class_entry *>(entry), with a two line comment saying why. SWIG copies that block into the wrapper unchanged, so the committed src/php8/ipi_wrap.cxx has the same lines changed, and the check "IP Intelligence wrapper matches ipi-php.i", which builds SWIG 4.5.1, generates the wrapper again and compares, passes on the head. Nothing else changes.

This is code of fiftyone.ipintelligence, which has no mirror and is not on Packagist, so no package is released.

Runs

The red and green runs use a throwaway workflow that builds both extensions as CI does (ci/setup-environment.ps1, then ci/build-project.ps1) on macOS with PHP 8.1, 8.4 and 8.5 and on Ubuntu with PHP 8.3, checks the IP Intelligence extension loads, runs its unit tests as CI does, and then runs the two class name tests of MixedExamplesTests, which load both extensions.

  • Red, run 43557691286 on tmp/ipi-macos-red a84b139, which is rc 70424ea with the workflow. All three macOS jobs failed to build, each with ipi_wrap.cxx:1631:9: error: assigning to 'zend_class_entry *' ... from incompatible type 'void *' and "ip-intelligence: make failed". The Ubuntu job built and passed the unit tests, and failed only in the class name step, because that step first ran the PHPUnit 12 the package's own Composer install gives, which reads no @dataProvider doc comment (#101, item 4). CI runs these tests with PHPUnit 9.6, and so does the green run.
  • Green, run 43559697415 on tmp/ipi-macos-green 854ea8e, which is this head with the workflow. All four jobs passed. In each, the extension loaded, the unit suite gave "OK (36 tests, 101 assertions)" and the class name tests "OK (4 tests, 42 assertions)" with PHPUnit 9.6.34.
  • Full build, run 43558709296 on tmp/pr-matrix-100, started with tools/pr-matrix.py without macOS, success. All eight build jobs passed, Ubuntu with PHP 7.4 to 8.5 and Windows with PHP 8.3. Every one of the 9 Setting 'PullRequestSha' lines gives 277e459, and Configure printed "Left out 5 macOS entries". Each job builds the head merged into rc as rc is when the job starts. The PHP 8.0 to 8.3 jobs started before Read and choose the client IP as the IP Intelligence specification says, and round coordinates #97 and Every example ends with Find out more, and gives the tagged links it needs #98 merged and gave the IP Intelligence unit suite "OK (36 tests, 101 assertions)". The PHP 8.4 and 8.5 jobs started after, merged the head with them, and gave "OK (52 tests, 278 assertions)". So the change was built and tested on Linux with rc both before and after those merges.

macOS was left out of this draft's full build under the 9 November decision, and the green run above built and tested on macOS. The rc head is built with macOS before it merges into main.

The head

277e459 is one commit on rc 70424ea. rc has since taken #97 and #98 (2104ad7), which change nothing under ip-intelligence/on-premise, and git merge-tree of the head and 2104ad7 is clean. The quick checks are green on the head, the two wrapper checks included.

What remains

  1. Both config.m4 files keep -fpermissive, which lets Linux build what macOS refuses. #102 takes it out.
  2. The throwaway branches tmp/ipi-macos-red, tmp/ipi-macos-green and tmp/pr-matrix-100 are deleted once this description is published.

…ce class names

clang, which builds the extension on macOS, refuses to convert the untyped
pointer ZEND_HASH_FOREACH_STR_KEY_PTR gives to a class entry, where g++
accepts it under -fpermissive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant