Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking issue with PHP 8.4 and libpq #560

Closed
dunglas opened this issue Nov 23, 2024 · 11 comments · Fixed by #568 or #572
Closed

Linking issue with PHP 8.4 and libpq #560

dunglas opened this issue Nov 23, 2024 · 11 comments · Fixed by #568 or #572
Assignees
Labels
bug Something isn't working kind/dependency Issues related to dependencies

Comments

@dunglas
Copy link
Contributor

dunglas commented Nov 23, 2024

Building the static embed SAPI with Postgres causes a linking issue: the Postgres library isn't found: https://github.com/dunglas/frankenphp/actions/runs/11986745297/job/33420123250?pr=1193#step:6:21679

The problem only occurs with PHP 8.4.

@dunglas dunglas changed the title Linking issue with PHP 8.4 and Postgres Linking issue with PHP 8.4 and libpq Nov 23, 2024
@crazywhalecc crazywhalecc added bug Something isn't working kind/dependency Issues related to dependencies labels Nov 25, 2024
@dunglas
Copy link
Contributor Author

dunglas commented Nov 25, 2024

Passing explicitly something ${PWD}/buildroot/lib/libpgcommon.a ${PWD}/buildroot/lib/libpgport.a ${PWD}/buildroot/lib/libpq.a to the linker works as a workaround.

@crazywhalecc
Copy link
Owner

@dunglas
Copy link
Contributor Author

dunglas commented Dec 9, 2024

@crazywhalecc crazywhalecc reopened this Dec 9, 2024
@crazywhalecc
Copy link
Owner

crazywhalecc commented Dec 9, 2024

@dunglas It seems to be caused by a corrupted pg_config (and my first local test I just removed it...). Simply not specifying the directory will bypass pg_config and fix the missing libraries. See #572

It looks good for now, and I think we can add sanity checks to embed ASAP to reduce this kind of problems.

@dunglas
Copy link
Contributor Author

dunglas commented Dec 9, 2024

Thank you!

@dunglas
Copy link
Contributor Author

dunglas commented Dec 9, 2024

@crazywhalecc
Copy link
Owner

O....kay. That's weird, I use single extension pgsql it's good to print -lpq -lpgport -lpgcommon ..., but with frankenphp's combination, it indeed occurs.

@dunglas
Copy link
Contributor Author

dunglas commented Dec 14, 2024

@crazywhalecc
Copy link
Owner

@dunglas I'm not sure which extension causes this bug, but it's working and no problem with spc-config. Using php-config also needs patching or passing prefix and other additional flags.

@dunglas
Copy link
Contributor Author

dunglas commented Dec 14, 2024

Sorry I probably missed something but what is spc-config? Should we update our build script to use it?

@crazywhalecc
Copy link
Owner

@dunglas #573 I added spc-config for static-php:

# Before
buildroot/bin/php-config --libs

# Now
bin/spc spc-config $EXTENSIONS --with-libs=$LIBS --libs

There are also sanity checks using spc-config after building embed SAPI. See: https://static-php.dev/en/guide/manual-build.html#embed-usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working kind/dependency Issues related to dependencies
Projects
None yet
2 participants