Skip to content

libraries: honour SPC_DEFAULT_CFLAGS/CXXFLAGS/LDFLAGS and bug fixes - #1166

Open
henderkes wants to merge 9 commits into
v3from
v3c/library-fixes
Open

henderkes wants to merge 9 commits into
v3from
v3c/library-fixes

Conversation

@henderkes

Copy link
Copy Markdown
Collaborator

bzip2, fastlz, jbig, qdbm: thread SPC_DEFAULT_CFLAGS into the hand-rolled Makefile patches and shell compile commands. Backward compatible when the env var is empty.

icu: append SPC_DEFAULT_CXXFLAGS/LDFLAGS to runConfigureICU's CXXFLAGS and LDFLAGS so user flags reach the bundled cxx invocation.

openssl: append user CFLAGS/LDFLAGS after the target name on Configure so options like -flto and -fprofile-* reach the openssl build.

liblz4: replace placeholder Makefile patch ("installewfwef") with a real one that compiles each lib source individually -- clang -flto -c with multiple inputs only writes a .o for the first, silently dropping the rest and leaving liblz4.a with a single object.

libheif: rewrite libheif 1.22+'s C-incompatible
struct heif_bad_pixel { uint32_t row; uint32_t column; }; as a typedef so C consumers compile.

ncurses: filter the clang/zig-cc "N warning(s) generated." stdout line out of MKlib_gen.sh's preprocessor pipe before sed turns it into invalid C in lib_gen.c.

libaom: detect target CPU from SystemTarget instead of hard-coding generic, fall back to generic only when neither nasm nor yasm is available, and turn off examples/tests/tools/docs.

What does this PR do?

Checklist before merging

  • If you modified *.php or *.yml, run them locally to ensure your changes are valid:
    • composer cs-fix
    • composer analyse
    • composer test
    • bin/spc dev:lint-config

bzip2, fastlz, jbig, qdbm: thread SPC_DEFAULT_CFLAGS into the
hand-rolled Makefile patches and shell compile commands. Backward
compatible when the env var is empty.

icu: append SPC_DEFAULT_CXXFLAGS/LDFLAGS to runConfigureICU's CXXFLAGS
and LDFLAGS so user flags reach the bundled cxx invocation.

openssl: append user CFLAGS/LDFLAGS after the target name on Configure
so options like -flto and -fprofile-* reach the openssl build.

libheif: rewrite libheif 1.22+'s C-incompatible
`struct heif_bad_pixel { uint32_t row; uint32_t column; };` as a
typedef so C consumers compile.

ncurses: filter the clang/zig-cc "N warning(s) generated." stdout line
out of MKlib_gen.sh's preprocessor pipe before sed turns it into
invalid C in lib_gen.c.

libaom: detect target CPU from SystemTarget instead of hard-coding
generic, fall back to generic only when neither nasm nor yasm is
available, and turn off examples/tests/tools/docs.
@henderkes
henderkes force-pushed the v3c/library-fixes branch from c53f6ad to 29a8c9c Compare May 24, 2026 14:28
@crazywhalecc crazywhalecc added the need-test This PR has not been tested yet, cannot merge now label May 24, 2026
@github-actions

github-actions Bot commented May 24, 2026 •

Copy link
Copy Markdown

StaticPHP Test Bot

Detected: Extensions: uv | Libraries: brotli, gmp, imagemagick, ldap, libavif, libffi, libheif, libjxl, libmemcached, libpng, librabbitmq, libtiff, libuv, libxslt, mimalloc, nghttp3, ngtcp2, qdbm, readline, tidy, unixodbc, xz, zstd | Targets: curl
Active labels: none
Available labels: need-test (gate), test/linux test/windows test/macos (platform), test/tier2 (extra arch), test/php-83 test/php-84 (PHP version), sapi/frankenphp (extra FrankenPHP SAPI build)
Config: Linux x86_64 + Windows x86_64 + macOS arm64 | PHP 8.5 NTS

# Conflicts:
#	src/Package/Library/bzip2.php
#	src/Package/Library/libaom.php
libuv 1.53.0 calls WaitOnAddress()/WakeByAddressSingle() from
src/win/pipe.c. Those symbols live in synchronization.lib (Win8+), and
libuv's CMake lists "synchronization" in uv_libraries only for its own
CMake targets. uv_a is a static archive, so the dependency does not
propagate to php.exe, which links libuv.lib directly and therefore must
pass the system library itself.

Without it the Windows uv matrix job fails at link time:

    libuv.lib(pipe.obj) : error LNK2001: unresolved external symbol WaitOnAddress
    libuv.lib(pipe.obj) : error LNK2001: unresolved external symbol WakeByAddressSingle
    php.exe : fatal error LNK1120: 2 unresolved externals

Inject CHECK_LIB("synchronization.lib", ...) next to the dbghelp.lib one we
already add, so LIBS_UV carries it into the php.exe / CGI / embed links.
EXTENSION() is decided earlier, so a missing library still only warns.

Windows-only: the hook runs in php::buildconfForWindows.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

need-test This PR has not been tested yet, cannot merge now

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants