[20.09] pkgs/uwsgi: fix compiling and linking the php plugin in uwsgi#107792
Merged
rnhmjoj merged 4 commits intoNixOS:release-20.09from Dec 31, 2020
Merged
[20.09] pkgs/uwsgi: fix compiling and linking the php plugin in uwsgi#107792rnhmjoj merged 4 commits intoNixOS:release-20.09from
rnhmjoj merged 4 commits intoNixOS:release-20.09from
Conversation
rnhmjoj
requested changes
Dec 28, 2020
Contributor
rnhmjoj
left a comment
There was a problem hiding this comment.
Thank you for opening the PR.
Backport should be done using cherry-pick -xe, see CONTRIBUTING.md.
6d3cd4a to
5cbfad6
Compare
uwsgi needs to run php-config to get the include path. set the UWSGICONFIG_PHPPATH to the php-config in the php.dev store. Patch common.h to directly include php_session.h (since it's a separate package on nixos). NIX_CFLAGS_LINK was removed since it doesn't seem to be used at all https://github.com/unbit/uwsgi/blob/master/plugins/php/common.h (cherry picked from commit 6dd858d)
On NixOS the session.so php extension is a separate package (and not builtin in libphp.so). But since the uwsgi php plugin uses the session mechanisms, we need to link the plugin to that library too. With this change uwsgipluginpy is hacked to take an additional UWSGICONFIG_PHP_LDFLAGS environment variable and add it to its LDFLAGS, and then in the nix expression the UWSGICONFIG_PHP_LDFLAGS is set to point to php.extensions.session (cherry picked from commit 87bed6c)
(cherry picked from commit 06749ba)
(cherry picked from commit 41af371)
5cbfad6 to
36d68d5
Compare
gdamjan
added a commit
to gdamjan/tt-rss-service
that referenced
this pull request
Jan 21, 2021
the uwsgi and php compile issue was fixed in NixOS/nixpkgs#107792
gdamjan
added a commit
to gdamjan/nextcloud-service
that referenced
this pull request
Jan 21, 2021
the uwsgi and php compile issue was fixed in NixOS/nixpkgs#107792
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation for this change
fixes #97352 - it enables the use of the php plugin of uwsgi. A port to release-20.09, of the PR #107403 that merged the same change to master.
Things done
I tested in a nixos docker container, on ArchLinux host:
Explanation of the changes
The root of the problem is that uwsgi has a bit of a different build system, and it would expect to find the
php-configbinary in order to set it's compiler and linker flags. There was an additional problem that the uwsgi-php plugin needs to also link with thesession.sophp extension - which on NixOS is a separate package¹.The first problem was solved by adding all the required
buildInputsto the uwsgi package so that it can find all the needed header files, libraries and to have php-config in its PATH.I also had to patch uwsgi to not look for
php_session.hwith a path like this#include "ext/session/php_session.h", since on NixOS it's just in…php-session-7.4.8-dev/include.Third, I had to patch the uwsgi build system for the php plugin to explicitly add the
session.solibrary and its rpath toLDFLAGS. In the nix expression that's exported as the UWSGICONFIG_PHP_LDFLAGS environment variable. It's important that these flags are not used for the main uwsgi binary, but just for the php-plugin shared object.