Bug #74904 [Com]: zend_operators.h: Error: The function "isfinite" must have a prototype.

From: Date: Tue, 11 Jul 2017 19:00:18 +0000
Subject: Bug #74904 [Com]: zend_operators.h: Error: The function "isfinite" must have a prototype.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209997@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74904&edit=1

 ID:                 74904
 Comment by:         john dot woods at greatplainsmfg dot com
 Reported by:        john dot woods at greatplainsmfg dot com
 Summary:            zend_operators.h:  Error: The function "isfinite"
                     must have a prototype.
 Status:             Open
 Type:               Bug
 Package:            Compile Failure
 Operating System:   Solaris 11.3.21.5.0 (x86-64)
 PHP Version:        7.1.7
 Block user comment: N
 Private report:     N

 New Comment:

Upgrading to Solaris Studio 12.6 did not resolve the issue.

Unfortunately, C++ 03 (-std=sun03) is the default still for Solaris Studio, so as a sysadmin, I have
no choice but to roll with it. How do we sucessfully force the compiler to C++ 14? When I try just
using the switch "-std=c++14", the compiler throws errors like this:

"/opt/developerstudio12.6/lib/compilers/CC-gcc/include/c++/5.4.0/bits/basic_string.h",
line 5300: Error: Could not find a match for __gnu_cxx::__to_xstring<_String, _CharT>(extern
"C" int(*)(char*,unsigned long,const char*,__va_list_element*), unsigned long, const
char[3], int) needed in std::to_string(int).
"/opt/developerstudio12.6/lib/compilers/CC-gcc/include/c++/5.4.0/ext/string_conversions.h",
line 83: Note: Candidate 'std::string  __gnu_cxx::__to_xstring<std::string,
char>(int(*)(char*,unsigned long,const char*,__va_list_tag*), unsigned long, const char*,
...)' is not viable: argument '__convf' can't be converted from 'extern
"C" int(*)(char*,unsigned long,const char*,__va_list_element*)' to
'int(*)(char*,unsigned long,const char*,__va_list_tag*)'.

I'm going to continue working towards a resolution as well, but the fix is elusive currently.


Previous Comments:
------------------------------------------------------------------------
[2017-07-11 16:31:06] john dot woods at greatplainsmfg dot com

Yes, I did read the comments on that bug, and a patch that worked was committed, and is present in
7.1.7. Yet, we get a similar message. It's fundamentally a different issue, since this is C++,
not C.

As for the compiler, I'll upgrade from Solaris Studio 12.5 to 12.6, and see if that resolves
the issue.

------------------------------------------------------------------------
[2017-07-11 16:13:05] spam2 at rhsoft dot net

and while you say "I don't believe this is a duplicate of Bug #74265" did you read
the comments?

[2017-05-03 05:23 UTC] rasmus@php.net
gcc version 4.1.2 ?? That compiler is over 10 years old. You are probably going to need to add
-std=c99 to your build flags to get it to work on any modern codebase, or for heaven's sake,
upgrade to a compiler from this decade.

------------------------------------------------------------------------
[2017-07-11 16:11:12] spam2 at rhsoft dot net

-std=c++03 is simply too old - we have 2017 and way newer standards and i doubt PHP upstream
developers can and should forever care about 15 years or older compilers - there was a simliar
bugreport some months ago with a ages old GCC

------------------------------------------------------------------------
[2017-07-11 16:06:08] john dot woods at greatplainsmfg dot com

Description:
------------
We are compiling PHP 7.1.7 on Solaris 11.3.21.5.0 + idr3199, using Solaris Studio 12.5 compilers.

During the build of the ./ext/intl extension, the following libtool command fails to build
ext/intl/intl_convertcpp.lo:

/bin/sh /tmp/SOURCE_DIR/libtool --silent --preserve-dup-deps --mode=compile CC -I/usr/include 
-Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Iext/intl/
-I/tmp/SOURCE_DIR/ext/intl/ -DPHP_ATOM_INC -I/tmp/SOURCE_DIR/include -I/tmp/SOURCE_DIR/main
-I/tmp/SOURCE_DIR -I/tmp/SOURCE_DIR/ext/date/lib -I/usr/include/libxml2 -I/usr/local/include
-I/tmp/SOURCE_DIR/ext/sqlite3/libsqlite -I/tmp/SOURCE_DIR/TSRM -I/tmp/SOURCE_DIR/Zend 
-D_POSIX_PTHREAD_SEMANTICS  -g  -c /tmp/SOURCE_DIR/ext/intl/intl_convertcpp.cpp -o
ext/intl/intl_convertcpp.lo
"/tmp/SOURCE_DIR/Zend/zend_portability.h", line 251: Warning (Anachronism): Attempt to
redefine __restrict__ without using #undef.
"/tmp/SOURCE_DIR/Zend/zend_operators.h", line 117: Error: The function
"isfinite" must have a prototype.
"/tmp/SOURCE_DIR/Zend/zend_operators.h", line 128: Error: The function
"isfinite" must have a prototype.
2 Error(s) and 1 Warning(s) detected.
*** Error code 1
make: Fatal error: Command failed for target `ext/intl/intl_convertcpp.lo'

Upon investigation, the "isfinite" comes from zend_finite(), which gets #define(d) as
"isfinite" only if HAVE_DECL_ISFINITE is true (lines 93-101 of Zend/configure.in). The
HAVE_DECL_ISFINITE is set by the main configure script, if "isfinite" is defined by
#include(ing) <math.h>.

I'm convinced that the root of this problem is that "isfinite" is a valid function
with Solaris Studio's C compiler. But with the C++ compiler, "std::isfinite" is not
defined, since the default C++ dialect is C++ 03. The file it is trying to build is
ext/intl/intl_convertcpp.cpp.

I tried adding "-std=sun03" or "-std=c++03" to CXXFLAGS, but still had the
problem. I also tried setting the flags to "-std=c++11" and "-std=c++14", to
force the C++ 11 or C++ 14 dialect, but those options prevented linking to the GCC/G++ libraries,
which caused other compile problems.

The only way I could get this to compile and work, was forcing HAVE_DECL_ISFINITE, HAVE_DECL_ISNAN,
and HAVE_DECL_ISINF to be 0 in the main configure script, to avoid this altogether. I know it's
a bad hack, but it did actually work around the issue.

I don't believe this is a duplicate of Bug #74265, since this is a C++ issue.

Test script:
---------------
export CC=cc
export CPP="CC -E"
export CXX=CC
export CFLAGS="-m64 -std=c11"
export CPPFLAGS="-m64"
export CXXFLAGS="-m64"
export LD_PRELOAD_64=/usr/local/lib/preloadable_libiconv.so
export LD_LIBRARY_PATH=/usr/local/lib

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-iconv=/usr/local --enable-intl
--enable-inline-optimization --without-sqlite3 --without-pdo-sqlite

make



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74904&edit=1


Thread (15 messages)

« previous php.bugs (#209997) next »