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 when compiling PHP-CPP with Debian and MingW newest Version #443

Open
subabrain opened this issue May 10, 2020 · 17 comments
Open

Error when compiling PHP-CPP with Debian and MingW newest Version #443

subabrain opened this issue May 10, 2020 · 17 comments

Comments

@subabrain
Copy link

Hello,

i tried now several days to compile php-cpp in Debian with MingW (newest Version).
And there are Errors like:

...

/usr/i686-w64-mingw32/include/phpcpp/inivalue.h:17:21: error: variable ‘Php::PHPCPP_EXPORT Php::IniValue’ has initializer but incomplete type
class PHPCPP_EXPORT IniValue

...

And if i try to compile with g++ - it works..

Please help me!

Thanks!

@subabrain
Copy link
Author

ok .. i dont get this with this version:

git clone https://github.com/CopernicaMarketingSoftware/PHP-CPP.git

this works :)

@subabrain
Copy link
Author

subabrain commented May 12, 2020

sorry i am wrong - it doesnt work :/

here one error:
...
EDIT:

error: expected initializer before ‘__THROW’
extern void *alloca (size_t __size) __THROW;

....

please help :)

@scorninpc
Copy link

@subabrain
Copy link
Author

Thanks Bruno - ill give a try :)

@subabrain subabrain reopened this May 12, 2020
@subabrain
Copy link
Author

ok .. but i dont understand whats this feature has to say:

This release is mainly a bugfix release

  • Implemented a simple sapi_name() method which will return the current sapi.
    - On Windows with mingw EOF was not defined.
  • Added access checks to Php::Value::contains.
    ...

i think its because of a compiler error ....

@subabrain
Copy link
Author

subabrain commented Oct 23, 2022

hi,

here the .dll from phpcpp and the .lib - compiled with php 7.4.0 / x86 and phpcpp :)

Release.zip

EDIT: now it should work :)

Greets
Robert

@scorninpc
Copy link

Man! This is a great news. I'll try it as i can. Thank you

@subabrain
Copy link
Author

Hi,

sorry there are 4 dependencies which are not working (but the rest :) ) -i dont know why - i will check today evening ..

Greets
Robert

@subabrain
Copy link
Author

Hi,

ok i got it - its working now .... :)

grafik

Greets
Robert

@subabrain
Copy link
Author

i will upload a .sln Project here later ;)

Greets
Robert

@subabrain
Copy link
Author

subabrain commented Oct 28, 2022

ok - my example extension works - without errors with phpcpp (with windows) :)

i now try the php-gtk3 ;)

Greets
Robert

@scorninpc
Copy link

This is the best news on this year

If you compile on windows, i'll back on the project, creating an auto-generator to create all the methods, and will be my year end project

Please, try to write steps to compile php-cpp on windows, 'ill help alot

@subabrain
Copy link
Author

subabrain commented Oct 28, 2022

This is the best news on this year

If you compile on windows, i'll back on the project, creating an auto-generator to create all the methods, and will be my year end project

Please, try to write steps to compile php-cpp on windows, 'ill help alot

Hi Bruno,

EDIT:

you have to rename the "string.h" file in the "zend" phpcpp folder to f.e. "strings.h" - because if you dont do this there are some errors because conflicts of the system "string.h" file ...... and then rename this string.h to strings.h when needed :)

but i will try but not with fixed sourcecode - this would be too much - but i will upload the .sln File with the fiexed files here later:

  1. make a new empty c++ project in visual studio (i took version 2022 community)

  2. download the phpcpp sourcecode (i took the newest on github)

  3. download the php sourcecode (i took php 7.4.0 from gihtub releases)

  4. download the php binaries for windows (i took php 7.4.0 x86 non thread safe):

    https://windows.php.net/downloads/releases/archives/php-7.4.0-nts-Win32-vc15-x86.zip

  5. put them extracted in a folder...

  6. now choose your environment in visual studio to "Release" and "X86" (not tested with X64)

  7. please add then all files from the "zend" directory of phpcpp as .cpp files to your project ..

  8. now make the include paths in "properties" of the project to the following php paths in visual studio:
    ...
    php_source_path\php-src-php-7.4.0
    php_source_path\php-src-php-7.4.0\main
    php_source_path\php-src-php-7.4.0\Zend
    php_source_path\php-src-php-7.4.0\TSRM
    php_source_path\php-src-php-7.4.0\ext
    php_source_path\php-src-php-7.4.0\build\main
    php_source_path\php-src-php-7.4.0\build\Zend

    ...

  9. And important - do the following with the preprocessor definitions:

    _WIN32
    _WINDOWS
    NDEBUG
    ZEND_DEBUG=0
    _CRT_SECURE_NO_WARNINGS
    BUILDING_PHPCPP
    ZEND_WIN32_KEEP_INLINE
    PHP_WIN32
    ZEND_WIN32
    _USE_32BIT_TIME_T
    _MSC_VER=1933
    PHP_COMPILER_ID="VC15"

  10. Now - set the Linker options to:

    php7.lib

  11. then set the path of the Linker to:

    php_source_path\php-7.4.0-nts-Win32-vc15-x86\dev

    so the php7.lib located in the "dev" folder ...

  12. now compile the project - BUT you have to choose the version of build to plattform Visual Studio 2017 (v141)

  13. and choose the c++ compiler to "iso17"

so now if its compiled you can use it for developing extensions from php in windows :)

the sln project with all dependencies are comming later ;)

Greets from Germany
Robert

@subabrain
Copy link
Author

Hi,

the Problem in phpgtk3 for windows is the mixture of c and c++ - its not easy 😢

but not for me 😄

Greets
Robert

@subabrain
Copy link
Author

subabrain commented Oct 30, 2022

Hi,

here the .sln file for compiling phpcpp under windows ....

EDIT:

https://1drv.ms/u/s!AifVi84AXOwIhZRdiS8uKQUCQy5i9Q?e=EpJkE5

NOTE:

You have to adjust the c++ files path ... or just add them by yourself :)

HAVE FUN!

Greets
Robert

@subabrain
Copy link
Author

@scorninpc - maybe you can support me in compiling php-gtk3 for windows with help of my compiled phpcpp version ...

Thanks and Greets!
Robert

@scorninpc
Copy link

For sure Robert! Open a issue on the php-gtk3 project

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

2 participants