pkgs/uwsgi: fix compiling and linking the php plugin in uwsgi#107403
pkgs/uwsgi: fix compiling and linking the php plugin in uwsgi#107403rnhmjoj merged 4 commits intoNixOS:masterfrom
Conversation
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
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
|
updated after the borked PR #97536 |
|
@rnhmjoj Do you know if this fil be merged with 20.09 as well? I find it always difficult to understand that |
|
The backport process to stable branches (20.09 now) is manual and the policy is to only backport security or bug fixes. If you need it, you could pick the uwsgi package from the unstable channel while staying on 20.09. I can't find a guide or example right know, if you're interested I can explain it to you. |
|
The backport process to stable branches (20.09 now) is manual and
the policy is to only backport security or bug fixes. This PR is
technically fixing PHP supports, but it's really adding a new
feature and does non-trivial changes to uwsgi: I don't think it's
a good idea to backport it.
A new feature? It just fixes something that worked like a charm in 20.03 and
is broken in 20.09, it doesn't add any new functionality. It isn't a
new, incompatible, release of uwsgi. If you don't need the PHP module
nothing will change for you.
If you need it, you could pick the uwsgi package from the unstable
channel while staying on 20.09. I can't find a guide or example right
know, if you're interested I can explain it to you.
There's no need, thanks. I just wanted me to save the hassle of using PHP
and other plugins from unstable.
…--
Alberto Berti - Information Technology Consultant
PGP: 9377 A68C C5B5 B534 36BD F20B E3B5 C559 99D6 7CF9
"gutta cavat lapidem"
|
You're right, I wasn't aware the php was there before this PR... |
|
I can make a PR against release-20.09 too (I believe I already have a branch). I personally do believe this needs to be fixed in 20.09, since it's the difference between completely not working and fixed :) |
|
Motivation for this change
fixes #97352 - it enables the use of the php plugin of uwsgi.
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.¹ not sure why the session extension is separated on NixOS, it's builtin in libphp.so on both Debian/Ubuntu and ArchLinux - something to be discussed by the PHP team i guess.
ps.
this is my first involvement with the NixOS project, so I'm open to any criticism and suggestions.