seanmorris / php-wasm

PHP in Browser, powered by WebAssembly.
https://seanmorris.github.io/php-wasm/
Apache License 2.0
606 stars 32 forks source link

Trouble with libxml while trying to compile #4

Closed soyuka closed 3 years ago

soyuka commented 3 years ago

Hi there,

Love your work, I'm experimenting with php-wasm and I'd have like to be able to compile the lib.

1) I run make lib/something (libxml gets compiled everything is fine) 2) I run make third_party/php7.4-src/configure and here I get errors:

/src/third_party/php7.4-src/ext/libxml/libxml.c:459:8: error: implicit declaration of function 'xmlAllocOutputBuffer' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        ret = xmlAllocOutputBuffer(encoder);
              ^
/src/third_party/php7.4-src/ext/libxml/libxml.c:459:6: warning: incompatible integer to pointer conversion assigning to 'xmlOutputBufferPtr' (aka 'struct _xmlOutputBuffer *') from 'int' [-Wint-conversion]
        ret = xmlAllocOutputBuffer(encoder);
            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/src/third_party/php7.4-src/ext/libxml/libxml.c:461:6: error: incomplete definition of type 'struct _xmlOutputBuffer'
                ret->context = context;
                ~~~^
/src/third_party/libxml2/include/libxml/tree.h:31:16: note: forward declaration of 'struct _xmlOutputBuffer'
typedef struct _xmlOutputBuffer xmlOutputBuffer;
               ^
/src/third_party/php7.4-src/ext/libxml/libxml.c:462:6: error: incomplete definition of type 'struct _xmlOutputBuffer'
                ret->writecallback = php_libxml_streams_IO_write;
                ~~~^
/src/third_party/libxml2/include/libxml/tree.h:31:16: note: forward declaration of 'struct _xmlOutputBuffer'
typedef struct _xmlOutputBuffer xmlOutputBuffer;
               ^
/src/third_party/php7.4-src/ext/libxml/libxml.c:463:6: error: incomplete definition of type 'struct _xmlOutputBuffer'
                ret->closecallback = php_libxml_streams_IO_close;
                ~~~^
/src/third_party/libxml2/include/libxml/tree.h:31:16: note: forward declaration of 'struct _xmlOutputBuffer'
typedef struct _xmlOutputBuffer xmlOutputBuffer;
               ^
/src/third_party/php7.4-src/ext/libxml/libxml.c:813:45: error: use of undeclared identifier 'XML_SAVE_NO_DECL'
        REGISTER_LONG_CONSTANT("LIBXML_NOXMLDECL",      XML_SAVE_NO_DECL,               CONST_CS | CONST_PERSISTENT);
                                                        ^
/src/third_party/php7.4-src/ext/libxml/libxml.c:827:50: error: use of undeclared identifier 'HTML_PARSE_NOIMPLIED'
        REGISTER_LONG_CONSTANT("LIBXML_HTML_NOIMPLIED", HTML_PARSE_NOIMPLIED,           CONST_CS | CONST_PERSISTENT);
                                                        ^
/src/third_party/php7.4-src/ext/libxml/libxml.c:831:49: error: use of undeclared identifier 'HTML_PARSE_NODEFDTD'
        REGISTER_LONG_CONSTANT("LIBXML_HTML_NODEFDTD",  HTML_PARSE_NODEFDTD,            CONST_CS | CONST_PERSISTENT);

Note that if I add:

    -e LIBXML_LIBS="-L/src/third_party/libxml2/.libs" \
    -e LIBXML_CFLAGS="-I/src/third_party/libxml2/include"

And if I also run ./configure && make in the third_party/libxml2 repository it does compile but I don't think it's the right way of doing it.

Do you have an idea of something I could've forgotten? Do you manage to compile using your actual makefile or maybe there are some changes you didn't committed yet?

Thanks!