Skip to content

Remove cgo directives from frankenphp.go #1727

@henderkes

Description

@henderkes

Describe you feature request

Is your feature request related to a problem? Please describe.
See: https://github.com/php/frankenphp/blob/main/frankenphp.go#L19
FrankenPHP builds keep exhibiting unexpected behaviour due to the inclusion of compiler/linker flags in the source code. Just yesterday I spent a day chasing build failures caused by these flags and compilers inconsistencies in handling them.

https://github.com/crazywhalecc/static-php-cli/actions/runs/16094560246/job/45415603297

Can you spot the failure? The go linker invokes the c linker and silently! passes -L/usr/lib as a search path, leading to libphp.so in the github runners system folder being picked up and linked against, even though we only pass -L/static-php-cli/buildroot/lib. Zig cc has issues with inconsistent order anyway, but turns out Clang and Gcc also prefer to pull in the shared library if it's available.

The same goes for the header include flags.

Describe the solution you'd like

Remove the "magic" extra compiler flags and force users to explicitly pass them.

Describe alternatives you've considered
Alternatively, add a build tag that disables them (I could imagine that may be possible?).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions