weltling / parle

Parser and lexer for PHP
Other
82 stars 9 forks source link

Failing to compile 0.8.3 dll #32

Closed tfedor closed 1 year ago

tfedor commented 1 year ago

I tried and failed to compile .dll for 0.8.3 since it's missing on PECL.

When trying to build with php from source, I'm running into linker issue, when trying phpize I ended up on missing bison.exe, which is where I'm now. Compiled bison for Windows that I found seems to be in an older, non-compatible version.

Before I try to delve deeper into how to compile that, would it be possible to update INSTALL.md to list dependencies that I would need and their versions? Or ideally to add .dll to PECL to make it easier for me? :)

Thank you

weltling commented 1 year ago

@tfedor Better later than never :) You can see how to build extensions on Windows here

https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2#building_pecl_extensions_with_phpize

If you'll find time to contribute the github action integration, it would be great. Otherwise also, on Windows i guess nowadays it'd be much easier to use WSL?

Thanks

BenHanson commented 1 year ago

I found bison 3 for Windows here: https://sourceforge.net/projects/winflexbison/files/

You will need to rename win_bison.exe to bison.exe though

weltling commented 1 year ago

The php-sdk as on the wiki page should have all the dependencies required for a minimal PHP build. AFAIK for bison, it'd use the msys bins and it seems nothing has changed today.

Thanks

weltling commented 1 year ago

Addressed the build question in 717382958593eebef05908caed3ce918f6bc50f9, closing for the time being.

Thanks

Jan-E commented 1 year ago

@tfedor Better later than never :) You can see how to build extensions on Windows here

https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2#building_pecl_extensions_with_phpize

@weltling Building with VS16 or VS17 fails. A lot of notes and then this (with PHP 8.1, but the 8.0-8.3 have the same issue):

\php-sdk\php81dev\ext\parle\lib\parsertl14\include/parsertl/debug.hpp(266): note: could be 'void parsertl::basic_debug<parle::char_type>::empty(std::basic_ostream<char32_t,std::char_traits<char32_t>> &)'
\php-sdk\php81dev\ext\parle\lib\parsertl14\include/parsertl/debug.hpp(261): note: or       'void parsertl::basic_debug<parle::char_type>::empty(std::wostream &)'
\php-sdk\php81dev\ext\parle\lib\parsertl14\include/parsertl/debug.hpp(256): note: or       'void parsertl::basic_debug<parle::char_type>::empty(std::ostream &)'
\php-sdk\php81dev\ext\parle\lib\parsertl14\include/parsertl/debug.hpp(108): note: while trying to match the argument list '(std::basic_ostream<_Elem,_Traits>)'
        with
        [
            _Elem=parle::char_type,
            _Traits=std::char_traits<parle::char_type>
        ]
\php-sdk\php81dev\ext\parle\lib\parsertl14\include/parsertl/debug.hpp(134): error C2665: 'parsertl::basic_debug<parle::char_type>::prec': none of the 3 overloads could convert all the argument types
\php-sdk\php81dev\ext\parle\lib\parsertl14\include/parsertl/debug.hpp(311): note: could be 'void parsertl::basic_debug<parle::char_type>::prec(std::basic_ostream<char32_t,std::char_traits<char32_t>> &)'
\php-sdk\php81dev\ext\parle\lib\parsertl14\include/parsertl/debug.hpp(306): note: or       'void parsertl::basic_debug<parle::char_type>::prec(std::wostream &)'
\php-sdk\php81dev\ext\parle\lib\parsertl14\include/parsertl/debug.hpp(301): note: or       'void parsertl::basic_debug<parle::char_type>::prec(std::ostream &)'
\php-sdk\php81dev\ext\parle\lib\parsertl14\include/parsertl/debug.hpp(134): note: while trying to match the argument list '(std::basic_ostream<_Elem,_Traits>)'
        with
        [
            _Elem=parle::char_type,
            _Traits=std::char_traits<parle::char_type>
        ]
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe"' : return code '0x2'
Stop.

Is there an easy fix?

BenHanson commented 1 year ago

I believe this can be fixed with an upgrade to the latest parsertl.

I have merged the latest PR. Let's see if that actually fixes the problem though.

Jan-E commented 1 year ago

No luck. PHP 8.2 TS x64 VS16:

        "cl.exe" /I "ext\parle\lib\lexertl14" /DHAVE_INCLUDE_LEXERTL_GENERATOR_HPP=1 /I "ext\parle\lib\parsertl14" /DHAVE_INCLUDE_PARSERTL_GENERATOR_HPP=1 /I "ext\parle\lib" /DHAVE_PARLE_LEXER_ITERATOR_HPP=1 /D ZEND_COMPILE_DL_EXT=1 /D COMPILE_DL_PARLE /D PARLE_EXPORTS=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /I ext\parle\lib\lexertl14 /I ext\parle\lib\parsertl14 /EHsc -std:c++14 /D HAVE_PARLE_UTF32=1 /nologo /I . /I main /I Zend /I TSRM /I ext /D _WINDOWS /D WINDOWS=1 /D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /D _USE_MATH_DEFINES /FD /wd4996 /Qspectre /guard:cf /Zc:inline /Gw /Zc:__cplusplus /d2FuncCache1 /Zc:wchar_t /MP /Zi /LD /MD /Ox /D NDebug /D NDEBUG /GF /D ZEND_DEBUG=0 /D ZTS=1 /I "../win64build.vc16\include" /D FD_SETSIZE=1024 /DHAVE_ARGON2ID_HASH_RAW=1 /FoN:\php-sdk\php82dev\x64\Release_TS\ext\parle\ /FpN:\php-sdk\php82dev\x64\Release_TS\ext\parle\ /FRN:\php-sdk\php82dev\x64\Release_TS\ext\parle\ /FdN:\php-sdk\php82dev\x64\Release_TS\ext\parle\ /D ZEND_WIN32_KEEP_INLINE=1 /U ZEND_WIN32_FORCE_INLINE /c ext\parle\parle.cpp
parle.cpp
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(59): error C2665: 'parsertl::basic_debug<parle::char_type>::token': none of the 3 overloads could convert all the argument types
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(407): note: could be 'void parsertl::basic_debug<parle::char_type>::token(std::basic_ostream<char32_t,std::char_traits<char32_t>> &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(402): note: or       'void parsertl::basic_debug<parle::char_type>::token(std::wostream &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(397): note: or       'void parsertl::basic_debug<parle::char_type>::token(std::ostream &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(59): note: while trying to match the argument list '(std::basic_ostream<_Elem,_Traits>)'
        with
        [
            _Elem=parle::char_type,
            _Traits=std::char_traits<parle::char_type>
        ]
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(23): note: while compiling class template member function 'void parsertl::basic_debug<parle::char_type>::dump(const parsertl::basic_rules<parle::char_type,parle::id_type> &,std::basic_ostream<_Elem,_Traits> &)'
        with
        [
            _Elem=parle::char_type,
            _Traits=std::char_traits<parle::char_type>
        ]
ext\parle\parle.cpp(1276): note: see reference to function template instantiation 'void parsertl::basic_debug<parle::char_type>::dump(const parsertl::basic_rules<parle::char_type,parle::id_type> &,std::basic_ostream<_Elem,_Traits> &)' being compiled
        with
        [
            _Elem=parle::char_type,
            _Traits=std::char_traits<parle::char_type>
        ]
ext\parle\parle.cpp(1276): note: see reference to class template instantiation 'parsertl::basic_debug<parle::char_type>' being compiled
ext\parle\parle.cpp(1301): note: see reference to function template instantiation 'void _parser_dump<ze_parle_parser_obj>(zend_execute_data *,zval *,zend_class_entry *) noexcept' being compiled
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(62): error C2665: 'parsertl::basic_debug<parle::char_type>::precedence': none of the 3 overloads could convert all the argument types
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(346): note: could be 'void parsertl::basic_debug<parle::char_type>::precedence(std::basic_ostream<char32_t,std::char_traits<char32_t>> &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(341): note: or       'void parsertl::basic_debug<parle::char_type>::precedence(std::wostream &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(336): note: or       'void parsertl::basic_debug<parle::char_type>::precedence(std::ostream &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(62): note: while trying to match the argument list '(std::basic_ostream<_Elem,_Traits>)'
        with
        [
            _Elem=parle::char_type,
            _Traits=std::char_traits<parle::char_type>
        ]
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(65): error C2665: 'parsertl::basic_debug<parle::char_type>::nonassoc': none of the 3 overloads could convert all the argument types
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(316): note: could be 'void parsertl::basic_debug<parle::char_type>::nonassoc(std::basic_ostream<char32_t,std::char_traits<char32_t>> &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(311): note: or       'void parsertl::basic_debug<parle::char_type>::nonassoc(std::wostream &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(306): note: or       'void parsertl::basic_debug<parle::char_type>::nonassoc(std::ostream &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(65): note: while trying to match the argument list '(std::basic_ostream<_Elem,_Traits>)'
        with
        [
            _Elem=parle::char_type,
            _Traits=std::char_traits<parle::char_type>
        ]
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(68): error C2665: 'parsertl::basic_debug<parle::char_type>::left': none of the 3 overloads could convert all the argument types
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(301): note: could be 'void parsertl::basic_debug<parle::char_type>::left(std::basic_ostream<char32_t,std::char_traits<char32_t>> &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(296): note: or       'void parsertl::basic_debug<parle::char_type>::left(std::wostream &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(291): note: or       'void parsertl::basic_debug<parle::char_type>::left(std::ostream &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(68): note: while trying to match the argument list '(std::basic_ostream<_Elem,_Traits>)'
        with
        [
            _Elem=parle::char_type,
            _Traits=std::char_traits<parle::char_type>
        ]
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(71): error C2665: 'parsertl::basic_debug<parle::char_type>::right': none of the 3 overloads could convert all the argument types
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(361): note: could be 'void parsertl::basic_debug<parle::char_type>::right(std::basic_ostream<char32_t,std::char_traits<char32_t>> &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(356): note: or       'void parsertl::basic_debug<parle::char_type>::right(std::wostream &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(351): note: or       'void parsertl::basic_debug<parle::char_type>::right(std::ostream &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(71): note: while trying to match the argument list '(std::basic_ostream<_Elem,_Traits>)'
        with
        [
            _Elem=parle::char_type,
            _Traits=std::char_traits<parle::char_type>
        ]
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(83): error C2665: 'parsertl::basic_debug<parle::char_type>::start': none of the 3 overloads could convert all the argument types
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(376): note: could be 'void parsertl::basic_debug<parle::char_type>::start(std::basic_ostream<char32_t,std::char_traits<char32_t>> &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(371): note: or       'void parsertl::basic_debug<parle::char_type>::start(std::wostream &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(366): note: or       'void parsertl::basic_debug<parle::char_type>::start(std::ostream &)'
ext\parle\lib\parsertl14\include/parsertl/debug.hpp(83): note: while trying to match the argument list '(std::basic_ostream<_Elem,_Traits>)'
        with
        [
            _Elem=parle::char_type,
            _Traits=std::char_traits<parle::char_type>
        ]
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe"' : return code '0x2'
Stop.
BenHanson commented 1 year ago

Try changing line 94 in parle.cpp:

using char_type = uint32_t

to

using char_type = char32_t

Jan-E commented 1 year ago

I will try it tomorrow. BTW: I just happened to see your completely rewritten comment. Edits do not generate a new notification message. My mail log does only know that you could reproduce the error.

Jan-E commented 1 year ago

Works. Thanks.

weltling commented 1 year ago

@Jan-E thanks for checking the Windows side. If time permits, having Wnidows build on CI would be a nice to have thing.

Thanks!

Jan-E commented 1 year ago

@weltling As you know quite well I publish my own builds on Apachelounge. php_parle.dll is already in the x64 RC builds, including PHP 8.3 Alpha 2: https://www.apachelounge.com/viewtopic.php?t=6617

weltling commented 1 year ago

That's nice, yep. Otherwise, I only meant for CI for commit validation.

Thanks