[Explore] Compile PHP to WASI so it can run without JS#113
Closed
[Explore] Compile PHP to WASI so it can run without JS#113
Conversation
This commit explores using the wasmenv toolkit to compile PHP. The configure phase works, but the make fails because setjmp is unsupported yet, see the error message below and the relevant GitHub issue at WebAssembly/WASI#490 There's a chance "make" would work if we tried a dedicated libc build: https://github.com/WebAssembly/wasi-libc/blob/main/libc-top-half/musl/include/setjmp.h I'm not sure if the final PHP build would be functional, though. Either way, building using wasi-sdk which has libc and set_jmp.h baked in would be a sensible next step: https://github.com/WebAssembly/wasi-sdk/releases 31 69.49 /root/php-src/main/setjmp.h:44:2: warning: setjmp is not yet implemented for WASI [-W#warnings] 31 69.49 #warning setjmp is not yet implemented for WASI 31 69.49 ^ 31 69.56 In file included from /root/php-src/ext/bcmath/libbcmath/src/div.c:32: 31 69.56 In file included from /root/php-src/ext/bcmath/libbcmath/src/config.h:7: 31 69.56 In file included from /root/php-src/main/php.h:35: 31 69.56 In file included from /root/php-src/Zend/zend_API.h:25: 31 69.56 In file included from /root/php-src/Zend/zend_modules.h:24: 31 69.56 In file included from /root/php-src/Zend/zend_compile.h:724: 31 69.56 /root/php-src/Zend/zend_globals.h:151:2: error: unknown type name 'jmp_buf' 31 69.56 JMP_BUF *bailout; 31 69.56 ^ 31 69.56 /root/php-src/Zend/zend_portability.h:361:18: note: expanded from macro 'JMP_BUF' 31 69.56 # define JMP_BUF jmp_buf
Collaborator
Author
|
Closing this one. Let's look into collaborating with https://github.com/vmware-labs/webassembly-language-runtimes (see php-8.1.11) once WASI supports |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR explores using the
wasmenvtoolkit to compile PHP. The configure phase works, but the make fails because setjmp is unsupported yet, see the error message below and the relevant GitHub issue at WebAssembly/WASI#490There's a chance "make" would work if we tried a dedicated libc build:
https://github.com/WebAssembly/wasi-libc/blob/main/libc-top-half/musl/include/setjmp.h
I'm not sure if the final PHP build would be functional, though.
Either way, building using
wasi-sdkwhich has libc and set_jmp.h baked in would be a sensible next step:https://github.com/WebAssembly/wasi-sdk/releases