Skip to content

fix!: bump bindgen to 0.73.2 for libclang 22 - #259

Merged
jmjoy merged 3 commits into
phper-framework:masterfrom
brettmc:fix/bindgen-clang-22
Oct 23, 2026
Merged

jmjoy merged 3 commits into
phper-framework:masterfrom
brettmc:fix/bindgen-clang-22

Conversation

@brettmc

@brettmc brettmc commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Fixes: #255

bindgen 0.71 generates wrong struct layouts against libclang 22, so phper-sys fails its own layout assertions and does not build. Clang 22 changed which declaration a struct type refers to, and bindgen took types typedef'd before their definition for forward declarations (rust-lang/rust-bindgen#3278). Ubuntu 26.04 ships libclang 22, as reported in #255.

0.72.1 fixes that, but 0.72 broke the layout of over- and under-aligned types, fixed in 0.73.2. So take 0.73.2.

The generated bindings change in ways that break code naming the affected items. A few __bindgen_ty_N types are renumbered, va_list changes type, some padding fields are removed, and opaque structs such as zend_mm_heap lose Copy and Clone. zval, zend_string, zend_execute_data and the observer API are unchanged.

bindgen 0.73 emits #[allow(unnecessary_transmutes)], a lint rustc only knows from 1.88. Allow unknown lints in phper-sys so it still builds on 1.85 under -D warnings.

The quick start's install hint named llvm-10, which current distros no longer package. Use the unversioned packages instead.

Co-Authored-By: Claude Code

bindgen 0.71 generates wrong struct layouts against libclang 22, so
phper-sys fails its own layout assertions and does not build. Clang
22 changed which declaration a struct type refers to, and bindgen
took types typedef'd before their definition for forward
declarations (rust-lang/rust-bindgen#3278). Ubuntu 26.04 ships
libclang 22, as reported in phper-framework#255.

0.72.1 fixes that, but 0.72 broke the layout of over- and
under-aligned types, fixed in 0.73.2. So take 0.73.2.

The generated bindings change in ways that break code naming the
affected items. A few __bindgen_ty_N types are renumbered, va_list
changes type, some padding fields are removed, and opaque structs
such as zend_mm_heap lose Copy and Clone. zval, zend_string,
zend_execute_data and the observer API are unchanged.

bindgen 0.73 emits #[allow(unnecessary_transmutes)], a lint rustc
only knows from 1.88. Allow unknown lints in phper-sys so it still
builds on 1.85 under -D warnings.

The quick start's install hint named llvm-10, which current distros
no longer package. Use the unversioned packages instead.

Co-Authored-By: Claude Code
@brettmc
brettmc marked this pull request as ready for review October 23, 2026 08:06
@jmjoy
jmjoy merged commit 1d7fbf2 into phper-framework:master Oct 23, 2026
21 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 17, 2026
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.

phper-sys does not build with libclang 22

2 participants