php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48317 Error in dns.h
Submitted: 2009-05-18 17:54 UTC Modified: 2009-05-20 05:19 UTC
From: jf at netmadeira dot com Assigned: fb-req-jani (profile)
Status: Closed Package: Compile Failure
PHP Version: 5.3CVS-2009-05-18 (snap) OS: linux
Private report: No CVE-ID: None
 [2009-05-18 17:54 UTC] jf at netmadeira dot com
Description:
------------
Cross compiling php for mipsel fails in 5.3 RC2 while in 5.2.9 compiles fine. 
Configure went fine, fails when making with this error:
/wdtv/wip/php-5.3.0/php5.3-snap/ext/standard/basic_functions.c:3007: error: 'zif_dns_check_record' undeclared here (not in a function)
make: *** [ext/standard/basic_functions.lo] Error 1


Reproduce code:
---------------
./configure \
--target=mipsel-linux \
--host=mipsel-linux \
--build=i386 \
--prefix=${install} \
--bindir=${install}/bin \
--sbindir=${install}/bin \
--mandir=${install}/share/man \
--enable-sockets \
--with-config-file-path=${install0}/conf \
--without-pear \
--without-mysql \
--without-mysql \
--without-apxs \
--without-apxs2 \
--disable-cli \
--with-zlib=$wdtvpath \
--with-zlib-dir=$wdtvpath \
--enable-pdo=shared \
--with-pdo-sqlite=shared \
--with-sqlite=shared \
--with-sqlite3=shared \
--enable-sqlite-utf8 \
--with-libxml-dir=$wdtvpath \
--with-curl=$wdtvpath \
--enable-shared \
--enable-exif \
--with-gd=shared \
--with-jpeg-dir=$wdtvpath \
--with-png-dir=$wdtvpath \
--with-freetype-dir=$wdtvpath \
--with-openssl=$wdtvpath \
--with-openssl-dir=$wdtvpath \
--enable-gd-native-ttf \
--with-xsl=$wdtvpath \
--with-iconv=$wdtvpath \
--with-bz2=$wdtvpath \
--enable-calendar \
--with-ldap=$wdtvpath \
--enable-zip \
--with-readline=$wdtvpath \
--with-pcre-regex \
--enable-ftp \
--with-mcrypt=$wdtvpath \


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-18 18:16 UTC] jf at netmadeira dot com
Just to add more info on the error:
/bin/sh /wdtv/wip/php-5.3.0/php5.3-snap/libtool --silent --preserve-dup-deps --mode=compile mipsel-linux-gcc  -Iext/standard/ -I/wdtv/wip/php-5.3.0/php5.3-snap/ext/standard/ -DPHP_ATOM_INC -I/wdtv/wip/php-5.3.0/php5.3-snap/include -I/wdtv/wip/php-5.3.0/php5.3-snap/main -I/wdtv/wip/php-5.3.0/php5.3-snap -I/wdtv/wip/php-5.3.0/php5.3-snap/ext/date/lib -I/wdtv/wip/php-5.3.0/php5.3-snap/ext/ereg/regex -I/usr/wdtvtool/include/libxml2 -I/tmp/.webspath/usr/include -I/tmp/.webspath/usr/include/freetype2 -I/wdtv/wip/php-5.3.0/php5.3-snap/ext/sqlite3/libsqlite -I/usr/wdtvtool/include -I/wdtv/wip/php-5.3.0/php5.3-snap/TSRM -I/wdtv/wip/php-5.3.0/php5.3-snap/Zend  -I/usr/wdtvtool/include -D_XPG_IV  -I/tmp/.webspath/usr/include -fvisibility=hidden  -c /wdtv/wip/php-5.3.0/php5.3-snap/ext/standard/basic_functions.c -o ext/standard/basic_functions.lo 
/wdtv/wip/php-5.3.0/php5.3-snap/ext/standard/basic_functions.c:3007: error: 'zif_dns_check_record' undeclared here (not in a function)
make: *** [ext/standard/basic_functions.lo] Error 1
 [2009-05-18 18:28 UTC] jani@php.net
Sorry, cross-compiling is not supported. If it works, fine, if you can 
provide patches to fix issues, even better, but we are not going to try 
fix them ourselves. 
 [2009-05-18 18:49 UTC] jf at netmadeira dot com
Ok, I understand..
Do you have at least an ideia of what is causing it?? Maybe I can try to fix it myself..

Best regards
 [2009-05-18 20:16 UTC] jf at netmadeira dot com
Whele, it seems its not cross-compiling fault!
ext/standard/dns.h has this rule for dns_get_record fucntion:

#if defined(PHP_WIN32) || (HAVE_RES_SEARCH && !(defined(__BEOS__) || defined(NETWARE)))

# if defined(PHP_WIN32) || (HAVE_DN_SKIPNAME && HAVE_DN_EXPAND)
PHP_FUNCTION(dns_get_mx);
PHP_FUNCTION(dns_check_record);
# endif

#if defined(PHP_WIN32) || HAVE_DNS_FUNCS
PHP_FUNCTION(dns_get_record);
PHP_MINIT_FUNCTION(dns);
# endif

in ext/standard/basic_functions.c the prepocessor rule to define(/or not) php dns_get_record function is:
#if defined(PHP_WIN32) || (HAVE_RES_SEARCH && !(defined(__BEOS__) || defined(NETWARE)))

so, something is triggering the defenition of this function somewhere else, think that this rule must be revised..
 [2009-05-18 20:25 UTC] jf at netmadeira dot com
Sorry to post again, but checked 5.2.9 basic_functions.h

and the rule was:
#if HAVE_RES_SEARCH && !(defined(__BEOS__) || defined(PHP_WIN32) || defined(NETWARE))

in 5.3.0 bracket was added before HAVE_RES_SEARCH, think its that what is triggering this.
 [2009-05-18 20:28 UTC] pajoye@php.net
Feel free to send a patch (cvs diff -up :)


 [2009-05-18 21:22 UTC] jf at netmadeira dot com
well, I'm trying to do that, but its first time working with cvs..
 [2009-05-18 22:16 UTC] jf at netmadeira dot com
Ok, cvs is not the best help here, because for fix this bug I would need to study lots of code to now what is really breaking here, so, I'll point what I think its bad, and what I done to fix the error to myself!!

The rules to define the PHP_FUNCTION(dns_check_record) are:

header: dns.h
#if defined(PHP_WIN32) || (HAVE_RES_SEARCH && !(defined(__BEOS__) || defined(NETWARE)))
# if defined(PHP_WIN32) || (HAVE_DN_SKIPNAME && HAVE_DN_EXPAND)
PHP_FUNCTION(dns_check_record);
(...)

function code: dns.c
#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32) || defined(NETWARE))
(...)
PHP_FUNCTION(dns_check_record)
{
(...)



Adding the function to php functions list: basic_functions.c
#if defined(PHP_WIN32) || (HAVE_RES_SEARCH && !(defined(__BEOS__) || defined(NETWARE)))
PHP_FE(dns_check_record,arginfo_dns_check_record)
PHP_FALIAS(checkdnsrr,dns_check_record,arginfo_dns_check_record)
#endif

What I see is that in three cases, the rules are different in all, so
sometimes the header can be defines and the function not, or like in mine, the function is defined but header not!!

Clearly are some conflicts of rules here, but can't really tell what, without studing the code.

What I made to fix for myself was:
diff -u -p -r1.1.1.1 dns.h
--- standard/dns.h	18 May 2009 21:39:19 -0000	1.1.1.1
+++ standard/dns.h	18 May 2009 22:14:09 -0000
@@ -49,9 +49,9 @@ PHP_FUNCTION(gethostname);
 
 #if defined(PHP_WIN32) || (HAVE_RES_SEARCH && !(defined(__BEOS__) || defined(NETWARE)))
 
+PHP_FUNCTION(dns_check_record);
 # if defined(PHP_WIN32) || (HAVE_DN_SKIPNAME && HAVE_DN_EXPAND)
 PHP_FUNCTION(dns_get_mx);
-PHP_FUNCTION(dns_check_record);
 # endif
 
 #if defined(PHP_WIN32) || HAVE_DNS_FUNCS


Hope some developer could fix the mess with those rules...
 [2009-05-19 11:14 UTC] jani@php.net
Please try this snapshot: http://snaps.php.net/php5.2-latest.tar.gz
I unified the macro usage in this mess we call dns.* :)

(give it an hour or two before you download so the snapshot actually has the changes)

 [2009-05-19 11:14 UTC] jani@php.net
I asked you to try the 5.2 snapshot, but I fixed it across the branches so any will do. :)
 [2009-05-19 16:05 UTC] jf at netmadeira dot com
I see you changed dns.c to macro mach with macro of basic_functions.c, and that is how it was suposed to be.. But the problem I have persists, because in dns.h its not defining the header of this functions, because its beeing restricted by another rule/macro:
# if defined(PHP_WIN32) || (HAVE_DN_SKIPNAME && HAVE_DN_EXPAND)

So, what I sugest is to move PHP_FUNCTION(dns_check_record); outside this macro, so it can match elsewhere this header is needed and respect the common macro: #if defined(PHP_WIN32) || (HAVE_RES_SEARCH && !(defined(__BEOS__) || defined(NETWARE)))


Best regards,
Jo?o Henriques
 [2009-05-19 19:40 UTC] jani@php.net
With PHP 5.2 snapshot this didn't exist even. Please try the 5.3 
snapshot in about hour. Should be fixed now..
 [2009-05-20 05:19 UTC] jf at netmadeira dot com
Now its fine (:
BTW, found another bug and posted in another thread..

Best regards
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 17:01:33 2025 UTC