Skip to content

Failed to build Docker containers due to Emscripten error #152

Closed
@nsfisis

Description

@nsfisis

Summary

I tried to build the Docker containers by make build, but it failed with the below error message:

25.42 file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:382
25.42         if (param.type === 'RestElement') {
25.42                   ^
25.42
25.42 TypeError: Cannot read properties of null (reading 'type')
25.42     at traverse (file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:382:19)
25.42     at traverse (file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:391:13)
25.42     at Array.forEach (<anonymous>)
25.42     at handleFunction (file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:381:19)
25.42     at Object.ArrowFunctionExpression (file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:470:9)
25.42     at c (file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:92:20)
25.42     at recursiveWalk (file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:94:5)
25.42     at file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:90:38
25.42     at maybeChild (file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:54:7)
25.42     at Array.forEach (<anonymous>)

It ocurred for all versions, i.e., from build-5.6 to build-8.3.

Environment

  • OS: WSL on Windows 11
  • WSL OS: Ubuntu 22.04.3 LTS
  • Build date: 2024-03-10 09:18 (Asia/Tokyo)

More detailed log

 > [emscripten-php 46/48] RUN source /root/emsdk/emsdk_env.sh &&     export EXPORTED_FUNCTIONS=$'["_php_wasm_init", \n"_phpwasm_destroy_uploaded_files_hash", \n"_phpwasm_init_uploaded_files_hash", \n"_phpwasm_register_uploaded_file", \n"_wasm_set_phpini_path", \n"_wasm_set_phpini_entries", \n"_wasm_add_SERVER_entry", \n"_wasm_add_uploaded_file", \n"_wasm_sapi_handle_request", \n"_wasm_set_content_length", \n"_wasm_set_content_type", \n"_wasm_set_cookies", \n"_wasm_set_path_translated", \n"_wasm_set_php_code", \n"_wasm_set_query_string", \n"_wasm_set_request_body", \n"_wasm_set_request_host", \n"_wasm_set_request_method", \n"_wasm_set_request_port", \n"_wasm_set_request_uri", \n"_wasm_set_skip_shebang" '"$(cat /root/.EXPORTED_FUNCTIONS)"']';     emcc -O3     --js-library /root/phpwasm-emscripten-library.js     -I .      -I ext       -I ext/json       -I Zend      -I main      -I TSRM/     -I /root/lib/include     -L/root/lib -L/root/lib/lib/     $(cat /root/.emcc-php-wasm-flags)     -o /root/output/php.js     -s EXPORTED_FUNCTIONS="$EXPORTED_FUNCTIONS"     -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "UTF8ToString", "lengthBytesUTF8", "FS", "PROXYFS"]'     -s INITIAL_MEMORY=1024MB     -s ALLOW_MEMORY_GROWTH=1             -s ASSERTIONS=0                      -s ERROR_ON_UNDEFINED_SYMBOLS=0      -s INVOKE_RUN=0                      -s EXIT_RUNTIME=1                        /root/lib/libphp.a         /root/php_wasm.c         $(cat /root/.emcc-php-wasm-sources)     -s ENVIRONMENT=web     -s FORCE_FILESYSTEM=1     -s EXPORT_NAME="'PHPLoader'":
0.414 Setting up EMSDK environment (suppress these messages with EMSDK_QUIET=1)
0.414 Adding directories to PATH:
0.414 PATH += /root/emsdk
0.414 PATH += /root/emsdk/upstream/emscripten
0.414 PATH += /root/emsdk/node/16.20.0_64bit/bin
0.414
0.414 Setting environment variables:
0.414 PATH = /root/emsdk:/root/emsdk/upstream/emscripten:/root/emsdk/node/16.20.0_64bit/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
0.414 EMSDK = /root/emsdk
0.414 EMSDK_NODE = /root/emsdk/node/16.20.0_64bit/bin/node
0.763 emcc2: warning: EXTRA_EXPORTED_RUNTIME_METHODS is deprecated, please use EXPORTED_RUNTIME_METHODS instead [-Wdeprecated]
0.779 cache:INFO: generating system asset: symbol_lists/d85b8c507ae858326ef72680e2ed9bfab3e98ece.json... (this will be cached in "/root/emsdk/upstream/emscripten/cache/symbol_lists/d85b8c507ae858326ef72680e2ed9bfab3e98ece.json" for subsequent builds)
0.972 cache:INFO:  - ok
1.813 warning: undefined symbol: getcontext (referenced by root reference (e.g. compiled C/C++ code))
1.813 warning: undefined symbol: getdtablesize (referenced by root reference (e.g. compiled C/C++ code))
1.813 warning: undefined symbol: makecontext (referenced by root reference (e.g. compiled C/C++ code))
1.814 warning: undefined symbol: swapcontext (referenced by root reference (e.g. compiled C/C++ code))
1.814 warning: undefined symbol: vrzno_del_callback (referenced by root reference (e.g. compiled C/C++ code))
1.814 warning: undefined symbol: vrzno_exec_callback (referenced by root reference (e.g. compiled C/C++ code))
1.833 warning: invalid item in EXPORTED_RUNTIME_METHODS: PROXYFS
1.854 emcc2: warning: warnings in JS library compilation [-Wjs-compiler]
25.42 file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:382
25.42         if (param.type === 'RestElement') {
25.42                   ^
25.42
25.42 TypeError: Cannot read properties of null (reading 'type')
25.42     at traverse (file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:382:19)
25.42     at traverse (file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:391:13)
25.42     at Array.forEach (<anonymous>)
25.42     at handleFunction (file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:381:19)
25.42     at Object.ArrowFunctionExpression (file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:470:9)
25.42     at c (file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:92:20)
25.42     at recursiveWalk (file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:94:5)
25.42     at file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:90:38
25.42     at maybeChild (file:///root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs:54:7)
25.42     at Array.forEach (<anonymous>)
25.42 emcc2: error: '/root/emsdk/node/16.20.0_64bit/bin/node /root/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs /tmp/emscripten_temp_dc143ue4/php.js AJSDCE minifyWhitespace -o /tmp/emscripten_temp_dc143ue4/php.jso1.js' failed (returned 1)
------
Dockerfile:843
--------------------
 842 |     COPY build-assets/phpwasm-emscripten-library.js /root/phpwasm-emscripten-library.js
 843 | >>> RUN source /root/emsdk/emsdk_env.sh && \
 844 | >>>     export EXPORTED_FUNCTIONS=$'["_php_wasm_init", \n\
 845 | >>> "_phpwasm_destroy_uploaded_files_hash", \n\
 846 | >>> "_phpwasm_init_uploaded_files_hash", \n\
 847 | >>> "_phpwasm_register_uploaded_file", \n\
 848 | >>> "_wasm_set_phpini_path", \n\
 849 | >>> "_wasm_set_phpini_entries", \n\
 850 | >>> "_wasm_add_SERVER_entry", \n\
 851 | >>> "_wasm_add_uploaded_file", \n\
 852 | >>> "_wasm_sapi_handle_request", \n\
 853 | >>> "_wasm_set_content_length", \n\
 854 | >>> "_wasm_set_content_type", \n\
 855 | >>> "_wasm_set_cookies", \n\
 856 | >>> "_wasm_set_path_translated", \n\
 857 | >>> "_wasm_set_php_code", \n\
 858 | >>> "_wasm_set_query_string", \n\
 859 | >>> "_wasm_set_request_body", \n\
 860 | >>> "_wasm_set_request_host", \n\
 861 | >>> "_wasm_set_request_method", \n\
 862 | >>> "_wasm_set_request_port", \n\
 863 | >>> "_wasm_set_request_uri", \n\
 864 | >>> "_wasm_set_skip_shebang" '"$(cat /root/.EXPORTED_FUNCTIONS)"']'; \
 865 | >>>     emcc -O3 \
 866 | >>>     --js-library /root/phpwasm-emscripten-library.js \
 867 | >>>     -I .  \
 868 | >>>     -I ext   \
 869 | >>>     -I ext/json   \
 870 | >>>     -I Zend  \
 871 | >>>     -I main  \
 872 | >>>     -I TSRM/ \
 873 | >>>     -I /root/lib/include \
 874 | >>>     -L/root/lib -L/root/lib/lib/ \
 875 | >>>     $(cat /root/.emcc-php-wasm-flags) \
 876 | >>>     -o /root/output/php.js \
 877 | >>>     -s EXPORTED_FUNCTIONS="$EXPORTED_FUNCTIONS" \
 878 | >>>     -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "UTF8ToString", "lengthBytesUTF8", "FS", "PROXYFS"]' \
 879 | >>>     -s INITIAL_MEMORY=1024MB \
 880 | >>>     -s ALLOW_MEMORY_GROWTH=1         \
 881 | >>>     -s ASSERTIONS=0                  \
 882 | >>>     -s ERROR_ON_UNDEFINED_SYMBOLS=0  \
 883 | >>>     -s INVOKE_RUN=0                  \
 884 | >>>     -s EXIT_RUNTIME=1                \
 885 | >>>         /root/lib/libphp.a \
 886 | >>>         /root/php_wasm.c \
 887 | >>>         $(cat /root/.emcc-php-wasm-sources) \
 888 | >>>     -s ENVIRONMENT=$EMSCRIPTEN_ENVIRONMENT \
 889 | >>>     -s FORCE_FILESYSTEM=1 \
 890 | >>>     -s EXPORT_NAME="'PHPLoader'"
 891 |         # Emscripten complains it can't find some Asyncify functions
--------------------
ERROR: failed to solve: process "/bin/bash -c source /root/emsdk/emsdk_env.sh &&     export EXPORTED_FUNCTIONS=$'[\"_php_wasm_init\", \\n\"_phpwasm_destroy_uploaded_files_hash\", \\n\"_phpwasm_init_uploaded_files_hash\", \\n\"_phpwasm_register_uploaded_file\", \\n\"_wasm_set_phpini_path\", \\n\"_wasm_set_phpini_entries\", \\n\"_wasm_add_SERVER_entry\", \\n\"_wasm_add_uploaded_file\", \\n\"_wasm_sapi_handle_request\", \\n\"_wasm_set_content_length\", \\n\"_wasm_set_content_type\", \\n\"_wasm_set_cookies\", \\n\"_wasm_set_path_translated\", \\n\"_wasm_set_php_code\", \\n\"_wasm_set_query_string\", \\n\"_wasm_set_request_body\", \\n\"_wasm_set_request_host\", \\n\"_wasm_set_request_method\", \\n\"_wasm_set_request_port\", \\n\"_wasm_set_request_uri\", \\n\"_wasm_set_skip_shebang\" '\"$(cat /root/.EXPORTED_FUNCTIONS)\"']';     emcc -O3     --js-library /root/phpwasm-emscripten-library.js     -I .      -I ext       -I ext/json       -I Zend      -I main      -I TSRM/     -I /root/lib/include     -L/root/lib -L/root/lib/lib/     $(cat /root/.emcc-php-wasm-flags)     -o /root/output/php.js     -s EXPORTED_FUNCTIONS=\"$EXPORTED_FUNCTIONS\"     -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"UTF8ToString\", \"lengthBytesUTF8\", \"FS\", \"PROXYFS\"]'     -s INITIAL_MEMORY=1024MB     -s ALLOW_MEMORY_GROWTH=1             -s ASSERTIONS=0                      -s ERROR_ON_UNDEFINED_SYMBOLS=0      -s INVOKE_RUN=0                      -s EXIT_RUNTIME=1                        /root/lib/libphp.a         /root/php_wasm.c         $(cat /root/.emcc-php-wasm-sources)     -s ENVIRONMENT=$EMSCRIPTEN_ENVIRONMENT     -s FORCE_FILESYSTEM=1     -s EXPORT_NAME=\"'PHPLoader'\"" did not complete successfully: exit code: 1
make: *** [Makefile:24: build-image] Error 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions