Project description
Would like to test applications with PHP 7.4.
I tried it myself and did overrideAttrs on php73 and changed the sources to php7.4.
But it fails every time with this line https://github.com/php/php-src/blob/5d6e923d46a89fe9cd8fb6c3a6da675aa67197b4/ext/mysqli/mysqli.c#L665
I guess MYSQL_VERSION_ID is not defined. But I don't know why 馃檲
Looks like November 28 is the official release. If anyone has played around with it yet in nixpkgs I would suspect maybe @etu, @Ma27, or @Izorkin may have. I have not had the chance yet. We should coordinate efforts here as to avoid duplicate work.
I have been trying to pack a package for a long time. Also encountered this error.
I tried to package a beta some months ago, I got some error -- don't remember what though because I didn't have the time to complete that at that time.
Error with libmysqlclient
/build/php-7.4.0RC5/ext/mysqli/php_mysqli_structs.h:57:10: fatal error: my_global.h: No such file or directory
#include <my_global.h>
^~~~~~~~~~~~~
with mysqlnd
/build/php-7.4.0RC5/ext/mysqli/mysqli.c:696:22: error: operator '>' has no left operand
#if MYSQL_VERSION_ID > 50110 || defined(MYSQLI_USE_MYSQLND)
^
/build/php-7.4.0RC5/ext/mysqli/mysqli.c:700:22: error: operator '>' has no left operand
#if MYSQL_VERSION_ID > 50605 || defined(MYSQLI_USE_MYSQLND)
^
/build/php-7.4.0RC5/ext/mysqli/mysqli.c:717:23: error: operator '>=' has no left operand
#if (MYSQL_VERSION_ID >= 50611 && defined(CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)) || defined(MYSQLI_USE_MYSQLND)
^~
/build/php-7.4.0RC5/ext/mysqli/mysqli.c:738:22: error: operator '>' has no left operand
#if MYSQL_VERSION_ID > 50003 || defined(MYSQLI_USE_MYSQLND)
^
/build/php-7.4.0RC5/ext/mysqli/mysqli.c:746:22: error: operator '>' has no left operand
#if MYSQL_VERSION_ID > 50007 || defined(MYSQLI_USE_MYSQLND)
^
/build/php-7.4.0RC5/ext/mysqli/mysqli.c:766:22: error: operator '>' has no left operand
#if MYSQL_VERSION_ID > 50001 || defined(MYSQLI_USE_MYSQLND)
^
/build/php-7.4.0RC5/ext/mysqli/mysqli.c:770:23: error: operator '>' has no left operand
#if (MYSQL_VERSION_ID > 51122 && MYSQL_VERSION_ID < 60000) || (MYSQL_VERSION_ID > 60003) || defined(MYSQLI_USE_MYSQLND)
^
/build/php-7.4.0RC5/ext/mysqli/mysqli.c:803:22: error: operator '>' has no left operand
#if MYSQL_VERSION_ID > 50002 || defined(MYSQLI_USE_MYSQLND)
Without mysql:
builder for '/nix/store/d7bw86piycwn2g0mp092b6s0s27qnlkb-php-7.4.0RC5.drv' failed with exit code 2; last 10 log lines:
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/php-7.4.0RC5/Zend/zend_constants.h:67:114: error: expected expression before ')' token
#define REGISTER_MAIN_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), 0)
^
/build/php-7.4.0RC5/main/main.c:2205:2: note: in expansion of macro 'REGISTER_MAIN_LONG_CONSTANT'
REGISTER_MAIN_LONG_CONSTANT("PHP_VERSION_ID", PHP_VERSION_ID, CONST_PERSISTENT | CONST_CS);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/zavn4np1jvm79f0rafkv0p1mrag09qkz-bash-4.4-p23/bin/bash /build/php-7.4.0RC5/libtool --silent --preserve-dup-deps --mode=compile gcc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Imain/ -I/build/php-7.4.0RC5/main/ -DPHP_ATOM_INC -I/build/php-7.4.0RC5/include -I/build/php-7.4.0RC5/main -I/build/php-7.4.0RC5 -I/nix/store/sxprfsqi2lyy99ghasxdn6yrh3wl0mxl-systemd-243-dev/include -I/nix/store/x53j9md8qyyx9r3il6nmpwhlbbnl3i9l-valgrind-3.15.0-dev/include/valgrind -I/build/php-7.4.0RC5/ext/date/lib -I/nix/store/di5wwwkj467j2x85n9xw0y1ic2g4v3a5-libxml2-2.9.9-dev/include/libxml2 -I/nix/store/rxywzw8385rv41s8byrnd4l7wd59v2cr-openssl-1.1.1d-dev/include -I/nix/store/9ppnzpfnfjrv63b6qn2bsb9pcbsglika-sqlite-3.30.0-dev/include -I/nix/store/2pxp7kn24ig52r22zfw340ji6az5c3r6-zlib-1.2.11-dev/include -I/nix/store/0f60rrpi69qlbyyj4wsbmadp7vb00ba8-curl-7.66.0-dev/include -I/nix/store/8q5821w42xx5qqyl35h5b5fha6jynpk8-gettext-0.19.8.1/include -I/nix/store/xka91njlp7ldh75v7dkhpplnzmav1r21-gmp-6.1.2-dev/include -I/nix/store/ylfixs855w67n0jbkszxima1b1aisdqp-uw-imap-2007f/include/c-client -I/nix/store/jvigvhkhcb4d0l8c6fbqpl2dlcjyrw6n-icu4c-64.2-dev/include -I/nix/store/q58hafdvfc71msc8sln15fkn6cq68cfn-openldap-2.4.48-dev/include -I/nix/store/q7xgpv656x9p7by2wd01asbakn9y1d4h-cyrus-sasl-2.1.27-dev/include -I/nix/store/27v5y8qy40kq5yhg2ki690c290avnp07-onig-6.9.3/include -I/build/php-7.4.0RC5/ext/mbstring/libmbfl -I/build/php-7.4.0RC5/ext/mbstring/libmbfl/mbfl -I/nix/store/kxpx04xnw32667mzyj6kk748gy3wn1fk-postgresql-11.5/include -I/nix/store/jixpb0kr3rf4q744hrfrasbx74rlmdxi-readline-6.3p08-dev/include -I/nix/store/4hkqn84rzqln1n85i1a2pd9fpv33gb93-libsodium-1.0.18-dev/include -I/nix/store/a3nwryn8hx0ibd4kzs1kvyyahv21zrc9-libargon2-20190702/include -I/build/php-7.4.0RC5/TSRM -I/build/php-7.4.0RC5/Zend -D_REENTRANT -pthread -I/usr/include -g -O2 -fvisibility=hidden -pthread -Wall -Wno-strict-aliasing -DZTS -DZEND_SIGNALS -c /build/php-7.4.0RC5/main/output.c -o main/output.lo
make: *** [Makefile:1706: main/main.lo] Error 1
make: *** Waiting for unfinished jobs....
[0 built (1 failed), 0.0 MiB DL]
somewhere else there is an error
I could fix the mysql error by using mysql57 instead libmysqlclient. I have now the same error above
One step forward something is destroying php_version.h
/* automatically generated by configure */
/* edit configure.ac to change version number */
#define PHP_MAJOR_VERSION linux
#define PHP_MINOR_VERSION gnu
#define PHP_RELEASE_VERSION
#define PHP_EXTRA_VERSION ""
#define PHP_VERSION "linux.gnu."
#define PHP_VERSION_ID
Got it running
PHP 7.4.0RC5 (cli) (built: Oct 29 2019 08:49:34) ( ZTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0-dev, Copyright (c) Zend Technologies
php73.overrideAttrs (old: rec {
version = "7.4.0RC5";
buildInputs = old.buildInputs ++ [ super.oniguruma super.mysql57 ];
src = super.fetchurl rec {
url = "https://downloads.php.net/~derick/php-7.4.0RC5.tar.bz2";
sha256 = "1p9p801ychz46dznx57jr07gyqq2v3lx0990h3n9pak8hba2gw0h";
};
preConfigure = ''
# Don't record the configure flags since this causes unnecessary
# runtime dependencies
for i in main/build-defs.h.in scripts/php-config.in; do
substituteInPlace $i \
--replace '@CONFIGURE_COMMAND@' '(omitted)' \
--replace '@CONFIGURE_OPTIONS@' "" \
--replace '@PHP_LDFLAGS@' ""
done
#[[ -z "$libxml2" ]] || addToSearchPath PATH $libxml2/bin
export EXTENSION_DIR=$out/lib/php/extensions
configureFlags+=(--with-config-file-path=$out/etc \
--includedir=$dev/include)
cp main/php_version.h main/php_version_copy.h
./buildconf --force
'';
preBuild = "cp main/php_version_copy.h main/php_version.h";
})
Copying php_version.h before configure and moving it back after configure.
Created also bug ticket https://bugs.php.net/bug.php?id=78788 its weird.
No correct detect path to sed
./configure: line 3831: /nix/store/5bzp9gfa14j4a1rbxxf6d574a4qgmqi9-gnused-4: No such file or directory
correct path
/nix/store/5bzp9gfa14j4a1rbxxf6d574a4qgmqi9-gnused-4.7/bin/sed
Patch:
diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix
index 4778f08560d..5ffe54bdd7d 100644
--- a/pkgs/development/interpreters/php/default.nix
+++ b/pkgs/development/interpreters/php/default.nix
@@ -5,6 +5,7 @@
, libxslt, libmcrypt, bzip2, icu, openldap, cyrus_sasl, libmhash, unixODBC
, uwimap, pam, gmp, apacheHttpd, libiconv, systemd, libsodium, html-tidy, libargon2
, libzip, valgrind
+, oniguruma, gnused
}:
with lib;
@@ -76,6 +77,7 @@ let
nativeBuildInputs = [ autoconf bison libtool pkgconfig re2c ];
buildInputs = [ ]
+ ++ optional (versionAtLeast version "7.4") oniguruma
++ optional (versionOlder version "7.3") pcre
++ optional (versionAtLeast version "7.3") pcre2
++ optional withSystemd systemd
@@ -211,6 +213,7 @@ let
--includedir=$dev/include)
./buildconf --force
+ substituteInPlace configure --replace "\$SED" "${gnused}/bin/sed"
'';
postInstall = ''
@@ -227,7 +230,10 @@ let
'';
src = fetchurl {
- url = "https://www.php.net/distributions/php-${version}.tar.bz2";
+ url = [
+ "https://downloads.php.net/~derick/php-${version}.tar.xz"
+ "https://www.php.net/distributions/php-${version}.tar.bz2"
+ ];
inherit sha256;
};
@@ -268,4 +274,9 @@ in {
# https://bugs.php.net/bug.php?id=76826
extraPatches = optional stdenv.isDarwin ./php73-darwin-isfinite.patch;
};
+
+ php74 = generic {
+ version = "7.4.0RC5";
+ sha256 = "1qcnm12b7wgs4i9i0gqa8ff3469wnxjf354jv8kwcakgw2pk57rj";
+ };
}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e0a6b21a162..f09813ec6b5 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -8970,7 +8970,8 @@ in
stdenv = if stdenv.cc.isClang then llvmPackages_6.stdenv else stdenv;
})
php72
- php73;
+ php73
+ php74;
php-embed = php73-embed;
./result/bin/php -i | grep mysql
Client API library version => mysqlnd 7.4.0RC5
mysqli.allow_local_infile => Off => Off
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => /run/mysqld/mysqld.sock => /run/mysqld/mysqld.sock
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.reconnect => Off => Off
mysqli.rollback_on_cached_plink => Off => Off
mysqlnd
mysqlnd => enabled
Version => mysqlnd 7.4.0RC5
Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password,auth_plugin_caching_sha2_password,auth_plugin_sha256_password
API Extensions => mysqli,pdo_mysql
PDO drivers => mysql, odbc, pgsql, sqlite
pdo_mysql
Client API version => mysqlnd 7.4.0RC5
pdo_mysql.default_socket => /run/mysqld/mysqld.sock => /run/mysqld/mysqld.sock
Applying the following patch, should fix the issue with sed:
https://github.com/php/php-src/pull/4891
Can you confirm that? I did not test it explicitly for NixOS.
Should be fixed then with next RC https://github.com/php/php-src/commit/0988f6963420ab26b7804e080380b813ca79cfa8