Skip to content
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

Error building with Make #22

Open
Crell opened this issue Aug 29, 2022 · 8 comments
Open

Error building with Make #22

Crell opened this issue Aug 29, 2022 · 8 comments

Comments

@Crell
Copy link

Crell commented Aug 29, 2022

Trying to run make ends with this error:

+ USERID=
+ docker-compose -p phpwasm run --rm -e PKG_CONFIG_PATH=/src/lib/lib/pkgconfig -e PRELOAD_ASSETS=preload/ -e INITIAL_MEMORY=1024MB -e ENVIRONMENT=web -e EMCC_ALLOW_FASTCOMP=1 emscripten-builder cp -v build/php-web.js build/php-web.wasm ./dist
Creating phpwasm_emscripten-builder_run ... done
cp: target './dist' is not a directory
ERROR: 1
make: *** [Makefile:203: php-web.wasm] Error 1

When I try to run the php-web.wasm target's dependencies directly, I see there is a warning from SQLite:

+ USERID=
+ docker-compose -p phpwasm run --rm -e PKG_CONFIG_PATH=/src/lib/lib/pkgconfig -e PRELOAD_ASSETS=preload/ -e INITIAL_MEMORY=1024MB -e ENVIRONMENT=web -e EMCC_ALLOW_FASTCOMP=1 -w /src/third_party/php7.4-src/ emscripten-builder emcc -O3 -I . -I Zend -I main -I TSRM/ -I /src/third_party/libxml2 /src/source/pib_eval.c -o /src/lib/pib_eval.o
Creating phpwasm_emscripten-builder_run ... done
emcc: warning: Assuming object file output in the absence of `-c`, based on output filename. Add with `-c` or `-r` to avoid this warning [-Wemcc]
In file included from /src/source/pib_eval.c:11:
/src/source/sqlite3.h:162:23: warning: tentative array definition assumed to have one element
SQLITE_API const char sqlite3_version[];
                      ^
1 warning generated.

I don't know if that's related or not.

@seanmorris
Copy link
Owner

Is the problem still occurring with the latest updates?

@jimmywarting
Copy link

I got i different error message, i think i was able to get further

Now type 'make' to compile libxml2.USERID= docker-compose -p phpwasm run --rm -e PKG_CONFIG_PATH=/src/lib/lib/pkgconfig -e PRELOAD_ASSETS='preload/' -e INITIAL_MEMORY=1024MB -e ENVIRONMENT=web-drupal -e PHP_BRANCH=php-8.2.4 -e EMCC_CORES=`nproc` -e EMCC_ALLOW_FASTCOMP=1 -w /src/third_party/libxml2/ emscripten-builder emconfigure ./configure --with-http=no --with-ftp=no --with-python=no --with-threads=no --enable-shared=no --prefix=/src/lib/ | (which pv > /dev/null && pv --name 'lib/lib/libxml2.la' || cat)
+ which pv
++ nproc
bash: nproc: command not found
+ USERID=
+ docker-compose -p phpwasm run --rm -e PKG_CONFIG_PATH=/src/lib/lib/pkgconfig -e PRELOAD_ASSETS=preload/ -e INITIAL_MEMORY=1024MB -e ENVIRONMENT=web-drupal -e PHP_BRANCH=php-8.2.4 -e EMCC_CORES= -e EMCC_ALLOW_FASTCOMP=1 -w /src/third_party/libxml2/ emscripten-builder emconfigure ./configure --with-http=no --with-ftp=no --with-python=no --with-threads=no --enable-shared=no --prefix=/src/lib/
+ cat
checking whether to enable maintainer-specific portions of Makefiles... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
extra=v2.9.10
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for gcc... /emsdk_portable/fastcomp/emscripten/emcc
checking whether the C compiler works... no
configure: error: in `/src/third_party/libxml2':
configure: error: C compiler cannot create executables
See `config.log' for more details
configure: ./configure --with-http=no --with-ftp=no --with-python=no --with-threads=no --enable-shared=no --prefix=/src/lib/
make: *** [lib/lib/libxml2.la] Error 77

@rhildred
Copy link

Did you ever get past your error @jimmywarting ? I am experiencing the same thing. When I do a docker-compose run emconfigure works for libxml2, but not from the make command.

@rhildred
Copy link

Hi Again:

I got further. During troubleshooting I noticed we both had bash: nproc: command not found. I fixed that first by brew install coreutils. I don't think it made any difference though.

I deleted the original from and uncommented the below.

FROM emscripten/emsdk:latest
MAINTAINER Sean Morris <sean@seanmorr.is>

That way I got up to:

Building PHP for web (drupal)
++ nproc
+ USERID=
+ docker-compose -p phpwasm run --rm -e PKG_CONFIG_PATH=/src/lib/lib/pkgconfig -e PRELOAD_ASSETS=preload/ -e INITIAL_MEMORY=1024MB -e ENVIRONMENT=web-drupal -e PHP_BRANCH=php-8.2.4 -e EMCC_CORES=4 -e EMCC_ALLOW_FASTCOMP=1 -w /src/third_party/php8.2-src/ emscripten-builder emcc -O3 -o ../../build/php-web-drupal.js --llvm-lto 2 -s 'EXPORTED_FUNCTIONS=["_pib_init", "_pib_destroy", "_pib_run", "_pib_exec" "_pib_refresh", "_main", "_php_embed_init", "_php_embed_shutdown", "_php_embed_shutdown", "_zend_eval_string", "_exec_callback", "_del_callback"]' -s 'EXPORTED_RUNTIME_METHODS=["ccall", "UTF8ToString", "lengthBytesUTF8"]' -s ENVIRONMENT=web-drupal -s MAXIMUM_MEMORY=2048mb -s INITIAL_MEMORY=1024MB -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=0 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s 'EXPORT_NAME='\''PHP'\''' -s MODULARIZE=1 -s INVOKE_RUN=0 -s USE_ZLIB=1 /src/lib/pib_eval.o /src/lib/libphp.a /src/lib/lib/libxml2.a --preload-file preload/ -s ENVIRONMENT=web
emcc:WARNING: --llvm-lto ignored when using llvm backend
cache:INFO: generating system asset: symbol_lists/9e524983b986714c65f6ca072c93f38a4827e441.json... (this will be cached in "/emsdk/upstream/emscripten/cache/symbol_lists/9e524983b986714c65f6ca072c93f38a4827e441.json" for subsequent builds)
cache:INFO:  - ok
ports:INFO: retrieving port: zlib from https://github.com/madler/zlib/archive/refs/tags/v1.2.13.tar.gz
ports:INFO: unpacking port: zlib
cache:INFO: generating port: sysroot/lib/wasm32-emscripten/libz.a... (this will be cached in "/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libz.a" for subsequent builds)
system_libs:INFO: compiled 15 inputs
cache:INFO:  - ok
wasm-ld: error: /src/lib/libphp.a(internal_functions.o): undefined symbol: pdo_sqlite_module_entry
emcc: error: '/emsdk/upstream/bin/wasm-ld -o ../../build/php-web-drupal.wasm /src/lib/pib_eval.o /src/lib/libphp.a /src/lib/lib/libxml2.a -L/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten /emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libz.a -lGL -lal -lhtml5 -lstubs -lnoexit -lc -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr /tmp/tmpvsg1gk4llibemscripten_js_symbols.so --import-undefined --strip-debug --export-if-defined=pib_init --export-if-defined=pib_destroy --export-if-defined=pib_run "--export-if-defined=pib_exec\" \"_pib_refresh" --export-if-defined=main --export-if-defined=php_embed_init --export-if-defined=php_embed_shutdown --export-if-defined=zend_eval_string --export-if-defined=exec_callback --export-if-defined=del_callback --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=__main_argc_argv --export-if-defined=stackSave --export-if-defined=stackRestore --export-if-defined=stackAlloc --export-if-defined=__errno_location --export-if-defined=__get_temp_ret --export-if-defined=__set_temp_ret --export-if-defined=malloc --export-if-defined=free --export-if-defined=__wasm_call_ctors --export-table -z stack-size=65536 --initial-memory=1073741824 --max-memory=2147483648 --no-entry --global-base=1024' failed (returned 1)
make: *** [php-web-drupal.wasm] Error 1

@rhildred
Copy link

I deleted my working folder and started over as I couldn't remember if I tested after brew install coreutils

Now I get undefined symbol: pdo_sqlite_module_entry error, which is the same as when I added the extra step:

  • docker-compose -p phpwasm run --rm -e PKG_CONFIG_PATH=/src/lib/lib/pkgconfig -e PRELOAD_ASSETS=preload/ -e INITIAL_MEMORY=1024MB -e ENVIRONMENT=web-drupal -e PHP_BRANCH=php-8.2.4 -e EMCC_CORES=4 -e EMCC_ALLOW_FASTCOMP=1 -w /src/third_party/php8.2-src/ emscripten-builder emcc -O3 -o ../../build/php-web-drupal.js --llvm-lto 2 -s 'EXPORTED_FUNCTIONS=["_pib_init", "_pib_destroy", "_pib_run", "_pib_exec" "_pib_refresh", "_main", "_php_embed_init", "_php_embed_shutdown", "_php_embed_shutdown", "_zend_eval_string", "_exec_callback", "_del_callback"]' -s 'EXPORTED_RUNTIME_METHODS=["ccall", "UTF8ToString", "lengthBytesUTF8"]' -s ENVIRONMENT=web-drupal -s MAXIMUM_MEMORY=2048mb -s INITIAL_MEMORY=1024MB -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=0 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s 'EXPORT_NAME='''PHP'''' -s MODULARIZE=1 -s INVOKE_RUN=0 -s USE_ZLIB=1 /src/lib/pib_eval.o /src/lib/libphp.a /src/lib/lib/libxml2.a --preload-file preload/ -s ENVIRONMENT=web
    emcc:WARNING: --llvm-lto ignored when using llvm backend
    wasm-ld: error: /src/lib/libphp.a(internal_functions.o): undefined symbol: pdo_sqlite_module_entry
    emcc: error: '/emsdk/upstream/bin/wasm-ld -o ../../build/php-web-drupal.wasm /src/lib/pib_eval.o /src/lib/libphp.a /src/lib/lib/libxml2.a -L/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten /emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libz.a -lGL -lal -lhtml5 -lstubs -lnoexit -lc -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr /tmp/tmp69p5suowlibemscripten_js_symbols.so --import-undefined --strip-debug --export-if-defined=pib_init --export-if-defined=pib_destroy --export-if-defined=pib_run "--export-if-defined=pib_exec" "_pib_refresh" --export-if-defined=main --export-if-defined=php_embed_init --export-if-defined=php_embed_shutdown --export-if-defined=zend_eval_string --export-if-defined=exec_callback --export-if-defined=del_callback --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=__main_argc_argv --export-if-defined=stackSave --export-if-defined=stackRestore --export-if-defined=stackAlloc --export-if-defined=__errno_location --export-if-defined=__get_temp_ret --export-if-defined=__set_temp_ret --export-if-defined=malloc --export-if-defined=free --export-if-defined=__wasm_call_ctors --export-table -z stack-size=65536 --initial-memory=1073741824 --max-memory=2147483648 --no-entry --global-base=1024' failed (returned 1)
    make: *** [php-web-drupal.wasm] Error 1

@rhildred
Copy link

rhildred commented Sep 15, 2023

It still fails in the same place. I reasoned that it was broken because of emsdk no longer including fastcomp (emscripten-core/emscripten#11319). So I changed the dockerfile to have:

RUN set -euxo pipefail;\
	apt-get update; \
	emsdk install 1.39.18-fastcomp; \

Unfortunately it errors in the same place with undefined symbol: pdo_sqlite_module_entry still. My product idea depends on being able to use this wordpress plugin so I will keep on trying. Since it wasn't working anyways I moved both places in the dockerfile to:

FROM emscripten/emsdk:latest
MAINTAINER Sean Morris <sean@seanmorr.is>

SHELL ["/bin/bash", "-c"]

RUN set -euxo pipefail;\
	apt-get update; \
	emsdk install latest; \

I would really appreciate any help!!!!

@seanmorris
Copy link
Owner

@rhildred Can you pull the latest master and give it another shot? I've made some changes and its now building with emscripten 3.1.43.

@rhildred
Copy link

Hi @seanmorris . Thanks for the update. I will give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants