jart / cosmopolitan

build-once run-anywhere c library
ISC License
18.08k stars 619 forks source link

Compile PHP #115

Open diyism opened 3 years ago

diyism commented 3 years ago

We now have lua interpreter based on cosmopolition libc.(https://github.com/jart/cosmopolitan/issues/61)

How about a PHP interpreter based on cosmopolitian libc?

Anyone give a try? After all, PHP has richer functions as a web server language than Lua.

jart commented 3 years ago

PHP CLI can be done. If you're the one driving the effort, then I'll be here to support you. See #61 as a good example of how this kind of collaboration would work.

Note that #27 could be a blocker but that could easily be solved. In the PHP codebase there appears but one treacherous file that pulls in the Standard Template Library: ext/intl/msgformat/msgformat_helpers.cpp

weps-online commented 3 years ago

Hello justine, First off, thanks for the very good job on APE, Cosmopolitan and Redbean (among other things i guess). Would it be relevant to integrate such interpreters in redbean and make it evolve from static to dynamic ? Or is it going against your "philosophy" ?

diyism commented 3 years ago

Hello justine, First off, thanks for the very good job on APE, Cosmopolitan and Redbean (among other things i guess). Would it be relevant to integrate such interpreters in redbean and make it evolve from static to dynamic ? Or is it going against your "philosophy" ?

"cross-platform single package" is very cool, I think it's far more cool than golang/nodejs cross compilation, if we can make a "cross-platform single package" php web server(even only with "php-cli -S"), any user needs only download once, the php script/application could be released/updated through a global developers mesh matrix.

weps-online commented 3 years ago

I'm not technical enough to judge the feasibility of such project, but having an actually portable all in one (static/dynamic/database) seems to bring a world of possibilities to my mind (probably not the right place to talk about it though)

jart commented 3 years ago

My philosophy is to do the things I can do that'll make the users of this project happy.

alganet commented 3 years ago

Disclaimer: I have no idea what I'm doing.

I've followed some of the steps that were taken on #61 for the PHP repo.

The --disable-all flag should skip most of the language extensions (such as intl that contains the problematic file @jart mentioned in the first comment of the issue). This should make the build simpler.

The --without-pcre-jit turns off sljit which was causing a lot of errors.

Steps to get where I am:

$ git clone https://github.com/alganet/php-src
$ cd php-src
$ ./buildconf
$ ./configure \
    --host="x86_64-pc-linux"\
    --disable-all \
    --without-pcre-jit \
    --disable-cgi \
    --disable-ipv6 \
    CC="gcc" \
    CFLAGS="-Wextra -std=c99 -static -fno-pie -no-pie -mno-red-zone -nostdlib \
      -nostdinc -fno-omit-frame-pointer -pg -mnop-mcount \
      -I./include \
      -include ./cosmopolitan/cosmopolitan.h" \
    LDFLAGS="-static -nostdlib -nostdinc -fno-pie \
      -no-pie -mno-red-zone \
      -include ./cosmopolitan/cosmopolitan.h" \
    LIBS="\
      -Wl,--gc-sections -fuse-ld=bfd \
      -Wl,-T,./cosmopolitan/ape.lds \
      -include ./cosmopolitan/cosmopolitan.h \
      ./cosmopolitan/crt.o \
      ./cosmopolitan/ape.o \
      ./cosmopolitan/cosmopolitan.a "
$ make

At some point, I've stopped getting conflicts with standard C headers and I got this error related to netinet/tcp:

/php-src/main/php_network.h:27:11: fatal error: netinet/tcp.h: No such file or directory
   27 | # include <netinet/tcp.h>
      |           ^~~~~~~~~~~~~~~

I've stubbed the header for this one as well just to see if it keeps going, but this is probably a mistake.

The next few errors I can't make any sense of (no surprise, I don't know C). I've pasted the make output here (~240 lines): https://gist.github.com/alganet/54205098a254ca506f27f6a3221b68b2

All of these errors seems to be on /php-src/ext/hash/xxhash/xxhash.h. I noticed that the cosmopolitan repo have xxhash.[c|h] under third-party/lz4cli so I'm guessing it should be able to compile the one bundled with PHP, but I don't know what I'm missing.

jart commented 3 years ago

If you get tired of the build error include feedback cycle, then here's a command that'll immediately create a stub structure for all possible system includes:

for x in $(find /usr/include/ | cut -c 6-); do mkdir -p ${x%/*}; done
for x in $(find /usr/include/ | cut -c 6-); do touch $x; done

You can then add -nostdinc -include cosmopolitan.h -isystem include to your compiler flags, which is a good place to start. There will still likely be a lot more build toil along the way because PHP has a lot more dependencies than Lua which you'll likely want to turn off. This one's going to be harder. But it's something that can be done.

jart commented 3 years ago
php-src/include/../main/php_config.h:1976: warning: "SIZEOF_INT" redefined
 1976 | #define SIZEOF_INT 4

That oni is my mistake. Our limits.h file shouldn't be defining that. I'll update it in a few short moments and push a new amalgamation to the website for you.

php-src/ext/hash/xxhash/xxhash.h:3293:20: error: expected ‘;’ before ‘const’
 3293 |             __m128i const shifted     = _mm_srli_epi64    (acc_vec, 47);
      |                    ^~~~~~

Try to configure PHP to disable LZ4/xxhash if possible. This project won't support Intel's intrinsics API since it's nonstandard and unportable; we provide a faster better one for x86 instructions that's based on RMS notation with ANSI C fallbacks. Macros exist in this codebase for defining many of those functions but they're flagged internal and will hopefully be deleted at some point since GCC and Clang don't agree on how they should be veneered and the underlying compiler APIs change between versions.

alganet commented 3 years ago

@jart thanks!

It seems PHP 7.4+ can't be build without the hash extension, I'll try again soon with the 7.3 branch that has --disable-hash.

Meanwhile I'll try building something simpler with less dependencies, there is a lot I need to learn.

ahgamut commented 3 years ago

I tried compiling PHP 7.3.27 using the ./configure script @alganet provided above + --disabled-shared and --disable-hash.

I'll put up a Github fork sometime later.

Current status: source files compile, but linker error due to missing symbols.

/usr/bin/ld.bfd: ext/standard/dns.o: in function `php_gethostbyaddr':
dns.c:(.text+0x47a): undefined reference to `gethostbyaddr'
/usr/bin/ld.bfd: ext/standard/string.o: in function `php_strerror':
string.c:(.text+0x1dfcb): undefined reference to `sys_nerr'
/usr/bin/ld.bfd: string.c:(.text+0x1dfdc): undefined reference to `sys_errlist'
/usr/bin/ld.bfd: main/php_ini.o: in function `php_load_php_extension_cb':
php_ini.c:(.text+0xf1d): undefined reference to `php_load_extension'
/usr/bin/ld.bfd: main/php_ini.o: in function `php_load_zend_extension_cb':
php_ini.c:(.text+0x1036): undefined reference to `php_load_shlib'
/usr/bin/ld.bfd: php_ini.c:(.text+0x10c0): undefined reference to `php_load_shlib'
/usr/bin/ld.bfd: main/network.o: in function `php_network_gethostbyname':
network.c:(.text+0x2316): undefined reference to `gethostbyname'
/usr/bin/ld.bfd: main/streams/plain_wrapper.o: in function `php_plain_files_dirstream_rewind':
plain_wrapper.c:(.text+0x13b5): undefined reference to `rewinddir'
/usr/bin/ld.bfd: main/streams/plain_wrapper.o: in function `php_plain_files_metadata':
plain_wrapper.c:(.text+0x24ec): undefined reference to `VCWD_UTIME'
/usr/bin/ld.bfd: Zend/zend_virtual_cwd.o: in function `tsrm_realpath_r':
zend_virtual_cwd.c:(.text+0x108c): undefined reference to `php_sys_readlink'
collect2: error: ld returned 1 exit status
make: *** [Makefile:253: sapi/cli/php] Error 1

Here are some of the errors/fixes seen during compilation:

The below errors are likely related to how ./configure runs checks rather than Cosmopolitan:

A lot of warnings also appeared, but I am ignoring those for now:

jart commented 3 years ago

One trick you can use to undefine __SSE2__ is passing -mgeneral-regs-only to the compiler. Making the amalgamation header warnings agnostic is a known issue. I can delete the implicit fallthrough check for now until I can figure out the best way to resolve that one. The rest sound pretty straightforward. Except maybe strtok_r since we'd need to check the versions in _POSIX_C_SOURCE everywhere to be that strictly compatible, which doesn't make sense given the goals of the amalgamation header, and would therefore be better served using an existing set of posix headers from some other libc and retooling them slightly, since cosmopolitan is for the most part binary compatible.

ahgamut commented 3 years ago

-mgeneral-regs-only disables SSE (and some FPU stuff); PHP source complains. Adding -mno-sse2 and -mno-ssse3 avoids those errors. Added --without-valgrind to the configure script to avoid the #undef HAVE_VALGRIND . Added -Wno-implicit-fallthrough to the compilation flags; now mostly -Wsign-compare warnings.

ahgamut commented 3 years ago

https://github.com/ahgamut/php-src/tree/cosmo_php73 Clone the above repo, download the latest version of the Cosmopolitan amalgamation to the right subfolder, and run superconfigure. Note: Use the configure script in the repo, don't run autoconf again because AC_CHECK_FUNC doesn't play well when compiling with the amalgamation.

It compiles without error (throws warnings occasionally) and produces a php.com APE of size 3.4MB with all extensions disabled.

I have zero knowledge of PHP. I was able to run php.com -S 127.0.0.1:8000 with a local index.html.
Can someone try a more complex example? Note that php.com may not work on Windows right now because of the setsockopt/SO_REUSEADDR issue that I ran into in #141, but hopefully that will be fixed soon.

I was not able to run any tests because failed to initialize high-resolution timer ( related to sysconf(_SC_MONOTONIC_CLOCK) ) so I've commented out that line to let the APE run.

Changes made:

- disabled intrinsics in Zend/zend_portability.h instead of globally
- Makefile.global creates APE after compiling $(SAPI_CLI_PATH)
- most compilation based changes are switch(errno) -> if-else
- rewinddir is missing at linker level, commented that line out to
  enable compilation
- in ext/standard/hrtime.c sysconf(_SC_MONOTONIC_CLOCK) is missing,
  commented out return -1 in order to get the APE to run
diyism commented 3 years ago

I do these in debian:

git clone --depth 1 --recursive -b cosmo_php73 https://github.com/ahgamut/php-src/
wget -O /tmp/z.$$ https://justine.lol/cosmopolitan/cosmopolitan-amalgamation-1.0.zip && unzip -d ./php-src/libcosmo /tmp/z.$$ && rm -f /tmp/z.$$
cd php-src
./superconfigure

It spit out:

+ realpath ./libcosmo
+ COSMO_LIBDIR=/home/malcolm/WorkSpace/cosmo_php/php-src/libcosmo
+ realpath ./header_stubs
+ HEADER_PATHS=/home/malcolm/WorkSpace/cosmo_php/php-src/header_stubs
+ CC=gcc
+ [ ! -f /home/malcolm/WorkSpace/cosmo_php/php-src/libcosmo/cosmopolitan.h ]
+ echo <<<SUPERCONFIGURE>>> cosmopolitan.h exists in /home/malcolm/WorkSpace/cosmo_php/php-src/libcosmo, assuming other files exist as well
<<<SUPERCONFIGURE>>> cosmopolitan.h exists in /home/malcolm/WorkSpace/cosmo_php/php-src/libcosmo, assuming other files exist as well
+ echo <<<SUPERCONFIGURE>>> Running configure with gcc
<<<SUPERCONFIGURE>>> Running configure with gcc
+ LD_LIBRARY_PATH= ./configure --enable-shared=no --enable-static=yes --disable-ipv6 ...
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."

What's wrong with me? @ahgamut

ahgamut commented 3 years ago

I think install-sh is generated by buildconf (and is gitignored), but it's an empty file.

Option a): create a dummy file called install-sh in the root directory. and then run superconfigure.

Option b): run ./buildconf --force like in the below bash snippet


git clone --depth 1 --recursive -b cosmo_php73 https://github.com/ahgamut/php-src/
wget -O /tmp/z.$$ https://justine.lol/cosmopolitan/cosmopolitan.zip && unzip -d ./php-src/libcosmo /tmp/z.$$ && rm -f /tmp/z.$$
cd php-src

# new step before superconfigure
./buildconf --force
# if ./configure has been overwritten, undo that
git checkout -- ./configure

./superconfigure

Option c): I updated the superconfigure script in the repo to perform the above step.

Note: The cosmopolitan-amalgamation-1.0.zip may not have all the necessary features. Use https://justine.lol/cosmopolitan/cosmopolitan.zip, or the latest version of Cosmopolitan compiled from source.

diyism commented 3 years ago

Amazing, great thanks to @ahgamut and @jart

In debian/kali:

git clone --depth 1 --recursive -b cosmo_php73 https://github.com/ahgamut/php-src/
wget -O /tmp/z.$$ https://justine.lol/cosmopolitan/cosmopolitan.zip && unzip -d ./php-src/libcosmo /tmp/z.$$ && rm -f /tmp/z.$$
cd php-src
./buildconf --force
./superconfigure
sudo sh -c "echo ':APE:M::MZqFpD::/bin/sh:' >/proc/sys/fs/binfmt_misc/register"
./php.com -r "echo 'hello';"

Now we have a "single-package-cross-platform" php7.3 cli (and it's only 3.6MB)

kk6mrp commented 3 years ago

I haven't tested this out but how difficult would it be to make it work with the SQLite3 class? https://www.php.net/manual/en/book.sqlite3.php

hooby404 commented 5 months ago

total c/make/configure noob here, so big sorry for the probably stupid question in advance...

but when I run ./superconfigure (on regular Linux Mint, in a subfolder of my users home directory) I get the following:

...
LD_LIBRARY_PATH= ./configure --enable-shared=no --enable-static=yes --with-pic=no --disable-ipv6 --without-pear --without-pcre-jit --disable-all --without-valgrind --disable-hash --disable-phpdbg-debug --disable-debug --enable-filter --enable-exif --enable-ftp --enable-cgi --with-zlib-dir=./ CFLAGS=-Os     -Wall -Wno-implicit-fallthrough     -Wno-strict-prototypes -Wno-unused-value     -std=c99 -static     -fno-pie -no-pie     -fno-omit-frame-pointer     -ffunction-sections -fdata-sections     -mno-red-zone -pg     -nostdinc -nostdlib     -I/home/hooby/work/php-src/header_stubs     -include /home/hooby/work/php-src/libcosmo/cosmopolitan.h LDFLAGS=-static -nostdlib -nostdinc     -fno-pie -no-pie -mno-red-zone     -include /home/hooby/work/php-src/libcosmo/cosmopolitan.h LIBS=    -Wl,--gc-sections -fuse-ld=bfd     -Wl,-T,/home/hooby/work/php-src/libcosmo/ape.lds     -include /home/hooby/work/php-src/libcosmo/cosmopolitan.h     /home/hooby/work/php-src/libcosmo/crt.o     /home/hooby/work/php-src/libcosmo/ape.o     /home/hooby/work/php-src/libcosmo/cosmopolitan.a
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/home/hooby/work/php-src':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

and config.log ends in:

configure: exit 77

which stack overflow wants to tell me is most likely due to a permission problem - specifically a +x flag missing somewhere?

cc is actually gcc-11 - not sure if that helps... and I only want to build php-cli - no need for php-cgi

hooby404 commented 5 months ago

so, I did mange to disable that check... by modifying ./configure line 4041+

$as_echo "$ac_try_echo"; } >&5
  #(eval "$ac_try") 2>&5
  ac_status=0

but now I get

checking for crypt_r... yes
checking which data struct is used by crypt_r... none
configure: error: Unable to detect data struct used by crypt_r

disabled that check as well, by hacking ./configure to always set php_cv_crypt_r_style=struct_crypt_data_gnu_source

then I got Cannot find zlib - so I did sudo apt install zlib1g-dev

and now make -j4 fails with

<<<SUPERCONFIGURE>>> Running make
+ make -j4
/bin/bash /home/hooby/work/php-src/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/date/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1 -Iext/date/ -I/home/hooby/work/php-src/ext/date/ -DPHP_ATOM_INC -I/home/hooby/work/php-src/include -I/home/hooby/work/php-src/main -I/home/hooby/work/php-src -I/home/hooby/work/php-src/ext/date/lib -I/home/hooby/work/php-src/TSRM -I/home/hooby/work/php-src/Zend    -Os -Wall -Wno-implicit-fallthrough -Wno-strict-prototypes -Wno-unused-value -std=c99 -static -fno-pie -no-pie -fno-omit-frame-pointer -ffunction-sections -fdata-sections -mno-red-zone -pg -nostdinc -nostdlib -I/home/hooby/work/php-src/header_stubs -include /home/hooby/work/php-src/libcosmo/cosmopolitan.h   -c /home/hooby/work/php-src/ext/date/php_date.c -o ext/date/php_date.lo 
/bin/bash /home/hooby/work/php-src/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/date/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1 -Iext/date/ -I/home/hooby/work/php-src/ext/date/ -DPHP_ATOM_INC -I/home/hooby/work/php-src/include -I/home/hooby/work/php-src/main -I/home/hooby/work/php-src -I/home/hooby/work/php-src/ext/date/lib -I/home/hooby/work/php-src/TSRM -I/home/hooby/work/php-src/Zend    -Os -Wall -Wno-implicit-fallthrough -Wno-strict-prototypes -Wno-unused-value -std=c99 -static -fno-pie -no-pie -fno-omit-frame-pointer -ffunction-sections -fdata-sections -mno-red-zone -pg -nostdinc -nostdlib -I/home/hooby/work/php-src/header_stubs -include /home/hooby/work/php-src/libcosmo/cosmopolitan.h   -c /home/hooby/work/php-src/ext/date/lib/astro.c -o ext/date/lib/astro.lo 
/bin/bash /home/hooby/work/php-src/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/date/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1 -Iext/date/ -I/home/hooby/work/php-src/ext/date/ -DPHP_ATOM_INC -I/home/hooby/work/php-src/include -I/home/hooby/work/php-src/main -I/home/hooby/work/php-src -I/home/hooby/work/php-src/ext/date/lib -I/home/hooby/work/php-src/TSRM -I/home/hooby/work/php-src/Zend    -Os -Wall -Wno-implicit-fallthrough -Wno-strict-prototypes -Wno-unused-value -std=c99 -static -fno-pie -no-pie -fno-omit-frame-pointer -ffunction-sections -fdata-sections -mno-red-zone -pg -nostdinc -nostdlib -I/home/hooby/work/php-src/header_stubs -include /home/hooby/work/php-src/libcosmo/cosmopolitan.h   -c /home/hooby/work/php-src/ext/date/lib/dow.c -o ext/date/lib/dow.lo 
/bin/bash /home/hooby/work/php-src/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/date/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1 -Iext/date/ -I/home/hooby/work/php-src/ext/date/ -DPHP_ATOM_INC -I/home/hooby/work/php-src/include -I/home/hooby/work/php-src/main -I/home/hooby/work/php-src -I/home/hooby/work/php-src/ext/date/lib -I/home/hooby/work/php-src/TSRM -I/home/hooby/work/php-src/Zend    -Os -Wall -Wno-implicit-fallthrough -Wno-strict-prototypes -Wno-unused-value -std=c99 -static -fno-pie -no-pie -fno-omit-frame-pointer -ffunction-sections -fdata-sections -mno-red-zone -pg -nostdinc -nostdlib -I/home/hooby/work/php-src/header_stubs -include /home/hooby/work/php-src/libcosmo/cosmopolitan.h   -c /home/hooby/work/php-src/ext/date/lib/parse_date.c -o ext/date/lib/parse_date.lo 
In file included from <command-line>:
/home/hooby/work/php-src/libcosmo/cosmopolitan.h:4055:9: note: ‘#pragma message: checked integer arithmetic unsupported in this environment’
 4055 | #pragma message "checked integer arithmetic unsupported in this environment"
      |         ^~~~~~~
In file included from <command-line>:
/home/hooby/work/php-src/libcosmo/cosmopolitan.h:4055:9: note: ‘#pragma message: checked integer arithmetic unsupported in this environment’
 4055 | #pragma message "checked integer arithmetic unsupported in this environment"
      |         ^~~~~~~
In file included from <command-line>:
/home/hooby/work/php-src/libcosmo/cosmopolitan.h:4055:9: note: ‘#pragma message: checked integer arithmetic unsupported in this environment’
 4055 | #pragma message "checked integer arithmetic unsupported in this environment"
      |         ^~~~~~~
In file included from <command-line>:
/home/hooby/work/php-src/libcosmo/cosmopolitan.h:4055:9: note: ‘#pragma message: checked integer arithmetic unsupported in this environment’
 4055 | #pragma message "checked integer arithmetic unsupported in this environment"
      |         ^~~~~~~
In file included from /home/hooby/work/php-src/Zend/zend_range_check.h:22,
                 from /home/hooby/work/php-src/Zend/zend_portability.h:77,
                 from /home/hooby/work/php-src/Zend/zend_types.h:25,
                 from /home/hooby/work/php-src/Zend/zend.h:27,
                 from /home/hooby/work/php-src/ext/date/lib/timelib_config.h:9,
                 from /home/hooby/work/php-src/ext/date/lib/timelib.h:30,
                 from /home/hooby/work/php-src/ext/date/lib/astro.c:29:
/home/hooby/work/php-src/Zend/zend_long.h:126:3: error: #error "Unknown SIZEOF_SIZE_T"
  126 | # error "Unknown SIZEOF_SIZE_T"
      |   ^~~~~
In file included from /home/hooby/work/php-src/Zend/zend_range_check.h:22,
                 from /home/hooby/work/php-src/Zend/zend_portability.h:77,
                 from /home/hooby/work/php-src/Zend/zend_types.h:25,
                 from /home/hooby/work/php-src/Zend/zend.h:27,
                 from /home/hooby/work/php-src/ext/date/lib/timelib_config.h:9,
                 from /home/hooby/work/php-src/ext/date/lib/timelib.h:30,
                 from parse_date.re:26:
/home/hooby/work/php-src/Zend/zend_long.h:126:3: error: #error "Unknown SIZEOF_SIZE_T"
  126 | # error "Unknown SIZEOF_SIZE_T"
      |   ^~~~~
In file included from /home/hooby/work/php-src/Zend/zend_range_check.h:22,
                 from /home/hooby/work/php-src/Zend/zend_portability.h:77,
                 from /home/hooby/work/php-src/Zend/zend_types.h:25,
                 from /home/hooby/work/php-src/Zend/zend.h:27,
                 from /home/hooby/work/php-src/main/php.h:33,
                 from /home/hooby/work/php-src/ext/date/php_date.c:19:
/home/hooby/work/php-src/Zend/zend_long.h:126:3: error: #error "Unknown SIZEOF_SIZE_T"
  126 | # error "Unknown SIZEOF_SIZE_T"
      |   ^~~~~
In file included from /home/hooby/work/php-src/Zend/zend.h:27,
                 from /home/hooby/work/php-src/ext/date/lib/timelib_config.h:9,
                 from /home/hooby/work/php-src/ext/date/lib/timelib.h:30,
                 from parse_date.re:26:
/home/hooby/work/php-src/Zend/zend_types.h:296:3: error: #error "Unknown SIZEOF_SIZE_T"
  296 | # error "Unknown SIZEOF_SIZE_T"
      |   ^~~~~
In file included from /home/hooby/work/php-src/Zend/zend.h:27,
                 from /home/hooby/work/php-src/ext/date/lib/timelib_config.h:9,
                 from /home/hooby/work/php-src/ext/date/lib/timelib.h:30,
                 from /home/hooby/work/php-src/ext/date/lib/astro.c:29:
/home/hooby/work/php-src/Zend/zend_types.h:296:3: error: #error "Unknown SIZEOF_SIZE_T"
  296 | # error "Unknown SIZEOF_SIZE_T"
      |   ^~~~~
In file included from /home/hooby/work/php-src/Zend/zend.h:27,
                 from /home/hooby/work/php-src/main/php.h:33,
                 from /home/hooby/work/php-src/ext/date/php_date.c:19:
/home/hooby/work/php-src/Zend/zend_types.h:296:3: error: #error "Unknown SIZEOF_SIZE_T"
  296 | # error "Unknown SIZEOF_SIZE_T"
      |   ^~~~~
In file included from /home/hooby/work/php-src/Zend/zend_range_check.h:22,
                 from /home/hooby/work/php-src/Zend/zend_portability.h:77,
                 from /home/hooby/work/php-src/Zend/zend_types.h:25,
                 from /home/hooby/work/php-src/Zend/zend.h:27,
                 from /home/hooby/work/php-src/ext/date/lib/timelib_config.h:9,
                 from /home/hooby/work/php-src/ext/date/lib/timelib.h:30,
                 from /home/hooby/work/php-src/ext/date/lib/dow.c:25:
/home/hooby/work/php-src/Zend/zend_long.h:126:3: error: #error "Unknown SIZEOF_SIZE_T"
  126 | # error "Unknown SIZEOF_SIZE_T"
      |   ^~~~~
In file included from /home/hooby/work/php-src/Zend/zend.h:27,
                 from /home/hooby/work/php-src/ext/date/lib/timelib_config.h:9,
                 from /home/hooby/work/php-src/ext/date/lib/timelib.h:30,
                 from /home/hooby/work/php-src/ext/date/lib/astro.c:29:
/home/hooby/work/php-src/Zend/zend_types.h:1048:3: error: #error "Unknown SIZEOF_SIZE_T"
 1048 | # error "Unknown SIZEOF_SIZE_T"
      |   ^~~~~
In file included from /home/hooby/work/php-src/Zend/zend.h:27,
                 from /home/hooby/work/php-src/ext/date/lib/timelib_config.h:9,
                 from /home/hooby/work/php-src/ext/date/lib/timelib.h:30,
                 from parse_date.re:26:
/home/hooby/work/php-src/Zend/zend_types.h:1048:3: error: #error "Unknown SIZEOF_SIZE_T"
 1048 | # error "Unknown SIZEOF_SIZE_T"
      |   ^~~~~
In file included from /home/hooby/work/php-src/Zend/zend.h:27,
                 from /home/hooby/work/php-src/main/php.h:33,
                 from /home/hooby/work/php-src/ext/date/php_date.c:19:
/home/hooby/work/php-src/Zend/zend_types.h:1048:3: error: #error "Unknown SIZEOF_SIZE_T"
 1048 | # error "Unknown SIZEOF_SIZE_T"
      |   ^~~~~
In file included from /home/hooby/work/php-src/Zend/zend.h:27,
                 from /home/hooby/work/php-src/ext/date/lib/timelib_config.h:9,
                 from /home/hooby/work/php-src/ext/date/lib/timelib.h:30,
                 from /home/hooby/work/php-src/ext/date/lib/dow.c:25:
/home/hooby/work/php-src/Zend/zend_types.h:296:3: error: #error "Unknown SIZEOF_SIZE_T"
  296 | # error "Unknown SIZEOF_SIZE_T"
      |   ^~~~~
In file included from /home/hooby/work/php-src/Zend/zend.h:27,
                 from /home/hooby/work/php-src/ext/date/lib/timelib_config.h:9,
                 from /home/hooby/work/php-src/ext/date/lib/timelib.h:30,
                 from /home/hooby/work/php-src/ext/date/lib/dow.c:25:
/home/hooby/work/php-src/Zend/zend_types.h:1048:3: error: #error "Unknown SIZEOF_SIZE_T"
 1048 | # error "Unknown SIZEOF_SIZE_T"
      |   ^~~~~
/home/hooby/work/php-src/Zend/zend_hash.h: In function ‘_zend_hash_append_ex’:
/home/hooby/work/php-src/Zend/zend_hash.h: In function ‘_zend_hash_append_ex’:
/home/hooby/work/php-src/Zend/zend_types.h:1057:17: warning: implicit declaration of function ‘ZVAL_COPY_VALUE_EX’; did you mean ‘ZVAL_COPY_VALUE’? [-Wimplicit-function-declaration]
 1057 |                 ZVAL_COPY_VALUE_EX(_z1, _z2, _gc, _t);                  \
      |                 ^~~~~~~~~~~~~~~~~~
/home/hooby/work/php-src/Zend/zend_hash.h:1080:9: note: in expansion of macro ‘ZVAL_COPY_VALUE’
 1080 |         ZVAL_COPY_VALUE(&p->val, zv);
      |         ^~~~~~~~~~~~~~~
/home/hooby/work/php-src/Zend/zend_types.h:1057:17: warning: implicit declaration of function ‘ZVAL_COPY_VALUE_EX’; did you mean ‘ZVAL_COPY_VALUE’? [-Wimplicit-function-declaration]
 1057 |                 ZVAL_COPY_VALUE_EX(_z1, _z2, _gc, _t);                  \
      |                 ^~~~~~~~~~~~~~~~~~
/home/hooby/work/php-src/Zend/zend_hash.h:1080:9: note: in expansion of macro ‘ZVAL_COPY_VALUE’
 1080 |         ZVAL_COPY_VALUE(&p->val, zv);
      |         ^~~~~~~~~~~~~~~
/home/hooby/work/php-src/Zend/zend_hash.h: In function ‘_zend_hash_append_ex’:
/home/hooby/work/php-src/Zend/zend_types.h:1057:17: warning: implicit declaration of function ‘ZVAL_COPY_VALUE_EX’; did you mean ‘ZVAL_COPY_VALUE’? [-Wimplicit-function-declaration]
 1057 |                 ZVAL_COPY_VALUE_EX(_z1, _z2, _gc, _t);                  \
      |                 ^~~~~~~~~~~~~~~~~~
/home/hooby/work/php-src/Zend/zend_hash.h:1080:9: note: in expansion of macro ‘ZVAL_COPY_VALUE’
 1080 |         ZVAL_COPY_VALUE(&p->val, zv);
      |         ^~~~~~~~~~~~~~~
/home/hooby/work/php-src/Zend/zend_hash.h: In function ‘_zend_hash_append_ex’:
/home/hooby/work/php-src/Zend/zend_types.h:1057:17: warning: implicit declaration of function ‘ZVAL_COPY_VALUE_EX’; did you mean ‘ZVAL_COPY_VALUE’? [-Wimplicit-function-declaration]
 1057 |                 ZVAL_COPY_VALUE_EX(_z1, _z2, _gc, _t);                  \
      |                 ^~~~~~~~~~~~~~~~~~
/home/hooby/work/php-src/Zend/zend_hash.h:1080:9: note: in expansion of macro ‘ZVAL_COPY_VALUE’
 1080 |         ZVAL_COPY_VALUE(&p->val, zv);
      |         ^~~~~~~~~~~~~~~
In file included from /home/hooby/work/php-src/Zend/zend.h:32,
                 from /home/hooby/work/php-src/main/php.h:33,
                 from /home/hooby/work/php-src/ext/date/php_date.c:19:
/home/hooby/work/php-src/Zend/zend_hash.h:1090:31: warning: implicit declaration of function ‘HT_IDX_TO_HASH’; did you mean ‘HT_SIZE_TO_MASK’? [-Wimplicit-function-declaration]
 1090 |         HT_HASH(ht, nIndex) = HT_IDX_TO_HASH(idx);
      |                               ^~~~~~~~~~~~~~
      |                               HT_SIZE_TO_MASK
In file included from /home/hooby/work/php-src/Zend/zend.h:32,
                 from /home/hooby/work/php-src/ext/date/lib/timelib_config.h:9,
                 from /home/hooby/work/php-src/ext/date/lib/timelib.h:30,
                 from /home/hooby/work/php-src/ext/date/lib/astro.c:29:
/home/hooby/work/php-src/Zend/zend_hash.h:1090:31: warning: implicit declaration of function ‘HT_IDX_TO_HASH’; did you mean ‘HT_SIZE_TO_MASK’? [-Wimplicit-function-declaration]
 1090 |         HT_HASH(ht, nIndex) = HT_IDX_TO_HASH(idx);
      |                               ^~~~~~~~~~~~~~
      |                               HT_SIZE_TO_MASK
In file included from /home/hooby/work/php-src/Zend/zend.h:32,
                 from /home/hooby/work/php-src/ext/date/lib/timelib_config.h:9,
                 from /home/hooby/work/php-src/ext/date/lib/timelib.h:30,
                 from parse_date.re:26:
/home/hooby/work/php-src/Zend/zend_hash.h:1090:31: warning: implicit declaration of function ‘HT_IDX_TO_HASH’; did you mean ‘HT_SIZE_TO_MASK’? [-Wimplicit-function-declaration]
 1090 |         HT_HASH(ht, nIndex) = HT_IDX_TO_HASH(idx);
      |                               ^~~~~~~~~~~~~~
      |                               HT_SIZE_TO_MASK
In file included from /home/hooby/work/php-src/Zend/zend.h:32,
                 from /home/hooby/work/php-src/ext/date/lib/timelib_config.h:9,
                 from /home/hooby/work/php-src/ext/date/lib/timelib.h:30,
                 from /home/hooby/work/php-src/ext/date/lib/dow.c:25:
/home/hooby/work/php-src/Zend/zend_hash.h:1090:31: warning: implicit declaration of function ‘HT_IDX_TO_HASH’; did you mean ‘HT_SIZE_TO_MASK’? [-Wimplicit-function-declaration]
 1090 |         HT_HASH(ht, nIndex) = HT_IDX_TO_HASH(idx);
      |                               ^~~~~~~~~~~~~~
      |                               HT_SIZE_TO_MASK
make: *** [Makefile:475: ext/date/lib/astro.lo] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Makefile:477: ext/date/lib/dow.lo] Error 1
make: *** [Makefile:473: ext/date/php_date.lo] Error 1
make: *** [Makefile:479: ext/date/lib/parse_date.lo] Error 1

I guess this is going over my head T_T

ahgamut commented 5 months ago

@hooby404 I haven't used the https://github.com/ahgamut/php-src/tree/cosmo_php73 fork in a while now, but I got a minimal build of php building in https://github.com/ahgamut/superconfigure/releases/download/z0.0.37/lang.zip which also includes lua, janet, and berry

hooby404 commented 5 months ago

thanks, I'll try that then!