Compile error since replacing "using namespace std"

Hi!

Since the commit https://stash.kopano.io/projects/KC/repos/kopanocore/commits/6f3680d8f56cc8f7b434547b01d91eec76c152da I cannot compile kopanocore anymore.
My System: Gentoo
PHP 7.0
GCC 5.4.0

I am getting the following error:

In file included from /usr/lib64/php7.0/include/php/Zend/zend_types.h:27:0,
                 from /usr/lib64/php7.0/include/php/Zend/zend.h:31,
                 from /usr/lib64/php7.0/include/php/main/php.h:35,
                 from php7-ext/ECImportContentsChangesProxy.cpp:38:
/usr/lib64/php7.0/include/php/Zend/zend_operators.h: In function ‘zend_long zend_dval_to_lval(double)’:
/usr/lib64/php7.0/include/php/main/php_config.h:2561:34: error: ‘isfinite’ was not declared in this scope
 #define zend_finite(a) isfinite(a)
                                  ^
/usr/lib64/php7.0/include/php/Zend/zend_portability.h:314:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/lib64/php7.0/include/php/Zend/zend_operators.h:117:18: note: in expansion of macro ‘zend_finite’
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                  ^
/usr/lib64/php7.0/include/php/main/php_config.h:2561:34: note: suggested alternative:
 #define zend_finite(a) isfinite(a)
                                  ^
/usr/lib64/php7.0/include/php/Zend/zend_portability.h:314:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/lib64/php7.0/include/php/Zend/zend_operators.h:117:18: note: in expansion of macro ‘zend_finite’
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                  ^
In file included from php7-ext/ECImportContentsChangesProxy.cpp:24:0:
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5/cmath:601:5: note:   ‘std::isfinite’
     isfinite(_Tp __x)
     ^
make[2]: *** [Makefile:3785: php7-ext/mapi_la-ECImportContentsChangesProxy.lo] Error 1

Greetings
Vogi

Hello @vogi ,

thanks for your report. I have created https://jira.kopano.io/browse/KC-849 to look into this.

We may be able to work aroud it, but it is ssentially a new bug in GCC 5’s libstdc++ (in 4.8, it was not implemented, and fixed it is in 6.x).

Hello Jan,

thanks for your reply.
For me iz’s not necessary to make a Workaround, as I can patch the files before compiling.
And when gcc-6 or greater will be “stable” on gentto, the Problem should be fixed.

Hi,

not sure, if the issue should be fixed with https://stash.kopano.io/projects/KC/repos/kopanocore/commits/53e3065308394e512dbda77e2d27d990b1564b3b

But even with these changes I am getting an error:

In file included from /usr/lib64/php7.0/include/php/Zend/zend_types.h:27:0,
                 from /usr/lib64/php7.0/include/php/Zend/zend.h:31,
                 from /usr/lib64/php7.0/include/php/main/php.h:35,
                 from php7-ext/ECImportContentsChangesProxy.cpp:39:
/usr/lib64/php7.0/include/php/Zend/zend_operators.h: In function ‘zend_long zend_dval_to_lval(double)’:
/usr/lib64/php7.0/include/php/main/php_config.h:2561:34: error: ‘isfinite’ was not declared in this scope
 #define zend_finite(a) isfinite(a)
                                  ^
/usr/lib64/php7.0/include/php/Zend/zend_portability.h:314:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/lib64/php7.0/include/php/Zend/zend_operators.h:117:18: note: in expansion of macro ‘zend_finite’
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                  ^
/usr/lib64/php7.0/include/php/main/php_config.h:2561:34: note: suggested alternative:
 #define zend_finite(a) isfinite(a)
                                  ^
/usr/lib64/php7.0/include/php/Zend/zend_portability.h:314:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/lib64/php7.0/include/php/Zend/zend_operators.h:117:18: note: in expansion of macro ‘zend_finite’
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                  ^
In file included from php7-ext/ECImportContentsChangesProxy.cpp:24:0:
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5/cmath:601:5: note:   ‘std::isfinite’
     isfinite(_Tp __x)
     ^
/bin/sh ./libtool  --tag=CXX   --mode=compile x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I./common  -DLINUX   -I./common/include      -I./common/include      -I./m4lcommon/include   -I./provider/common/include     -I./provider/libserver/include       -I./ECtools/archiver/include    -I./inetmapi/include    -I./swig/include        -I./swig/python/include         -I.  -DNDEBUG -DUNICODE  -DUSE_EPOLL    -DLDAP_THREAD_SAFE -DMAPICONFIGDIR=\"/etc/mapi\" -DPKGLIBDIR='"/usr/lib64/kopano"' -DSOAP_CMAC='__attribute__((visibility("default")))' -DSOAP_FMAC3=SOAP_CMAC -DSOAP_FMAC5=SOAP_CMAC -DSOAP_NMAC=SOAP_CMAC -Iprovider/soap -I./common -I./libfreebusy -I./libsync -I./m4lcommon -I./mapi4linux/include -I./provider/client -I./provider/common -I./provider/include -I./provider/libserver -I./provider/plugins -I./libfreebusy -I./libicalmapi -I./librosie -I./ECtools/archiver   -DWITH_OPENSSL -DWITH_GZIP -DHAVE_OPENSSL_SSL_H -DHAVE_ZLIB_H   -DLDAP_DEPRECATED=1 -I/usr/include/mysql    -I/usr/include/tidy -I/usr/include/vmime/  -I/usr/include/libxml2  -I/usr/lib64/php7.0/include/php -I/usr/lib64/php7.0/include/php/main -I/usr/lib64/php7.0/include/php/TSRM -I/usr/lib64/php7.0/include/php/Zend -I/usr/lib64/php7.0/include/php/ext -I/usr/lib64/php7.0/include/php/ext/date/lib -I./php7-ext -I./php-ext  -Wall -Wmissing-declarations -std=c++11 -Wno-variadic-macros -O2 -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -Wno-sign-compare -Wno-narrowing -march=atom -O2 -pipe -fpermissive -c -o php7-ext/mapi_la-ECImportHierarchyChangesProxy.lo `test -f 'php7-ext/ECImportHierarchyChangesProxy.cpp' || echo './'`php7-ext/ECImportHierarchyChangesProxy.cpp
make[2]: *** [Makefile:3805: php7-ext/mapi_la-ECImportContentsChangesProxy.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
libtool: compile:  x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I./common -DLINUX -I./common/include -I./common/include -I./m4lcommon/include -I./provider/common/include -I./provider/libserver/include -I./ECtools/archiver/include -I./inetmapi/include -I./swig/include -I./swig/python/include -I. -DNDEBUG -DUNICODE -DUSE_EPOLL -DLDAP_THREAD_SAFE -DMAPICONFIGDIR=\"/etc/mapi\" -DPKGLIBDIR=\"/usr/lib64/kopano\" "-DSOAP_CMAC=__attribute__((visibility(\"default\")))" -DSOAP_FMAC3=SOAP_CMAC -DSOAP_FMAC5=SOAP_CMAC -DSOAP_NMAC=SOAP_CMAC -Iprovider/soap -I./common -I./libfreebusy -I./libsync -I./m4lcommon -I./mapi4linux/include -I./provider/client -I./provider/common -I./provider/include -I./provider/libserver -I./provider/plugins -I./libfreebusy -I./libicalmapi -I./librosie -I./ECtools/archiver -DWITH_OPENSSL -DWITH_GZIP -DHAVE_OPENSSL_SSL_H -DHAVE_ZLIB_H -DLDAP_DEPRECATED=1 -I/usr/include/mysql -I/usr/include/tidy -I/usr/include/vmime/ -I/usr/include/libxml2 -I/usr/lib64/php7.0/include/php -I/usr/lib64/php7.0/include/php/main -I/usr/lib64/php7.0/include/php/TSRM -I/usr/lib64/php7.0/include/php/Zend -I/usr/lib64/php7.0/include/php/ext -I/usr/lib64/php7.0/include/php/ext/date/lib -I./php7-ext -I./php-ext -Wall -Wmissing-declarations -std=c++11 -Wno-variadic-macros -O2 -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -Wno-sign-compare -Wno-narrowing -march=atom -O2 -pipe -fpermissive -c php7-ext/ECImportHierarchyChangesProxy.cpp  -fPIC -DPIC -o php7-ext/.libs/mapi_la-ECImportHierarchyChangesProxy.o
In file included from /usr/lib64/php7.0/include/php/Zend/zend_types.h:27:0,
                 from /usr/lib64/php7.0/include/php/Zend/zend.h:31,
                 from /usr/lib64/php7.0/include/php/main/php.h:35,
                 from php7-ext/ECImportHierarchyChangesProxy.cpp:39:
/usr/lib64/php7.0/include/php/Zend/zend_operators.h: In function ‘zend_long zend_dval_to_lval(double)’:
/usr/lib64/php7.0/include/php/main/php_config.h:2561:34: error: ‘isfinite’ was not declared in this scope
 #define zend_finite(a) isfinite(a)
                                  ^
/usr/lib64/php7.0/include/php/Zend/zend_portability.h:314:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/lib64/php7.0/include/php/Zend/zend_operators.h:117:18: note: in expansion of macro ‘zend_finite’
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                  ^
/usr/lib64/php7.0/include/php/main/php_config.h:2561:34: note: suggested alternative:
 #define zend_finite(a) isfinite(a)
                                  ^
/usr/lib64/php7.0/include/php/Zend/zend_portability.h:314:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/lib64/php7.0/include/php/Zend/zend_operators.h:117:18: note: in expansion of macro ‘zend_finite’
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                  ^
In file included from php7-ext/ECImportHierarchyChangesProxy.cpp:24:0:
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5/cmath:601:5: note:   ‘std::isfinite’
     isfinite(_Tp __x)

When re-adding

using namespace std;

compiling runs till end fine.

Log in to reply

Looks like your connection to Kopano Community Forum was lost, please wait while we try to reconnect.