php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74265 Build problems after 7.0.17 release: undefined reference to `isfinite'
Submitted: 2017-03-17 18:50 UTC Modified: 2017-05-03 05:23 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: deferraz at terra dot com dot br Assigned: nikic (profile)
Status: Closed Package: Compile Failure
PHP Version: 7.0.17 OS: CentOS-5
Private report: No CVE-ID: None
 [2017-03-17 18:50 UTC] deferraz at terra dot com dot br
Description:
------------
After the release 7.0.17 I cant build this release because on compilation time it cant find any reference to isfinite:

ext/standard/.libs/var.o: In function `php_var_export_ex':
/usr/src/redhat/BUILD/php-7.0.17/ext/standard/var.c:469: undefined reference to `isfinite'
main/.libs/php_variables.o: In function `zend_dval_to_lval':
/usr/src/redhat/BUILD/php-7.0.17/Zend/zend_operators.h:117: undefined reference to `isfinite'
Zend/.libs/zend_operators.o: In function `zendi_smart_strcmp':
/usr/src/redhat/BUILD/php-7.0.17/Zend/zend_operators.c:2774: undefined reference to `isfinite'
Zend/.libs/zend_operators.o: In function `zend_dval_to_lval':
/usr/src/redhat/BUILD/php-7.0.17/Zend/zend_operators.h:117: undefined reference to `isfinite'
/usr/src/redhat/BUILD/php-7.0.17/Zend/zend_operators.h:117: undefined reference to `isfinite'
Zend/.libs/zend_operators.o:/usr/src/redhat/BUILD/php-7.0.17/Zend/zend_operators.h:117: more undefined references to `isfinite' follow
collect2: ld returned 1 exit status
make: *** [sapi/cli/php7] Error 1
make: *** Waiting for unfinished jobs....
ext/standard/.libs/var.o: In function `php_var_export_ex':
/usr/src/redhat/BUILD/php-7.0.17/ext/standard/var.c:469: undefined reference to `isfinite'
main/.libs/php_variables.o: In function `zend_dval_to_lval':
/usr/src/redhat/BUILD/php-7.0.17/Zend/zend_operators.h:117: undefined reference to `isfinite'
Zend/.libs/zend_operators.o: In function `zendi_smart_strcmp':
/usr/src/redhat/BUILD/php-7.0.17/Zend/zend_operators.c:2774: undefined reference to `isfinite'
Zend/.libs/zend_operators.o: In function `zend_dval_to_lval':
/usr/src/redhat/BUILD/php-7.0.17/Zend/zend_operators.h:117: undefined reference to `isfinite'
/usr/src/redhat/BUILD/php-7.0.17/Zend/zend_operators.h:117: undefined reference to `isfinite'
Zend/.libs/zend_operators.o:/usr/src/redhat/BUILD/php-7.0.17/Zend/zend_operators.h:117: more undefined references to `isfinite' follow
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1
ext/standard/.libs/var.o: In function `php_var_export_ex':
/usr/src/redhat/BUILD/php-7.0.17/ext/standard/var.c:469: undefined reference to `isfinite'
main/.libs/php_variables.o: In function `zend_dval_to_lval':
/usr/src/redhat/BUILD/php-7.0.17/Zend/zend_operators.h:117: undefined reference to `isfinite'
Zend/.libs/zend_operators.o: In function `zendi_smart_strcmp':
/usr/src/redhat/BUILD/php-7.0.17/Zend/zend_operators.c:2774: undefined reference to `isfinite'
Zend/.libs/zend_operators.o: In function `zend_dval_to_lval':
/usr/src/redhat/BUILD/php-7.0.17/Zend/zend_operators.h:117: undefined reference to `isfinite'
/usr/src/redhat/BUILD/php-7.0.17/Zend/zend_operators.h:117: undefined reference to `isfinite'
Zend/.libs/zend_operators.o:/usr/src/redhat/BUILD/php-7.0.17/Zend/zend_operators.h:117: more undefined references to `isfinite' follow
collect2: ld returned 1 exit status
make: *** [sapi/phpdbg/phpdbg] Error 1

I tried to build against a pristine vm to see if any package that we use created this problem but on a fresh vm the problem persists

I think that this problem is related to commit https://github.com/php/php-src/commit/714d825b62e719447686da6efe3b4063c2f25749


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-17 19:14 UTC] nikic@php.net
From AC_CHECK_DECLS documentation:

> Unlike the other ‘AC_CHECK_*S’ macros, when a symbol is not declared, HAVE_DECL_symbol is defined to ‘0’ instead of leaving HAVE_DECL_symbol undeclared.

Presumably that's the culprit, we're checking for definedness.
 [2017-03-17 19:22 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2e8308260513015dbf80ff0239eca79dbca4f36e
Log: Fix bug #74265
 [2017-03-17 19:22 UTC] nikic@php.net
-Status: Open +Status: Closed
 [2017-03-17 19:23 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2017-03-17 19:23 UTC] nikic@php.net
Can you please verify that https://github.com/php/php-src/commit/2e8308260513015dbf80ff0239eca79dbca4f36e does indeed resolve the build failure?
 [2017-03-17 19:34 UTC] deferraz at terra dot com dot br
-Status: Closed +Status: Assigned
 [2017-03-17 19:34 UTC] deferraz at terra dot com dot br
Hi,

unfortunately i had the same problem on the rpm build and on a different vm using ./configure ; make after applying the patch
 [2017-03-17 19:50 UTC] nikic@php.net
Did you run ./buildconf --force prior to running ./configure?
 [2017-03-17 20:48 UTC] deferraz at terra dot com dot br
Indeed, the buildconf --force solved the problem , but i only got a successfull build against the upstream source without any patches , on my rpm spec build the problem persisted and the buildconf --force executes for every build.

There is something that I can analyze to catch the possible problem on my rpm build? The patch had applied and buildconf executes without problem, right now I am without any clues

Thanks in advance
 [2017-03-17 21:01 UTC] deferraz at terra dot com dot br
I think that i found the possible issue, on the vanilla build the config.log says that isfinite is not found, and my other build server that i do my rpm builds finds the function:

Upstream config.log snippet:
configure:131360: $? = 0
configure:131362: ./conftest
configure:131365: $? = 0
configure:131384: result: no
configure:131398: checking whether isfinite is declared
configure:131423: cc -c -I/usr/include -g -O2 -fvisibility=hidden  conftest.c >&5
conftest.c: In function 'main':
conftest.c:383: error: 'isfinite' undeclared (first use in this function)
conftest.c:383: error: (Each undeclared identifier is reported only once
conftest.c:383: error: for each function it appears in.)
configure:131429: $? = 1


My rpm build server:

configure:95014: checking whether isfinite is declared
configure:95014: cc -c -I/usr/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -Wno-pointer-sign -fvisibility=hidden  conftest.c >&5
configure:95014: $? = 0
configure:95014: result: yes


The funny thing on this situation that for what I understand those functions are related to math.h and math library that I use the original ones from CentOS distro
 [2017-03-17 22:27 UTC] deferraz at terra dot com dot br
I think i found the problem on the rpm build server:

In the new pristine server i had installed autoconf-2.59-12 m4-1.4.5-3 , and in the rpm build server i had installed autoconf-2.65 and m4-1.4.13, for that reason , on CentOS 5 that chack for isfinite function using autoconf2.65 that test doesnt fail and with autoconf-2.59 it fails (Right now I can't say why).

Using the distribution vanilla packages of autoconf/m4 that isfinite test fails and the patch that you sent builds successfully.

I am including this information on this bug report so anyone with the same problem can fix the situation

Thanks for the quick patch response and information about this issue
 [2017-03-22 13:59 UTC] kaplan@php.net
-Status: Assigned +Status: Closed
 [2017-03-22 13:59 UTC] kaplan@php.net
I had the problem with PHP 7.1.3 on AIX, and the patch fixed it. thanks.
 [2017-04-05 05:03 UTC] adi at ddns dot com dot au
ext/standard/.libs/var.o: In function `php_var_export_ex':
/root/adi/work/src/php-7.0.18RC1/ext/standard/var.c:469: undefined reference to `isfinite'
main/.libs/php_variables.o: In function `zend_dval_to_lval':
/root/adi/work/src/php-7.0.18RC1/Zend/zend_operators.h:117: undefined reference to `isfinite'
Zend/.libs/zend_operators.o: In function `zendi_smart_strcmp':
/root/adi/work/src/php-7.0.18RC1/Zend/zend_operators.c:2774: undefined reference to `isfinite'
Zend/.libs/zend_operators.o: In function `zend_dval_to_lval':
/root/adi/work/src/php-7.0.18RC1/Zend/zend_operators.h:117: undefined reference to `isfinite'
/root/adi/work/src/php-7.0.18RC1/Zend/zend_operators.h:117: undefined reference to `isfinite'
Zend/.libs/zend_operators.o:/root/adi/work/src/php-7.0.18RC1/Zend/zend_operators.h:117: more undefined references to `isfinite' follow
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
 [2017-04-05 05:05 UTC] adi at ddns dot com dot au
Sorry for the previous, incomplete comment. Still having problems building 7.0.18RC1 on CentOS 5:
ext/standard/.libs/var.o: In function `php_var_export_ex':
/root/adi/work/src/php-7.0.18RC1/ext/standard/var.c:469: undefined reference to `isfinite'
main/.libs/php_variables.o: In function `zend_dval_to_lval':
/root/adi/work/src/php-7.0.18RC1/Zend/zend_operators.h:117: undefined reference to `isfinite'
Zend/.libs/zend_operators.o: In function `zendi_smart_strcmp':
/root/adi/work/src/php-7.0.18RC1/Zend/zend_operators.c:2774: undefined reference to `isfinite'
Zend/.libs/zend_operators.o: In function `zend_dval_to_lval':
/root/adi/work/src/php-7.0.18RC1/Zend/zend_operators.h:117: undefined reference to `isfinite'
/root/adi/work/src/php-7.0.18RC1/Zend/zend_operators.h:117: undefined reference to `isfinite'
Zend/.libs/zend_operators.o:/root/adi/work/src/php-7.0.18RC1/Zend/zend_operators.h:117: more undefined references to `isfinite' follow
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
 [2017-05-02 02:46 UTC] yzaptx at gmail dot com
Sorry for the previous, incomplete comment. Still having problems building 7.0.18RC1 on CentOS 5:
ext/standard/.libs/var.o: In function `php_var_export_ex':
/root/adi/work/src/php-7.0.18RC1/ext/standard/var.c:469: undefined reference to `isfinite'
main/.libs/php_variables.o: In function `zend_dval_to_lval':
/root/adi/work/src/php-7.0.18RC1/Zend/zend_operators.h:117: undefined reference to `isfinite'
Zend/.libs/zend_operators.o: In function `zendi_smart_strcmp':
/root/adi/work/src/php-7.0.18RC1/Zend/zend_operators.c:2774: undefined reference to `isfinite'
Zend/.libs/zend_operators.o: In function `zend_dval_to_lval':
/root/adi/work/src/php-7.0.18RC1/Zend/zend_operators.h:117: undefined reference to `isfinite'
/root/adi/work/src/php-7.0.18RC1/Zend/zend_operators.h:117: undefined reference to `isfinite'
Zend/.libs/zend_operators.o:/root/adi/work/src/php-7.0.18RC1/Zend/zend_operators.h:117: more undefined references to `isfinite' follow
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
 [2017-05-03 02:09 UTC] letshi at 163 dot com
Still having problems building 7.1.4 on CentOS5.5
gcc version 4.1.2 20080704 (Red Hat 4.1.2-55)
ldd (GNU libc) 2.5

ext/standard/.libs/var.o: In function `php_var_export_ex':
/PHP/32/source/php7.1.4_zts/ext/standard/var.c:473: undefined reference to `isfinite'
main/.libs/php_variables.o: In function `zend_dval_to_lval':
/PHP/32/source/php7.1.4_zts/Zend/zend_operators.h:117: undefined reference to `isfinite'
Zend/.libs/zend_operators.o: In function `zendi_smart_strcmp':
/PHP/32/source/php7.1.4_zts/Zend/zend_operators.c:2789: undefined reference to `isfinite'
Zend/.libs/zend_operators.o: In function `zend_dval_to_lval':
/PHP/32/source/php7.1.4_zts/Zend/zend_operators.h:117: undefined reference to `isfinite'
/PHP/32/source/php7.1.4_zts/Zend/zend_operators.h:117: undefined reference to `isfinite'
Zend/.libs/zend_operators.o:/PHP/32/source/php7.1.4_zts/Zend/zend_operators.h:117: more undefined references to `isfinite' follow
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
 [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-05-03 05:59 UTC] letshi at 163 dot com
rasmus@php.net 
Thank you very much for your reply, I will update gcc.
 [2017-05-03 07:03 UTC] letshi at 163 dot com
I have some findings.
I found 7.1.2 before is no problem.
7.1.3 after the problem.

./configure --prefix=/PHP/32/target/php --with-config-file-path=/PHP/32/target/php/etc --enable-maintainer-zts --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session

>>>config.log in 7.1.2 
configure:95485: checking for isfinite
configure:95485: gcc -m32 -o conftest -I/usr/include -g -O2 -fvisibility=hidden -pthread  -D_REENTRANT  conftest.c  >&5
/tmp/ccsJhzxB.o: In function `main':
/usr/local/src/php-7.1.2/conftest.c:514: undefined reference to `isfinite'
.....
ac_cv_func_isfinite=no


>>>config.log in 7.1.3
configure:95505: checking whether isfinite is declared
configure:95505: gcc -m32 -c -I/usr/include -g -O2 -fvisibility=hidden -pthread  -D_REENTRANT conftest.c >&5
configure:95505: $? = 0
.....
ac_cv_have_decl_isfinite=yes


>>>configure for 7.1.2 
95482  for ac_func in finite isfinite isinf isnan
95483  do :
95484    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
95485  ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
95486  if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
95487    cat >>confdefs.h <<_ACEOF
95488  #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
95489  _ACEOF

>>>configure for 7.1.3
95505  ac_fn_c_check_decl "$LINENO" "isfinite" "ac_cv_have_decl_isfinite" "#include <math.h>
95506  "
95507  if test "x$ac_cv_have_decl_isfinite" = xyes; then :
95508    ac_have_decl=1
95509  else
95510    ac_have_decl=0
95511  fi
 [2017-05-03 07:30 UTC] spam2 at rhsoft dot net
The same for the whole operating system - RHEL5 is officially EOL and nobody should consider continue using it
 [2017-05-04 02:02 UTC] letshi at 163 dot com
I try modify PHP7.1.4 configure file.

I modify  lineno  95508  95519  95530
modify ac_have_decl=1 to ac_have_decl=0

Compile Success On CentOS5.5 (gcc version 4.1.2)

 95505    ac_fn_c_check_decl "$LINENO" "isfinite" "ac_cv_have_decl_isfinite" "#include <math.h>
 95506    "
 95507    if test "x$ac_cv_have_decl_isfinite" = xyes; then :
 95508      ac_have_decl=0
 95509    else
 95510      ac_have_decl=0
 95511    fi
 95512    
 95513    cat >>confdefs.h <<_ACEOF
 95514    #define HAVE_DECL_ISFINITE $ac_have_decl
 95515    _ACEOF
 95516    ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include <math.h>
 95517    "
 95518    if test "x$ac_cv_have_decl_isnan" = xyes; then :
 95519      ac_have_decl=0
 95520    else
 95521      ac_have_decl=0
 95522    fi
 95523    
 95524    cat >>confdefs.h <<_ACEOF
 95525    #define HAVE_DECL_ISNAN $ac_have_decl
 95526    _ACEOF
 95527    ac_fn_c_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include <math.h>
 95528    "
 95529    if test "x$ac_cv_have_decl_isinf" = xyes; then :
 95530      ac_have_decl=0
 95531    else
 95532      ac_have_decl=0
 95533    fi
 [2017-06-16 21:54 UTC] jon at isparks dot com
I was able to build using this:

make CC="gcc -std=gnu99"

Testing this on an old version of gcc:

gcc --version
gcc (GCC) 4.1.2 20080704
 [2019-05-31 13:06 UTC] swathybollini at gmail dot com
php release 7.3.6 build fails with follwoing errors,
ext/standard/var.o: In function `php_var_export_ex':
var.c:(.text+0x1140): undefined reference to `isfinite'
ext/standard/hrtime.o: In function `php_hrtime_current':
hrtime.c:(.text+0x2c): undefined reference to `clock_gettime'
ext/standard/hrtime.o: In function `zif_hrtime':
hrtime.c:(.text+0x124): undefined reference to `clock_gettime'
main/php_variables.o: In function `php_auto_globals_create_server':
php_variables.c:(.text+0x14c0): undefined reference to `isfinite'
Zend/zend_operators.o: In function `zendi_smart_strcmp':
zend_operators.c:(.text+0x129c): undefined reference to `isfinite'
Zend/zend_operators.o: In function `convert_to_long_base':
zend_operators.c:(.text+0x4b60): undefined ext/standard/var.o: In function `php_var_export_ex':
var.c:(.text+0x1140reference):  undefined toreference  `toisfinite'
`Zend/isfinitezend_operators.o':
 Inext /functionstandard /`hrtime.o:_zval_get_long_func_noisy ':In
 zend_operators.cfunction: (`.text+php_hrtime_current0x4e28')::
 undefinedhrtime.c reference: (to. text`+isfinite0x2c')
: zend_operators.c:undefined( .textreference+ 0x4f44)to:  `undefined clock_gettimereference'
toext /`isfinitestandard'/
Zendhrtime.o/:zend_operators.o :Inzend_operators.c :(function.text +`0x65e8)zif_hrtime: ':more
 undefinedhrtime.c :references( .to text`+isfinite'0x124 )follow:
 undefined reference to `clock_gettime'
main/php_variables.o: In function `php_auto_globals_create_server':
php_variables.c:(.text+0x14c0): undefined reference to `isfinite'
Zend/zend_operators.o: In function `zendi_smart_strcmp':
zend_operators.c:(.text+0x129c): undefined reference to `isfinite'
Zend/zend_operators.o: In function `convert_to_long_base':
collect2: zend_operators.c:(.text+0x4b60): undefined reference to `isfiniteld returned 1 exit status'
Zend
/zend_operators.o: In function `_zval_get_long_func_noisy':
zend_operators.c:(.text+0x4e28): undefined reference to `isfinite'
zend_operators.c:(.text+0x4f44): undefined reference to `isfinite'
Zend/zend_operators.o:zend_operators.c:(.text+0x65e8): more undefined references to `isfinite' follow
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
make: *** Waiting for unfinished jobs....
make: *** [sapi/cgi/php-cgi] Error 1
ext/standard/var.o: In function `php_var_export_ex':
var.c:(.text+0x1140): undefined reference to `isfinite'
ext/standard/hrtime.o: In function `php_hrtime_current':
hrtime.c:(.text+0x2c): undefined reference to `clock_gettime'
ext/standard/hrtime.o: In function `zif_hrtime':
hrtime.c:(.text+0x124): undefined reference to `clock_gettime'
main/php_variables.o: In function `php_auto_globals_create_server':
php_variables.c:(.text+0x14c0): undefined reference to `isfinite'
Zend/zend_operators.o: In function `zendi_smart_strcmp':
zend_operators.c:(.text+0x129c): undefined reference to `isfinite'
Zend/zend_operators.o: In function `convert_to_long_base':
zend_operators.c:(.text+0x4b60): undefined reference to `isfinite'
Zend/zend_operators.o: In function `_zval_get_long_func_noisy':
zend_operators.c:(.text+0x4e28): undefined reference to `isfinite'
zend_operators.c:(.text+0x4f44): undefined reference to `isfinite'
Zend/zend_operators.o:zend_operators.c:(.text+0x65e8): more undefined references to `isfinite' follow
collect2: ld returned 1 exit status
make: *** [sapi/phpdbg/phpdbg] Error 1

snapshot of config.log:
ac_cv_have_decl_isfinite=yes
configure:94926: checking whether isfinite is declared
configure:94926: powerpc-ccpu-linux-gnu-gcc -c -D_ALIZE_ -O2 -Wall -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/users/sbh/Mercurial/3.2_main/oxo_naos/libxml2/powerpc/gcc-4.1.1-glibc-2.5/include -I/users/sbh/Mercurial/3.2_main/oxo_naos/zlib/powerpc/gcc-4.1.1-glibc-2.5/include -fvisibility=hidden -D_ALIZE_ -O2 -Wall -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/users/sbh/Mercurial/3.2_main/oxo_naos/libxml2/powerpc/gcc-4.1.1-glibc-2.5/include -I/users/sbh/Mercurial/3.2_main/oxo_naos/zlib/powerpc/gcc-4.1.1-glibc-2.5/include conftest.c >&5
configure:94926: $? = 0
configure:94926: result: yes

Issue not resolved even after applying the patch given in http://git.php.net/?p=php-src.git;a=commit;h=2e8308260513015dbf80ff0239eca79dbca4f36e

gcc version used is 4.1.2
 [2019-05-31 13:21 UTC] reindl dot harald at gmail dot com
[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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 10:01:29 2024 UTC