Skip to content
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

php-master: init at php-8.4.0.snapshot.c803402-20230907122631 #104

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jtojnar
Copy link
Member

@jtojnar jtojnar commented Apr 26, 2022

Currently does not build.

Fixes: #35

@drupol
Copy link
Collaborator

drupol commented Apr 27, 2022

The current issue: https://dpaste.org/wDL4A

@drupol
Copy link
Collaborator

drupol commented Apr 28, 2022

I'm trying to get it to compile and while doing things here and there, I notice something.

In here: https://github.com/fossar/nix-phps/blob/php-master/pkgs/phps.nix#L438, the extension curl is in the list and should be enabled.

When I try to build php-master with nix build --override-input php-src github:php/php-src/PHP-8.1 -L .#php-master, it fails.

Then I check the logs: nix log /nix/store/azipihspd62sqzdlhgyg5y2kyfp81xpx-php-8.1.7.pre+date=20220427181447.drv | grep -i 'curl' | less and I see: checking for cURL support... no.

I have the feeling that the configure flags coming from enabled extensions are not going through.

@jtojnar
Copy link
Member Author

jtojnar commented Apr 28, 2022

The curl thing is the same when building regular PHP (nix build .#php81.unwrapped -L --rebuild). We build extensions separately.

Would you be able to compare the source trees between git and archive?

@drupol
Copy link
Collaborator

drupol commented Apr 29, 2022

The curl thing is the same when building regular PHP (nix build .#php81.unwrapped -L --rebuild). We build extensions separately.

Weird, but ok.

I succeeded to build PHP, but it fails now when trying to compile the extensions:

 pol@nixos  ~/C/g/f/nix-phps   php-master *…  nix build --override-input php-src github:php/php-src/PHP-8.1 -L .#php-master                                                                                                             
warning: Git tree '/home/pol/Code/git/fossar/nix-phps' is dirty
warning: not writing modified lock file of flake 'git+file:///home/pol/Code/git/fossar/nix-phps':
• Updated input 'php-src':
    'github:php/php-src/0bcffa6be25bd368e4a58869653947afb669355a' (2022-04-29)
  → 'github:php/php-src/1944c14ce7568617bad10e6d0121268d66ef8abe' (2022-04-28)
php-bcmath> unpacking sources
php-bcmath> unpacking source archive /nix/store/3bprjmshgrlfvcnhf0f4wgfk7z484knn-source
php-calendar> unpacking sources
php-calendar> unpacking source archive /nix/store/3bprjmshgrlfvcnhf0f4wgfk7z484knn-source
php-ctype> unpacking sources
php-ctype> unpacking source archive /nix/store/3bprjmshgrlfvcnhf0f4wgfk7z484knn-source
php-exif> unpacking sources
php-exif> unpacking source archive /nix/store/3bprjmshgrlfvcnhf0f4wgfk7z484knn-source
php-dom> unpacking sources
php-dom> unpacking source archive /nix/store/3bprjmshgrlfvcnhf0f4wgfk7z484knn-source
php-fileinfo> unpacking sources
php-fileinfo> unpacking source archive /nix/store/3bprjmshgrlfvcnhf0f4wgfk7z484knn-source
php-filter> unpacking sources
php-filter> unpacking source archive /nix/store/3bprjmshgrlfvcnhf0f4wgfk7z484knn-source
php-curl> unpacking sources
php-curl> unpacking source archive /nix/store/3bprjmshgrlfvcnhf0f4wgfk7z484knn-source
php-bcmath> source root is php-8.1.7.pre+date=20220428174823/ext/bcmath
php-bcmath> chmod: cannot access 'php-8.1.7.pre+date=20220428174823/ext/bcmath': No such file or directory
error: builder for '/nix/store/zg3qq68lfcc0ddy0vjl3h5lb0zvy4npv-php-bcmath-8.1.7.pre+date=20220428174823.drv' failed with exit code 1;
       last 4 log lines:
       > unpacking sources
       > unpacking source archive /nix/store/3bprjmshgrlfvcnhf0f4wgfk7z484knn-source
       > source root is php-8.1.7.pre+date=20220428174823/ext/bcmath
       > chmod: cannot access 'php-8.1.7.pre+date=20220428174823/ext/bcmath': No such file or directory
       For full logs, run 'nix log /nix/store/zg3qq68lfcc0ddy0vjl3h5lb0zvy4npv-php-bcmath-8.1.7.pre+date=20220428174823.drv'.
error: 1 dependencies of derivation '/nix/store/n6v0y8is0mk6swh881xxqz5qzb1vy13a-php-extra-init-8.1.7.pre+date=20220428174823.ini.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ngncmky4sng64r3c10a0f6p6qcpdrgwi-php-with-extensions-8.1.7.pre+date=20220428174823.drv' failed to build
 !  pol@nixos  ~/C/g/f/nix-phps   php-master *…  

Would you be able to compare the source trees between git and archive?

What's the battle plan ? What are we trying to figure out?

@jtojnar jtojnar force-pushed the php-master branch 2 times, most recently from 84b0878 to 7d8a440 Compare April 29, 2022 23:27
@jtojnar
Copy link
Member Author

jtojnar commented Apr 29, 2022

The reason the extensions fail is this line:

https://github.com/NixOS/nixpkgs/blob/22fbd632e6aaa0436bcb20045799d41853527116/pkgs/top-level/php-packages.nix#L84

The tarball has all files inside php-${version} directory, whereas everything is in the top-level directory in Git.

@drupol
Copy link
Collaborator

drupol commented Apr 30, 2022

I also have this issue in the tokenizer extension:

php-xmlwriter> /nix/store/07j81a5xy8j1srvf57dl7lxsaihnmfac-bash-5.1-p12/bin/bash /build/source/ext/xmlwriter/libtool --mode=link gcc -shared -I/build/source/ext/xmlwriter/include -I/build/source/ext/xmlwriter/main -I/build/source/ext/xmlwriter -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php/main -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php/TSRM -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php/Zend -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php/ext -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php/ext/date/lib -I/nix/store/jrl51j9r53mkwvbfiv9cz8v7lv92ygpa-libxml2-2.9.12-dev/include/libxml2  -DHAVE_CONFIG_H  -g -O2    -o xmlwriter.la -export-dynamic -avoid-version -prefer-pic -module -rpath /build/source/ext/xmlwriter/modules  php_xmlwriter.lo -Wl,-rpath,/nix/store/44xy9km0xyvy2m1md00cbdvqrfijn1mk-libxml2-2.9.12/lib -L/nix/store/44xy9km0xyvy2m1md00cbdvqrfijn1mk-libxml2-2.9.12/lib -lxml2
php-xmlwriter> gcc -shared  .libs/php_xmlwriter.o  -Wl,--rpath -Wl,/nix/store/44xy9km0xyvy2m1md00cbdvqrfijn1mk-libxml2-2.9.12/lib -Wl,--rpath -Wl,/nix/store/44xy9km0xyvy2m1md00cbdvqrfijn1mk-libxml2-2.9.12/lib -L/nix/store/44xy9km0xyvy2m1md00cbdvqrfijn1mk-libxml2-2.9.12/lib /nix/store/44xy9km0xyvy2m1md00cbdvqrfijn1mk-libxml2-2.9.12/lib/libxml2.so  -Wl,-rpath -Wl,/nix/store/44xy9km0xyvy2m1md00cbdvqrfijn1mk-libxml2-2.9.12/lib -Wl,-soname -Wl,xmlwriter.so -o .libs/xmlwriter.so
php-opcache> configure: patching config.h.in
php-opcache> configure: creating ./config.status
php-xmlreader> /nix/store/07j81a5xy8j1srvf57dl7lxsaihnmfac-bash-5.1-p12/bin/bash /build/source/ext/xmlreader/libtool --mode=link gcc -shared -I/build/source/ext/xmlreader/include -I/build/source/ext/xmlreader/main -I/build/source/ext/xmlreader -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php/main -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php/TSRM -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php/Zend -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php/ext -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php/ext/date/lib -I/nix/store/jrl51j9r53mkwvbfiv9cz8v7lv92ygpa-libxml2-2.9.12-dev/include/libxml2  -DHAVE_CONFIG_H  -g -O2    -o xmlreader.la -export-dynamic -avoid-version -prefer-pic -module -rpath /build/source/ext/xmlreader/modules  php_xmlreader.lo -Wl,-rpath,/nix/store/44xy9km0xyvy2m1md00cbdvqrfijn1mk-libxml2-2.9.12/lib -L/nix/store/44xy9km0xyvy2m1md00cbdvqrfijn1mk-libxml2-2.9.12/lib -lxml2
php-tokenizer> mv -f y.tab.c /build/source/ext/tokenizer/../../Zend/zend_language_parser.c
error: builder for '/nix/store/q0msqrcj3nsgi109pwdg2gm1c826n3cm-php-tokenizer-8.1.7.pre+date=20220429194756.drv' failed with exit code 2;
       last 10 log lines:
       >       |                 ^~~~~~
       > /build/source/ext/tokenizer/../../Zend/zend_language_parser.y:1340.17-22: warning: POSIX Yacc does not support %empty [-Wyacc]
       >  1340 |            %empty  { $$ = NULL; }
       >       |                 ^~~~~~
       > /build/source/ext/tokenizer/../../Zend/zend_language_parser.y:1439.17-22: warning: POSIX Yacc does not support %empty [-Wyacc]
       >  1439 |                 %empty { $$ = NULL; }
       >       |                 ^~~~~~
       > mkdir .libs
       >  gcc -I. -I/build/source/ext/tokenizer -I/build/source/ext/tokenizer/include -I/build/source/ext/tokenizer/main -I/build/source/ext/tokenizer -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php/main -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php/TSRM -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php/Zend -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php/ext -I/nix/store/nv5hg6rpjpbs8s55mrdngx0y64vd0wh3-php-8.1.7.pre+date=20220429194756-dev/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -DZEND_COMPILE_DL_EXT=1 -c /build/source/ext/tokenizer/tokenizer_data.c -MMD -MF tokenizer_data.dep -MT tokenizer_data.lo  -fPIC -DPIC -o .libs/tokenizer_data.o
       > mv -f y.tab.c /build/source/ext/tokenizer/../../Zend/zend_language_parser.c
       For full logs, run 'nix log /nix/store/q0msqrcj3nsgi109pwdg2gm1c826n3cm-php-tokenizer-8.1.7.pre+date=20220429194756.drv'.
error (ignored): error: cannot unlink '/tmp/nix-build-php-sodium-8.1.7.pre+date=20220429194756.drv-0': Directory not empty
error: 1 dependencies of derivation '/nix/store/hmpgxhvzl0pqmgv2jg6df5lmyb5mjzk3-php-extra-init-8.1.7.pre+date=20220429194756.ini.drv' failed to build
error: 1 dependencies of derivation '/nix/store/881xqi7p5hvj7xh9gsmnqhcxaxgzhv4k-php-with-extensions-8.1.7.pre+date=20220429194756.drv' failed to build

I found those links that might be relevant:

One possible solution would be to replace AC_PROG_YACC with AC_CHECK_PROG in configure.m4.

@jtojnar
Copy link
Member Author

jtojnar commented Apr 30, 2022

I think this might be due to

php-tokenizer> yacc  /build/source/ext/tokenizer/../../Zend/zend_language_parser.y

notice the empty space after $(YACC). For some reason YFLAGS are not set here:

https://github.com/php/php-src/blob/9e74e58bcf7e31aef563f1ee00b7f0bc17fe3ef2/Zend/Makefile.frag#L16

This is probably the same reason PDO fails:

php-pdo> /nix/store/30j23057fqnnc1p4jqmq73p0gxgn0frq-bash-5.1-p16/bin/bash: line 3: --no-generation-date: command not found

$(RE2C) and $(RE2C_FLAGS) are empty here:

https://github.com/php/php-src/blob/9e74e58bcf7e31aef563f1ee00b7f0bc17fe3ef2/ext/pdo/Makefile.frag#L12


You can build with nix build -L .#php-master.extensions.pdo --keep-failed, which will preserve the build directory:

note: keeping build directory '/tmp/nix-build-php-pdo-8.2.0.pre+date=20220426165801.drv-0'

And then look at the generated Makefile in the extension directory /tmp/nix-build-php-pdo-8.2.0.pre+date=20220426165801.drv-0/source/ext/pdo/Makefile – indeed the variables we want are not defined. Nor is there any mention in the generated configure script.

I guess the issue is we are relying on phpize to generate configure script and then that generating the Makefile:

https://github.com/NixOS/nixpkgs/blob/acfb65116af3ba984d844ddb88ab8cf5759c7888/pkgs/top-level/php-packages.nix#L104

But phpize’s generated configure.ac will not have bison and re2c set up like the hand-written one in php root does:

https://github.com/php/php-src/blob/9e74e58bcf7e31aef563f1ee00b7f0bc17fe3ef2/configure.ac#L164-L165

https://github.com/php/php-src/blob/9e74e58bcf7e31aef563f1ee00b7f0bc17fe3ef2/build/php.m4#L1771

@drupol
Copy link
Collaborator

drupol commented Apr 30, 2022

Wow. Impressive debug. How do you think we should fix that ?

@jtojnar
Copy link
Member Author

jtojnar commented Apr 30, 2022

Maybe insert the PHP_PROG lines into configure.ac after phpize and then run autoconf?

@drupol
Copy link
Collaborator

drupol commented May 29, 2022

What's the battle plan on this one? Could be a very nice to have :)

@jtojnar
Copy link
Member Author

jtojnar commented May 29, 2022

Still stuck on the flex/yacc issue.

@drupol drupol force-pushed the php-master branch 2 times, most recently from 7cb1948 to 29afaf2 Compare May 29, 2022 19:40
@drupol drupol changed the title php-master: init at 8.2.pre+date=20220426165801 php-master: init at 8.2.0.pre+date=20220529142406 May 29, 2022
@drupol
Copy link
Collaborator

drupol commented Sep 7, 2023

I can build PHP without extensions:

image

but as soon as I enabled the tokenizer extension, it is failing with:

build log of php-tokenizer extensions
❯ nix build .#php-master -L
warning: Git tree '/home/devlin/Code/fossar/nix-phps' is dirty
php-tokenizer> unpacking sources
php-tokenizer> unpacking source archive /nix/store/asss0ai2qvpx4kzlc2c5kg3fx3m1fmws-source
php-tokenizer> source root is source
php-tokenizer> patching sources
php-tokenizer> applying patch /nix/store/xvdqq71cvvy7m084q5qznnn6cdp16yri-fix-tokenizer-php81.patch
php-tokenizer> patching file ext/tokenizer/Makefile.frag
php-tokenizer> cdToExtensionRootPhase
php-tokenizer> updateAutotoolsGnuConfigScriptsPhase
php-tokenizer> configuring
php-tokenizer> Configuring for:
php-tokenizer> PHP Api Version:         20230901
php-tokenizer> Zend Module Api No:      20230901
php-tokenizer> Zend Extension Api No:   420230901
php-tokenizer> fixing libtool script ./build/ltmain.sh
php-tokenizer> configure flags: --disable-static --prefix=/nix/store/0ai6rgpn5pmfs594hgi2mc7jk1c7bsl4-php-tokenizer-8.4.0.pre+date=20230907122631 --bindir=/nix/store/0ai6rgpn5pmfs594hgi2mc7jk1c7bsl4-php-tokenizer-8.4.0.pre+date=20230907122631/bin --sbindir=/nix/store/0ai6rgpn5pmfs594hgi2mc7jk1c7bsl4-php-tokenizer-8.4.0.pre+date=20230907122631/sbin --includedir=/nix/store/hwmig48l39zyx4s726y0ng5rkc5pvfw8-php-tokenizer-8.4.0.pre+date=20230907122631-dev/include --oldincludedir=/nix/store/hwmig48l39zyx4s726y0ng5rkc5pvfw8-php-tokenizer-8.4.0.pre+date=20230907122631-dev/include --mandir=/nix/store/0ai6rgpn5pmfs594hgi2mc7jk1c7bsl4-php-tokenizer-8.4.0.pre+date=20230907122631/share/man --infodir=/nix/store/0ai6rgpn5pmfs594hgi2mc7jk1c7bsl4-php-tokenizer-8.4.0.pre+date=20230907122631/share/info --docdir=/nix/store/0ai6rgpn5pmfs594hgi2mc7jk1c7bsl4-php-tokenizer-8.4.0.pre+date=20230907122631/share/doc/php-tokenizer --libdir=/nix/store/0ai6rgpn5pmfs594hgi2mc7jk1c7bsl4-php-tokenizer-8.4.0.pre+date=20230907122631/lib --libexecdir=/nix/store/0ai6rgpn5pmfs594hgi2mc7jk1c7bsl4-php-tokenizer-8.4.0.pre+date=20230907122631/libexec --localedir=/nix/store/0ai6rgpn5pmfs594hgi2mc7jk1c7bsl4-php-tokenizer-8.4.0.pre+date=20230907122631/share/locale --enable-tokenizer
php-tokenizer> checking for grep that handles long lines and -e... /nix/store/d2kvfr3r06rf5zdzsw7ayzj8lkpxh2lx-gnugrep-3.11/bin/grep
php-tokenizer> checking for egrep... /nix/store/d2kvfr3r06rf5zdzsw7ayzj8lkpxh2lx-gnugrep-3.11/bin/grep -E
php-tokenizer> checking for a sed that does not truncate output... /nix/store/q8afk7kyb85c0n2h3v0mphnjmdqyj49q-gnused-4.9/bin/sed
php-tokenizer> checking pkg-config is at least version 0.9.0... yes
php-tokenizer> checking whether the C compiler works... yes
php-tokenizer> checking for C compiler default output file name... a.out
php-tokenizer> checking for suffix of executables...
php-tokenizer> checking whether we are cross compiling... no
php-tokenizer> checking for suffix of object files... o
php-tokenizer> checking whether the compiler supports GNU C... yes
php-tokenizer> checking whether gcc accepts -g... yes
php-tokenizer> checking for gcc option to enable C11 features... none needed
php-tokenizer> checking how to run the C preprocessor... gcc -E
php-tokenizer> checking for icc... no
php-tokenizer> checking for suncc... no
php-tokenizer> checking for system library directory... lib
php-tokenizer> checking if compiler supports -Wl,-rpath,... yes
php-tokenizer> checking build system type... x86_64-pc-linux-gnu
php-tokenizer> checking host system type... x86_64-pc-linux-gnu
php-tokenizer> checking target system type... x86_64-pc-linux-gnu
php-tokenizer> checking for PHP prefix... /nix/store/s76z3w84jxvvb5n1k6j1wydvqa0sfqm0-php-8.4.0.pre+date=20230907122631
php-tokenizer> checking for PHP includes... -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/main -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/TSRM -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/Zend -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/ext -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/ext/date/lib
php-tokenizer> checking for PHP extension directory... /nix/store/s76z3w84jxvvb5n1k6j1wydvqa0sfqm0-php-8.4.0.pre+date=20230907122631/lib/php/extensions
php-tokenizer> checking for PHP installed headers prefix... /nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php
php-tokenizer> checking if debug is enabled... no
php-tokenizer> checking if zts is enabled... no
php-tokenizer> checking for gawk... gawk
php-tokenizer> checking for bison... bison
php-tokenizer> checking for bison version... 3.8.2 (ok)
php-tokenizer> checking for re2c... re2c
php-tokenizer> checking for re2c version... 3.1 (ok)
php-tokenizer> checking whether to enable tokenizer support... yes, shared
php-tokenizer> checking for a sed that does not truncate output... /nix/store/q8afk7kyb85c0n2h3v0mphnjmdqyj49q-gnused-4.9/bin/sed
php-tokenizer> checking for ld used by gcc... ld
php-tokenizer> checking if the linker (ld) is GNU ld... yes
php-tokenizer> checking for ld option to reload object files... -r
php-tokenizer> checking for BSD-compatible nm... nm
php-tokenizer> checking whether ln -s works... yes
php-tokenizer> checking how to recognize dependent libraries... (cached) pass_all
php-tokenizer> ./configure: line 5597: /usr/bin/file: No such file or directory
php-tokenizer> checking for stdio.h... yes
php-tokenizer> checking for stdlib.h... yes
php-tokenizer> checking for string.h... yes
php-tokenizer> checking for inttypes.h... yes
php-tokenizer> checking for stdint.h... yes
php-tokenizer> checking for strings.h... yes
php-tokenizer> checking for sys/stat.h... yes
php-tokenizer> checking for sys/types.h... yes
php-tokenizer> checking for unistd.h... yes
php-tokenizer> checking for dlfcn.h... yes
php-tokenizer> checking the maximum length of command line arguments... 1572864
php-tokenizer> checking command to parse nm output from gcc object... ok
php-tokenizer> checking for objdir... .libs
php-tokenizer> checking for ar... ar
php-tokenizer> checking for ranlib... ranlib
php-tokenizer> checking for strip... strip
php-tokenizer> checking if gcc supports -fno-rtti -fno-exceptions... no
php-tokenizer> checking for gcc option to produce PIC... -fPIC
php-tokenizer> checking if gcc PIC flag -fPIC works... yes
php-tokenizer> checking if gcc static flag -static works... no
php-tokenizer> checking if gcc supports -c -o file.o... yes
php-tokenizer> checking whether the gcc linker (ld) supports shared libraries... yes
php-tokenizer> checking whether -lc should be explicitly linked in... no
php-tokenizer> checking dynamic linker characteristics... GNU/Linux ld.so
php-tokenizer> checking how to hardcode library paths into programs... immediate
php-tokenizer> checking whether stripping libraries is possible... yes
php-tokenizer> checking if libtool supports shared libraries... yes
php-tokenizer> checking whether to build shared libraries... yes
php-tokenizer> checking whether to build static libraries... no
php-tokenizer> creating libtool
php-tokenizer> appending configuration tag "CXX" to libtool
php-tokenizer> checking whether the g++ linker (ld) supports shared libraries... yes
php-tokenizer> checking for g++ option to produce PIC...
php-tokenizer> checking if g++ static flag  works... yes
php-tokenizer> checking if g++ supports -c -o file.o... yes
php-tokenizer> checking whether the g++ linker (ld) supports shared libraries... yes
php-tokenizer> checking dynamic linker characteristics... GNU/Linux ld.so
php-tokenizer> (cached) (cached) checking how to hardcode library paths into programs... unsupported
php-tokenizer> configure: patching config.h.in
php-tokenizer> configure: creating ./config.status
php-tokenizer> config.status: creating config.h
php-tokenizer> building
php-tokenizer> build flags: -j8 SHELL=/nix/store/m36d29gn5gm9bk0g7fcln1v8171hvn95-bash-5.2-p15/bin/bash
php-tokenizer> bison -Wall /build/source/ext/tokenizer/../../Zend/zend_language_parser.y
php-tokenizer> /nix/store/m36d29gn5gm9bk0g7fcln1v8171hvn95-bash-5.2-p15/bin/bash /build/source/ext/tokenizer/libtool --mode=compile gcc -I. -I/build/source/ext/tokenizer -I/build/source/ext/tokenizer/include -I/build/source/ext/tokenizer/main -I/build/source/ext/tokenizer -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/main -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/TSRM -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/Zend -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/ext -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -D_GNU_SOURCE    -DZEND_COMPILE_DL_EXT=1 -c /build/source/ext/tokenizer/tokenizer_data.c -o tokenizer_data.lo  -MMD -MF tokenizer_data.dep -MT tokenizer_data.lo
php-tokenizer> lex  -t /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l > /build/source/ext/tokenizer/../../Zend/zend_language_scanner.c
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:24: bad character: #
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:24: unknown error processing section 1
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:24: unknown error processing section 1
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:24: bad character: 0
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:25: bad character: #
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:25: unknown error processing section 1
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:25: unknown error processing section 1
...
...
...
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:3103: unknown error processing section 1
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:3103: bad character: }
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:3103: bad character: {
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:3109: bad character: }
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:3111: bad character: *
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:3111: bad character: /
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:3155: bad character: }
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:3156: premature EOF
php-tokenizer> make: *** [<builtin>: /build/source/ext/tokenizer/../../Zend/zend_language_scanner.c] Error 1
php-tokenizer> make: *** Waiting for unfinished jobs....
php-tokenizer> mkdir .libs
php-tokenizer>  gcc -I. -I/build/source/ext/tokenizer -I/build/source/ext/tokenizer/include -I/build/source/ext/tokenizer/main -I/build/source/ext/tokenizer -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/main -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/TSRM -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/Zend -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/ext -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -D_GNU_SOURCE -DZEND_COMPILE_DL_EXT=1 -c /build/source/ext/tokenizer/tokenizer_data.c -MMD -MF tokenizer_data.dep -MT tokenizer_data.lo  -fPIC -DPIC -o .libs/tokenizer_data.o
php-tokenizer> mv -f y.tab.c /build/source/ext/tokenizer/../../Zend/zend_language_parser.c
php-tokenizer> mv: cannot stat 'y.tab.c': No such file or directory
php-tokenizer> make: *** [<builtin>: /build/source/ext/tokenizer/../../Zend/zend_language_parser.c] Error 1
error: builder for '/nix/store/djh8xzscw2farjh6093i1np2hj5219j0-php-tokenizer-8.4.0.pre+date=20230907122631.drv' failed with exit code 2;
       last 10 log lines:
       > /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:3111: bad character: /
       > /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:3155: bad character: }
       > /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:3156: premature EOF
       > make: *** [<builtin>: /build/source/ext/tokenizer/../../Zend/zend_language_scanner.c] Error 1
       > make: *** Waiting for unfinished jobs....
       > mkdir .libs
       >  gcc -I. -I/build/source/ext/tokenizer -I/build/source/ext/tokenizer/include -I/build/source/ext/tokenizer/main -I/build/source/ext/tokenizer -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/main -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/TSRM -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/Zend -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/ext -I/nix/store/r9dyjdvgs96plc9f7h3rwazrz5i6fzcy-php-8.4.0.pre+date=20230907122631-dev/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -D_GNU_SOURCE -DZEND_COMPILE_DL_EXT=1 -c /build/source/ext/tokenizer/tokenizer_data.c -MMD -MF tokenizer_data.dep -MT tokenizer_data.lo  -fPIC -DPIC -o .libs/tokenizer_data.o
       > mv -f y.tab.c /build/source/ext/tokenizer/../../Zend/zend_language_parser.c
       > mv: cannot stat 'y.tab.c': No such file or directory
       > make: *** [<builtin>: /build/source/ext/tokenizer/../../Zend/zend_language_parser.c] Error 1
       For full logs, run 'nix log /nix/store/djh8xzscw2farjh6093i1np2hj5219j0-php-tokenizer-8.4.0.pre+date=20230907122631.drv'.
error: 1 dependencies of derivation '/nix/store/sxqxg8hyylidb29ccdf4gjrilmmx0rly-php-extra-init-8.4.0.pre+date=20230907122631.ini.drv' failed to build
error: 1 dependencies of derivation '/nix/store/b7qx3sh29nl8adhm6rn6vfa7jd7wjlq5-php-with-extensions-8.4.0.pre+date=20230907122631.drv' failed to build
~/C/f/nix-phps > php-master +6 -6 [!>] ✘ 

@drupol drupol changed the title php-master: init at 8.2.0.pre+date=20220529142406 php-master: init at 8.4.0.pre+date=20230907122631 Sep 7, 2023
@drupol
Copy link
Collaborator

drupol commented Sep 7, 2023

I think this might be due to

php-tokenizer> yacc  /build/source/ext/tokenizer/../../Zend/zend_language_parser.y

notice the empty space after $(YACC). For some reason YFLAGS are not set here:

https://github.com/php/php-src/blob/9e74e58bcf7e31aef563f1ee00b7f0bc17fe3ef2/Zend/Makefile.frag#L16

This is probably the same reason PDO fails:

php-pdo> /nix/store/30j23057fqnnc1p4jqmq73p0gxgn0frq-bash-5.1-p16/bin/bash: line 3: --no-generation-date: command not found

$(RE2C) and $(RE2C_FLAGS) are empty here:

https://github.com/php/php-src/blob/9e74e58bcf7e31aef563f1ee00b7f0bc17fe3ef2/ext/pdo/Makefile.frag#L12

I've checked the Makefile of the tokenizer extension and YFLAGS, YACC and RE2C variables are set.

image

I've compared the zend_language_scanner.l in both versions and they are less-or-more the same. The first failure:

php-tokenizer> lex  -t /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l > /build/source/ext/tokenizer/../../Zend/zend_language_scanner.c
php-tokenizer> /build/source/ext/tokenizer/../../Zend/zend_language_scanner.l:24: bad character: #

correspond to this line:

#if 0

Another thing that I've notice during my research is that when compiling tokenizer with PHP 8.2.9 (which is building fine), the Makefile is not in the extension directory.

image

At this point, we are blocked, I don't know what I could do to get this working. Do you have any clue?

@drupol drupol force-pushed the php-master branch 3 times, most recently from ff129ac to 62010d7 Compare September 8, 2023 05:33
@drupol drupol marked this pull request as ready for review September 8, 2023 05:33
@drupol drupol force-pushed the php-master branch 2 times, most recently from 3e6c133 to 7b17864 Compare September 8, 2023 06:25
@drupol drupol changed the title php-master: init at 8.4.0.pre+date=20230907122631 php-master: init at 8.4.0.snapshot.20230907122631 Sep 8, 2023
@drupol drupol changed the title php-master: init at 8.4.0.snapshot.20230907122631 php-master: init at php-8.4.0.snapshot.c803402-20230907122631 Sep 8, 2023
@drupol
Copy link
Collaborator

drupol commented Sep 8, 2023

The solution to this PR was the script genfiles that wasn't run properly.

This PR fix it: NixOS/nixpkgs#254001, follow it at https://nixpk.gs/pr-tracker.html?pr=254001

@drupol drupol force-pushed the php-master branch 7 times, most recently from cd68108 to 764970c Compare September 8, 2023 18:02
Co-Authored-By: Pol Dellaiera <pol.dellaiera@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question - Building php master branch from source?
2 participants