[php-src] Issue #19152: php_glob.c interferes with build targets
| From: | Lewiscowles1986 | Date: | Wed, 16 Jul 2025 22:15:15 +0000 |
| Subject: | [php-src] Issue #19152: php_glob.c interferes with build targets | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250444@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/19152
Author: Lewiscowles1986
### Description
The following code:
main/php_glob.c ported from WIN32 to all build targets temporarily in #18164
causes an error when building php wasm
```
docker buildx bake --set default.args.PHP_VERSION=8.5.0alpha1
```
using https://github.com/derickr/php-wasm-builder
Resulted in this output:
```
32.04 /local/src/php-src/main/php_glob.c:207:1: error: static declaration of
'reallocarray' follows non-static declaration
32.04 207 | reallocarray(void *optr, size_t nmemb, size_t size)
32.04 | ^
32.04 /local/src/emsdk/upstream/emscripten/cache/sysroot/include/stdlib.h:150:7: note: previous
declaration is here
32.04 150 | void *reallocarray (void *, size_t, size_t);
32.04 | ^
32.04 1 error generated.
32.05 make: *** [Makefile:1720: main/php_glob.lo] Error 1
32.05 make: *** Waiting for unfinished jobs....
33.67 emmake: error: 'make -j4' failed (returned 2)
```
But I expected this output instead:
```
warning: undefined symbol: getdtablesize (referenced by root reference (e.g. compiled C/C++ code))
warning: undefined symbol: makecontext (referenced by root reference (e.g. compiled C/C++ code))
warning: undefined symbol: php_glob (referenced by root reference (e.g. compiled C/C++ code))
warning: undefined symbol: php_globfree (referenced by root reference (e.g. compiled C/C++ code))
warning: undefined symbol: posix_spawnp (referenced by root reference (e.g. compiled C/C++ code))
warning: undefined symbol: swapcontext (referenced by root reference (e.g. compiled C/C++ code))
emcc: warning: warnings in JS library compilation [-Wjs-compiler]
```
Working around this by deleting the file leads to a different output:
```
28.22 make: *** No rule to make target '/local/src/php-src/main/php_glob.c', needed by
'main/php_glob.lo'. Stop.
28.22 make: *** Waiting for unfinished jobs....
29.26 emmake: error: 'make -j4' failed (returned 2)
```
But, deleting the section (because I failed to deactivate it) works, as does using
touch with an empty file. Proving it is indeed not needed outside of win32...
### PHP Version
```plain
N/A (8.5 alpha targetted for build)
```
### Operating System
debian bookworm