-
-
Notifications
You must be signed in to change notification settings - Fork 349
add libacl for php-fpm compilation #611
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
Conversation
|
I'm not quite happy with the EXTRA_LDFLAGS_PROGRAM thing yet. The problem is that php's Makefile automatically adds -lacl at the end of a makefile when /path/to/buildroot/lib/libacl.a is already set in EXTRA_LIBS. I think it would be a better idea to patch that -lacl out of the command. Let me revert the changes. How do we add a pathBeforeMake for a library that is not actually an extension? |
|
hmm, seems to not actually be an issue anymore after cleaning my env vars and downloading and building fresh. No idea why the actions fail on intl now, given that the PR does not touch that |
|
This seems to be the first time we encountered a non-extension dependency. If it's an optional dependency, maybe making a fake extension like swoole-hook-mysql is a better choice? For example, |
|
I think that makes less sense than using --with-libs. The real alternative I would see would be --build-fpm --with-fpm-acl. Bit then we'd need to add logic to conditionally build the library, rather than using the already existing getLib check. |
|
Actually, thinking about it, is there a reason why we don't just default this behaviour? fpm with acl can do everything that fpm without acl can't do. If the directives aren't used, it makes no difference. Maybe we should just default this lib for fpm builds? |
That's a good question. As you know, currently spc only depends on pkg-config by default on *nix. If it is enabled by default, it means that in addition to pkg-config, these two libraries must be downloaded. If most distributions added and used this library, adding it as a default I think is feasible, but we should also add it to the list of precompiled libraries to speed up the build: static-php-cli/config/source.json Line 340 in 7febbc7
https://github.com/static-php/static-php-cli-hosted/blob/master/.github/workflows/pack-libs.yml Also, with this change, I think we need to separate the way such libraries (pkg-config, libacl) are specified to support the continued addition of related libraries in the future. I'll think about where we should list them. |
I doubt this will happen as SPC is still for static php, while all distros ship dynamic builds. All php-fpm packages I know ship with acl, though. At least on Ubuntu, Debian and RHEL based distros. Not entirely sure about alpine, but alpine also has ACL as a utility.
Yes, I agree. Preferably the setting in source.json should be all that's needed to pre-build a lib and add them to the list of downloadable pre-built libs. |
crazywhalecc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added root node for lib.json via #618 , and we can add fpm deps in php.
|
Two questions:
|
{
"php": {
"type": "root",
"source": "php-src",
"lib-depends-windows": [
"micro",
"lib-base"
],
"lib-depends-unix": [
"micro",
"lib-base",
"libacl"
]
}
} |
|
I like that idea. However, there's no php-fpm node, there's only the php node. If we add it there, it'll be required even for the CLI binary, which doesn't actually need it. |
Since we currently have no way to pass the SAPI we want to build when using the Another solution is to use Also, we can add some special deps patch, for example: building cli only will remove We can also split the |
|
Hmm, yeah I think you're right, it'd be fine to download and build libacl no matter what. It builds very fast so it shouldn't be much of an issue. |
|
Now this is getting interesting. the ubuntu runner on php 8.3 works, the one on php 8.4 doesn't work because it adds -lacl despite /path/to/buildroot/lib/libacl.a already being specified. I had this issue on RHEL at first, but then it stopped happening and now I cannot reproduce it anymore. Might have to path before make. |
Seems 8.3 is using As for mac, just add |
|
okay it works fine on alpine, rhel and ubuntu now. I can't really work on macos with just runners as my reference, I think you'll have to take a look @crazywhalecc |
|
it looks like it's trying to use l-prefixed versions of the functions which aren't defined. Maybe patching opt_deref to true would fix the issue? |
|
Oops, fpm-acl is more like a linux-only feature. I can't find a way to have fpm on a mac that has acl enabled. So did homebrew version. The acl and attr hosted by brew are also only for Linux and cannot be installed on MacOS. https://github.com/php/php-src/blob/94f327219a5f85fc93f56ab72d1c940870ec4a0d/sapi/fpm/config.m4#L425 |
|
That's strange, macos uses the posix permission model and supports acl. If you want I can disable it for mac os, but I don't understand why it wouldn't work. Edit: oh the configure m4 you linked states that it doesn't even work on macos even if acl is installed. Guess I'll remove it tomorrow. |
|
More old information: php/php-src#8395 |
|
The official macos documentation about acl contradicts the config.m4 comment. The code would compile and link fine on macos. |
|
I tried this manually, and got undefined #include <sys/acl.h>
int main (void)
{
acl_t acl;
acl_entry_t user, group;
acl = acl_init(1);
acl_create_entry(&acl, &user);
acl_set_tag_type(user, ACL_USER);
acl_create_entry(&acl, &group);
acl_set_tag_type(user, ACL_GROUP);
acl_free(acl);
;
return 0;
}This seems to verify that macOS does not support the user/group feature. If PHP think it does not have this feature, it is considered that acl is not supported. |
|
Okay, I'll remove it from MacOS then. We may need to split up lib-depends-unix to lib-depends-linux and lib-depends-macos x) I'll do it tomorrow, though. It's 8pm already |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This pull request updates the build configuration to support the addition of libacl for PHP-FPM compilation by adjusting the PHP version used in Unix builds.
- Updated the default PHP version from 8.3 to 8.4 in the GitHub Actions workflow
- Aligns build configuration with the requirements of the new libacl dependency
Reviewed Changes
| File | Description |
|---|---|
| .github/workflows/build-unix.yml | Updated default PHP version to 8.4 for Unix builds |
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
.github/workflows/build-unix.yml:18
- The default PHP version was updated to 8.4. Please confirm that PHP 8.4 is fully supported by all dependencies and that tests are updated to cover this version, or consider including 8.3 if support for both is required.
default: '8.4'
|
is there a reason why there isn't an alpine image in the docker workflows btw? just realized it's missing and I need to check on my vm manually ubuntu/debian and rhel behave quite similarly other than their package managers using different package names, but alpine behaves differently since we're using different build tools and they have different system headers installed |
|
How does providing pre builts work, by the way? If I change the line to true, what else needs to be done to actually have it automatically download a prebuilt version? |
Seems I forgot to change test ci... But it's just working, with musl-toolchain.
I've created a PR in "hosted" repo: static-php/static-php-cli-hosted#7 Once this pr merged, I'll merge it soon. This side we only need to set |
|
huh, this closed automatically and I cannot reopen it |
|
wtf |
|
What happened? Is there a problem with main branch merge? |
|
no idea, i opened a new PR |
What does this PR do?
adds libacl for php-fpm compilation. php-fpm commonly uses listen.owner and listen.group, without acl, php-fpm will crash when encountering this config directive
Checklist before merging