-
-
Notifications
You must be signed in to change notification settings - Fork 262
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
[feat] Add gnu based static binary support #592
base: main
Are you sure you want to change the base?
Conversation
@dunglas Building some extension combinations with glibc is pretty smooth at the moment, but I'm not sure there are any hidden issues I haven't discovered yet. Docs are also in this PR. It would be great if you'd like to provide some suggestions or feedback, and I'll merge to the main branch later. |
Thank you for this!! I had a (very) quick look and the patch looks good to me. I'll try to build FrankenPHP with it to see if it works, but as I'll be in vacation for 10 days, it may take some time. |
Hey 👋🏻 As you can see, it still fails with:
I'm available for any help if needed, of course. |
@ptondereau You should use Build glibc Compatible Linux BinaryThe latest version of static-php-cli includes the First, clone the repository of this project and add the following content to the ; Modify this file name to `env.custom.ini`, and run `bin/spc-gnu-docker`,
; you can compile a GNU libc based static binary !
[global]
SPC_SKIP_DOCTOR_CHECK_ITEMS="if musl-wrapper is installed,if musl-cross-make is installed"
[linux]
CC=gcc
CXX=g++
AR=ar
LD=ld
SPC_DEFAULT_C_FLAGS=-fPIC
SPC_NO_MUSL_PATH=yes
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-Wl,-O1 -pie"
SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm -lresolv -lutil" Then, run the following command once. bin/spc-gnu-docker After the image is built, you will see the same command help menu as After the container is ready, you can refer to the local build section to build your PHP static binary. Unlike the default build, when building in the glibc environment, you must add the parameter bin/spc-gnu-docker --libc=glibc build bcmath,ctype,openssl,pdo,phar,posix,session,tokenizer,xml,zip --build-cli --debug NotesIn rare cases, glibc-based static PHP may encounter segment faults and other errors, but there are currently few examples. glibc build is an extended feature and is not part of the default static-php support. If you need to build glibc-based binaries without using Docker, Since glibc binaries are not the main goal of the project, |
What does this PR do?
config/env.custom.ini
Basic usage:
Checklist before merging
src/global/test-extensions.php
../docs/
.config/xxx.json
content, runbin/spc dev:sort-config xxx
.