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

Build error #266

Closed
alex2534alex opened this issue Oct 20, 2016 · 11 comments

Comments

@alex2534alex
Copy link

commented Oct 20, 2016

mkdir -p shared/common
mkdir -p shared/zend
g++ -Wall -c -std=c++11 -fvisibility=hidden -DBUILDING_PHPCPP -Wno-write-strings -MD -g php-config --includes -fpic -o shared/zend/inivalue.o zend/inivalue.cpp
In file included from /usr/local/include/php/Zend/zend_portability.h:52:0,
from /usr/local/include/php/Zend/zend_types.h:27,
from /usr/local/include/php/Zend/zend.h:31,
from /usr/local/include/php/main/php.h:35,
from zend/includes.h:41,
from zend/inivalue.cpp:8:
zend/origexception.h:39:5: error: declaration does not declare anything [-fpermissive]
TSRMLS_D;
^
In file included from zend/includes.h:129:0,
from zend/inivalue.cpp:8:
zend/origexception.h: In constructor ‘Php::OrigException::OrigException(zend_object_)’:
zend/origexception.h:51:24: error: expected unqualified-id before ‘=’ token
this->TSRMLS_C = TSRMLS_C;
^
zend/origexception.h:51:34: error: expected primary-expression before ‘;’ token
this->TSRMLS_C = TSRMLS_C;
^
zend/origexception.h: In copy constructor ‘Php::OrigException::OrigException(const Php::OrigException&)’:
zend/origexception.h:64:18: error: expected primary-expression before ‘=’ token
TSRMLS_C = exception.TSRMLS_C;
^
zend/origexception.h:64:38: error: expected unqualified-id before ‘;’ token
TSRMLS_C = exception.TSRMLS_C;
^
zend/origexception.h: In constructor ‘Php::OrigException::OrigException(Php::OrigException&&)’:
zend/origexception.h:80:18: error: expected primary-expression before ‘=’ token
TSRMLS_C = exception.TSRMLS_C;
^
zend/origexception.h:80:38: error: expected unqualified-id before ‘;’ token
TSRMLS_C = exception.TSRMLS_C;
^
Makefile:204: recipe for target 'shared/zend/inivalue.o' failed
make: *_* [shared/zend/inivalue.o] Error 1

g++ (Debian 4.9.2-10) 4.9.2

@danitalika

This comment has been minimized.

Copy link

commented Nov 14, 2016

+1

@whatvn

This comment has been minimized.

Copy link

commented Nov 18, 2016

I got same error when building php with zts (thread safe) enabled.
How do i build php-cpp with thread safe enabled?

@danitalika

This comment has been minimized.

Copy link

commented Nov 21, 2016

Hi,

It seems PHP 7 has modified the TSRMLS_* family of macros from:

php-5.6.28/TSRM/TSRM.h

...
 43 /* Only compile multi-threading functions if we're in ZTS mode */
 44 #ifdef ZTS
...
165 #define TSRMLS_D    void ***tsrm_ls
166 #define TSRMLS_DC   , TSRMLS_D
167 #define TSRMLS_C    tsrm_ls
168 #define TSRMLS_CC   , TSRMLS_C
...

to php-7.0.13/TSRM/TSRM.h

...
40 /* Only compile multi-threading functions if we're in ZTS mode */
41 #ifdef ZTS
...
182 /* BC only */
183 #define TSRMLS_D void
184 #define TSRMLS_DC
185 #define TSRMLS_C
186 #define TSRMLS_CC
187 #define TSRMLS_FETCH()

and this is the cause why @alex2534alex, @whatvn and me have the same error:

...
c++ -Wall -c -std=c++11 -fvisibility=hidden -DBUILDING_PHPCPP -Wno-write-strings -MD -g `/usr/local/bin/php-config --includes` -fpic -o shared/zend/base.o zend/base.cpp
In file included from /usr/local/include/php/Zend/zend_portability.h:52:0,
                 from /usr/local/include/php/Zend/zend_types.h:27,
                 from /usr/local/include/php/Zend/zend.h:31,
                 from /usr/local/include/php/main/php.h:35,
                 from zend/includes.h:41,
                 from zend/base.cpp:8:
zend/origexception.h:39:5: error: la declaración no declara nada [-fpermissive]
     TSRMLS_D;
     ^
In file included from zend/includes.h:129:0,
                 from zend/base.cpp:8:
zend/origexception.h: En el constructor ‘Php::OrigException::OrigException(zend_object*)’:
zend/origexception.h:51:24: error: expected unqualified-id before ‘=’ token
         this->TSRMLS_C = TSRMLS_C;
                        ^
zend/origexception.h:51:34: error: expected primary-expression before ‘;’ token
         this->TSRMLS_C = TSRMLS_C;
                                  ^
zend/origexception.h: En el constructor copia ‘Php::OrigException::OrigException(const Php::OrigException&)’:
zend/origexception.h:64:18: error: expected primary-expression before ‘=’ token
         TSRMLS_C = exception.TSRMLS_C;
                  ^
zend/origexception.h:64:38: error: expected unqualified-id before ‘;’ token
         TSRMLS_C = exception.TSRMLS_C;
                                      ^
zend/origexception.h: En el constructor ‘Php::OrigException::OrigException(Php::OrigException&&)’:
zend/origexception.h:80:18: error: expected primary-expression before ‘=’ token
         TSRMLS_C = exception.TSRMLS_C;
                  ^
zend/origexception.h:80:38: error: expected unqualified-id before ‘;’ token
         TSRMLS_C = exception.TSRMLS_C;
                                      ^
make: *** [shared/zend/base.o] Error 1
@danitalika

This comment has been minimized.

Copy link

commented Nov 21, 2016

UPDATE:

In order to update to PHP 7.0 version you should read the p. TSRM changes item from https://raw.githubusercontent.com/php/php-src/PHP-7.0.0/UPGRADING.INTERNALS, an extract of this changes is:

The TSRM layer undergone significant changes. It is not necessary anymore to pass the tsrm_ls pointer explicitly. The TSRMLS_* macros should not be used in any new developments.

@edwardstock

This comment has been minimized.

Copy link

commented Nov 21, 2016

@danitalika @whatvn @alex2534alex Guys! Try my fork, i was fixed all TSRM_* macros usages and also fixed this lib to using with php7-zts
https://github.com/edwardstock/PHP-CPP
if you will get some errors while configuring or compiling, let me know, i just used lib to internal project and didn't have target to request a pool
Tested on Centos 7 x86-64

@whatvn

This comment has been minimized.

Copy link

commented Nov 22, 2016

@edwardstock that's a big changes, did you try to fix this issue only or to add other features too?

@edwardstock

This comment has been minimized.

Copy link

commented Nov 22, 2016

@whatvn 99% of this changes is a removing TSRM* macroses, 1% is a try to get use this lib exact with php7-zts, cause zend api has been very changed comparing 5 version, and i catched many segfaults. If you want, i can create branch without my tries to optimize zts api

@edwardstock

This comment has been minimized.

Copy link

commented Nov 22, 2016

Also in closer time (if i will have a time), i will try to create support for multi-threading. Now threads not working with userspace, segfaults throws cause all globals must be copied to thread context manualy, php developers didn't care about it (pthreads extension doing the same)

@whatvn

This comment has been minimized.

Copy link

commented Nov 23, 2016

I have tried your fork and it's working for php7 with Zts enabled. Unfortunately phpcpp does have other problem with memory management, that causes memory leak.

I did many test with simple and complicated php extensions, all introduce memory leak with php7.

I don't know if it happens with php5 also. I am going to open another issue, but searching for memory leak in current open issues we will see at least 2 memory leaks issue are not solved.

Do you have solution? This is more important than threading support in userspace

Hưng

On Nov 23, 2016, at 3:28 AM, Eduard notifications@github.com wrote:

Also in closer time (if i will have a time), i will try to create support for multi-threading. Now threads not working with userspace, segfaults throws cause all globals must be copied to thread context manualy, php developers didn't care about it (pthreads extension doing the same)


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@edwardstock

This comment has been minimized.

Copy link

commented Nov 23, 2016

Reduce memory leaks and double freeing is first step of my targets. Unfrotunately, i dont have solution yet, cause research of php api is a big (dirty) job too, i am new in php api, and google is almost silent while searching "zend api documentation")) And yes, php5 has another (not so, but another) api in comparing 7 version, and library must be refactored more than developers did in current master branch.
By the way, TSRM_* macros become deprecated at 25 sep 2014! Proof php/php-src@d11734b

@ghost

This comment has been minimized.

Copy link

commented Dec 30, 2016

Compilation issues with ZTS were fixed

@ghost ghost closed this Dec 30, 2016

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.