wasmerio / wasmer-php

🐘🕸️ WebAssembly runtime for PHP
https://wasmerio.github.io/wasmer-php/wasm/
MIT License
1k stars 42 forks source link

Building from source or pecl fails on PHP 7.2 to 7.4 #124

Open edorian opened 3 years ago

edorian commented 3 years ago

Describe the bug

Both pecl install and building from source fails with the same issue on both Linux and Mac

Steps to reproduce

Expected behavior

Extension builds

Actual behavior

A clear and concise description of what actually happened.

If applicable, add screenshots to help explain your problem.

Additional context

Relevant line from the output below:

/bin/bash /tmp/pear/temp/pear-build-rootrldyec/wasm-0.5.0/libtool --mode=compile   -I. -I/tmp/pear/temp/wasm/src -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootrldyec/wasm-0.5.0/include -I/tmp/pear/temp/pear-build-rootrldyec/wasm-0.5.0/main -I/tmp/pear/temp/wasm/src -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib  -DHAVE_CONFIG_H     -c /tmp/pear/temp/wasm/src/wasm.cc -o wasm.lo
libtool: unrecognized option `-I.'
Try `libtool --help' for more information.
Makefile:192: recipe for target 'wasm.lo' failed
make: *** [wasm.lo] Error 1

libtool version is 2.4.6_2 on mac and 2.4.6-0.1 on Linux.

Sample output from a Linux build but I get the same errors on mac.

pecl install wasm

downloading wasm-0.5.0.tgz ...
Starting to download wasm-0.5.0.tgz (2,633,292 bytes)
.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................done: 2,633,292 bytes
23 source files, building
running: phpize
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
building in /tmp/pear/temp/pear-build-rootrldyec/wasm-0.5.0
running: /tmp/pear/temp/wasm/src/configure --with-php-config=/usr/bin/php-config
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20190902
checking for PHP installed headers prefix... /usr/include/php/20190902
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable wasm support... yes, shared
checking for a sed that does not truncate output... /bin/sed
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/bash /tmp/pear/temp/pear-build-rootrldyec/wasm-0.5.0/libtool --mode=compile   -I. -I/tmp/pear/temp/wasm/src -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootrldyec/wasm-0.5.0/include -I/tmp/pear/temp/pear-build-rootrldyec/wasm-0.5.0/main -I/tmp/pear/temp/wasm/src -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib  -DHAVE_CONFIG_H     -c /tmp/pear/temp/wasm/src/wasm.cc -o wasm.lo
libtool: unrecognized option `-I.'
Try `libtool --help' for more information.
Makefile:192: recipe for target 'wasm.lo' failed
make: *** [wasm.lo] Error 1
ERROR: `make' failed
Hywan commented 3 years ago

Thanks for reporting the issue. I'll take a look at it.

leemcd56 commented 3 years ago

Same occurs in PHP 8.0.0:

creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-nathanaelDGeYBa/wasm-0.5.0/libtool --mode=compile  -I. -I/private/tmp/pear/temp/wasm/src -I/private/tmp/pear/temp/pear-build-nathanaelDGeYBa/wasm-0.5.0/include -I/private/tmp/pear/temp/pear-build-nathanaelDGeYBa/wasm-0.5.0/main -I/private/tmp/pear/temp/wasm/src -I/usr/local/Cellar/php/8.0.0_1/include/php -I/usr/local/Cellar/php/8.0.0_1/include/php/main -I/usr/local/Cellar/php/8.0.0_1/include/php/TSRM -I/usr/local/Cellar/php/8.0.0_1/include/php/Zend -I/usr/local/Cellar/php/8.0.0_1/include/php/ext -I/usr/local/Cellar/php/8.0.0_1/include/php/ext/date/lib  -I/usr/local/opt/ruby/include -DHAVE_CONFIG_H      -c /private/tmp/pear/temp/wasm/src/wasm.cc -o wasm.lo
libtool: unrecognized option `-I.'
Try `libtool --help' for more information.
make: *** [wasm.lo] Error 1
ERROR: `make' failed
sc0Vu commented 3 years ago

I can build with php 7.4.0 but not php 8.0.0.

The error message shown:

wasmer-php/src/wasm.cc:718:10: error: 
      no member named 'no_separation' in '_zend_fcall_info'
    fci->no_separation = 0;
    ~~~  ^
wasmer-php/src/wasm.cc:859:35: error: 
      no member named 'pass_by_reference' in
      '_zend_arg_info'
                if (argument_info.pass_by_reference) {
                    ~~~~~~~~~~~~~ ^
wasmer-php/src/wasm.cc:877:42: error: 
      use of undeclared identifier 'ZEND_TYPE_CODE'
                uint32_t argument_type = ZEND_TYPE_...
                                         ^
wasmer-php/src/wasm.cc:927:40: error: 
      use of undeclared identifier 'ZEND_TYPE_CODE'
                uint32_t return_type = ZEND_TYPE_CO...
                                       ^
wasmer-php/src/wasm.cc:2510:79: error: 
      expected ')'
  ...= zend_register_internal_class(&class_entry TSRMLS_...
                                                 ^
wasmer-php/src/wasm.cc:2510:65: note: 
      to match this '('
  ...= zend_register_internal_class(&class_entry TSRMLS_...
                                   ^
wasmer-php/src/wasm.cc:2530:5: error: 
      expected ')'
    DECLARE_WASM_TYPED_ARRAY(WasmInt8Array, int8, 1);
    ^
wasmer-php/src/wasm.cc:2524:87: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...= zend_register_internal_class(&class_entry TSRMLS_...
                                                 ^
wasmer-php/src/wasm.cc:2530:5: note: 
      to match this '('
wasmer-php/src/wasm.cc:2524:73: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...= zend_register_internal_class(&class_entry TSRMLS_...
                                   ^
wasmer-php/src/wasm.cc:2530:5: error: 
      expected ')'
    DECLARE_WASM_TYPED_ARRAY(WasmInt8Array, int8, 1);
    ^
wasmer-php/src/wasm.cc:2527:65: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...TSRMLS_CC, 1, zend_ce_arrayaccess); \
     ^
wasmer-php/src/wasm.cc:2530:5: note: 
      to match this '('
wasmer-php/src/wasm.cc:2527:26: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
    zend_class_implements(wasm_typed_array_##type##...
                         ^
wasmer-php/src/wasm.cc:2531:5: error: 
      expected ')'
    DECLARE_WASM_TYPED_ARRAY(WasmUint8Array, uint8, 1);
    ^
wasmer-php/src/wasm.cc:2524:87: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...= zend_register_internal_class(&class_entry TSRMLS_...
                                                 ^
wasmer-php/src/wasm.cc:2531:5: note: 
      to match this '('
wasmer-php/src/wasm.cc:2524:73: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...= zend_register_internal_class(&class_entry TSRMLS_...
                                   ^
wasmer-php/src/wasm.cc:2531:5: error: 
      expected ')'
    DECLARE_WASM_TYPED_ARRAY(WasmUint8Array, uint8, 1);
    ^
wasmer-php/src/wasm.cc:2527:65: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...TSRMLS_CC, 1, zend_ce_arrayaccess); \
     ^
wasmer-php/src/wasm.cc:2531:5: note: 
      to match this '('
wasmer-php/src/wasm.cc:2527:26: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
    zend_class_implements(wasm_typed_array_##type##...
                         ^
wasmer-php/src/wasm.cc:2532:5: error: 
      expected ')'
    DECLARE_WASM_TYPED_ARRAY(WasmInt16Array, int16, 2);
    ^
wasmer-php/src/wasm.cc:2524:87: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...= zend_register_internal_class(&class_entry TSRMLS_...
                                                 ^
wasmer-php/src/wasm.cc:2532:5: note: 
      to match this '('
wasmer-php/src/wasm.cc:2524:73: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...= zend_register_internal_class(&class_entry TSRMLS_...
                                   ^
wasmer-php/src/wasm.cc:2532:5: error: 
      expected ')'
    DECLARE_WASM_TYPED_ARRAY(WasmInt16Array, int16, 2);
    ^
wasmer-php/src/wasm.cc:2527:65: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...TSRMLS_CC, 1, zend_ce_arrayaccess); \
     ^
wasmer-php/src/wasm.cc:2532:5: note: 
      to match this '('
wasmer-php/src/wasm.cc:2527:26: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
    zend_class_implements(wasm_typed_array_##type##...
                         ^
wasmer-php/src/wasm.cc:2533:5: error: 
      expected ')'
    DECLARE_WASM_TYPED_ARRAY(WasmUint16Array, uint16, 2);
    ^
wasmer-php/src/wasm.cc:2524:87: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...= zend_register_internal_class(&class_entry TSRMLS_...
                                                 ^
wasmer-php/src/wasm.cc:2533:5: note: 
      to match this '('
wasmer-php/src/wasm.cc:2524:73: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...= zend_register_internal_class(&class_entry TSRMLS_...
                                   ^
wasmer-php/src/wasm.cc:2533:5: error: 
      expected ')'
    DECLARE_WASM_TYPED_ARRAY(WasmUint16Array, uint16, 2);
    ^
wasmer-php/src/wasm.cc:2527:65: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...TSRMLS_CC, 1, zend_ce_arrayaccess); \
     ^
wasmer-php/src/wasm.cc:2533:5: note: 
      to match this '('
wasmer-php/src/wasm.cc:2527:26: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
    zend_class_implements(wasm_typed_array_##type##...
                         ^
wasmer-php/src/wasm.cc:2534:5: error: 
      expected ')'
    DECLARE_WASM_TYPED_ARRAY(WasmInt32Array, int32, 4);
    ^
wasmer-php/src/wasm.cc:2524:87: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...= zend_register_internal_class(&class_entry TSRMLS_...
                                                 ^
wasmer-php/src/wasm.cc:2534:5: note: 
      to match this '('
wasmer-php/src/wasm.cc:2524:73: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...= zend_register_internal_class(&class_entry TSRMLS_...
                                   ^
wasmer-php/src/wasm.cc:2534:5: error: 
      expected ')'
    DECLARE_WASM_TYPED_ARRAY(WasmInt32Array, int32, 4);
    ^
wasmer-php/src/wasm.cc:2527:65: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...TSRMLS_CC, 1, zend_ce_arrayaccess); \
     ^
wasmer-php/src/wasm.cc:2534:5: note: 
      to match this '('
wasmer-php/src/wasm.cc:2527:26: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
    zend_class_implements(wasm_typed_array_##type##...
                         ^
wasmer-php/src/wasm.cc:2535:5: error: 
      expected ')'
    DECLARE_WASM_TYPED_ARRAY(WasmUint32Array, uint32, 4);
    ^
wasmer-php/src/wasm.cc:2524:87: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...= zend_register_internal_class(&class_entry TSRMLS_...
                                                 ^
wasmer-php/src/wasm.cc:2535:5: note: 
      to match this '('
wasmer-php/src/wasm.cc:2524:73: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...= zend_register_internal_class(&class_entry TSRMLS_...
                                   ^
wasmer-php/src/wasm.cc:2535:5: error: 
      expected ')'
    DECLARE_WASM_TYPED_ARRAY(WasmUint32Array, uint32, 4);
    ^
wasmer-php/src/wasm.cc:2527:65: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
  ...TSRMLS_CC, 1, zend_ce_arrayaccess); \
     ^
wasmer-php/src/wasm.cc:2535:5: note: 
      to match this '('
wasmer-php/src/wasm.cc:2527:26: note: 
      expanded from macro 'DECLARE_WASM_TYPED_ARRAY'
    zend_class_implements(wasm_typed_array_##type##...
                         ^
17 errors generated.
make[1]: *** [wasm.lo] Error 1
make: *** [build] Error 2
Hywan commented 3 years ago

This issue is now our priority :-). cc @wasmerio/langint

jubianchi commented 3 years ago

Hello @edorian

As @Hywan said, wasmer-php is part of our current priorities. Is PHP7 still required for you?

For now, we only test and build with PHP8 but we can look at introducing support for PHP7.4.

yerke commented 3 years ago

@jubianchi It would be nice to add support for PHP 7.4, if it's not too much trouble. There is still a lot of legacy code that will not be upgraded to 8.0 any time soon. P.S. Thank you to the whole team for working on this project.

jubianchi commented 3 years ago

Hello @yerke

TBH, supporting both PHP8 and PHP7 requires some work but I'll try to fix that.