php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42502 GCC no longer implements <varargs.h>
Submitted: 2007-08-31 18:07 UTC Modified: 2007-09-18 21:38 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: supportnew at byethost dot com Assigned: hirokawa (profile)
Status: Closed Package: mbstring related
PHP Version: 5.2.4 OS: debian linux 4
Private report: No CVE-ID: None
 [2007-08-31 18:07 UTC] supportnew at byethost dot com
Description:
------------
When compiling the stable 5.2.4 branch of php the compile process dies at the same point.


I have tried this on 3 seperate servers (using the different versions of GCC )

Reproduce code:
---------------
download stable, configure with

./configure  --prefix=/usr/phpapache2 --with-apxs2=/usr/local/apache2/bin/apxs --disable-cgi --with-config-file-path=/etc/php4/apache --enable-inline-optimization --enable-memory-limit --disable-debug --disable-rpath --disable-static --with-layout=GNU --with-pear=/usr/share/php --enable-calendar --enable-track-vars --enable-trans-sid --enable-bcmath --without-bz2 --disable-ctype --with-iconv --enable-exif --disable-ftp --with-gettext --enable-mbstring --disable-sockets --disable-wddx --with-xsl --with-expat-dir=/usr --disable-yp --with-zlib --without-pgsql --without-openssl --with-zip=/usr --disable-dbx --with-exec-dir=/usr/lib/php4/libexec --with-mcrypt --without-sybase-ct --with-mysql=/usr --with-zlib-dir=/usr --with-gd=/usr/local/gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr --with-ttf=shared,/usr --with-t1lib --with-freetype-dir=/usr --enable-gd-native-ttf --with-sqlite --with-mysqli --with-xsl --enable-ctype --with-pdo-mysql --without-pdo-sqlite --with-pspell

using 

gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --with-tune=i686 --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)


config.log can be found here

http://byet.org/config.log

Expected result:
----------------
no errors.

Actual result:
--------------
In file included from /root/php-5.2.4/ext/mbstring/oniguruma/regerror.c:37:
/usr/lib/gcc/i486-linux-gnu/4.1.2/include/varargs.h:4:2: error: #error "GCC no longer implements <varargs.h>."
/usr/lib/gcc/i486-linux-gnu/4.1.2/include/varargs.h:5:2: error: #error "Revise your code to use <stdarg.h>."
/root/php-5.2.4/ext/mbstring/oniguruma/regerror.c: In function 'onig_error_code_to_str':
/root/php-5.2.4/ext/mbstring/oniguruma/regerror.c:196: error: expected declaration specifiers before 'va_dcl'
/root/php-5.2.4/ext/mbstring/oniguruma/regerror.c:265: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'OnigUChar'
/root/php-5.2.4/ext/mbstring/oniguruma/regerror.c:271: error: expected declaration specifiers before 'va_dcl'
/root/php-5.2.4/ext/mbstring/oniguruma/regerror.c:270: error: declaration for parameter 'fmt' but no such parameter
/root/php-5.2.4/ext/mbstring/oniguruma/regerror.c:269: error: declaration for parameter 'pat_end' but no such parameter
/root/php-5.2.4/ext/mbstring/oniguruma/regerror.c:268: error: declaration for parameter 'pat' but no such parameter
/root/php-5.2.4/ext/mbstring/oniguruma/regerror.c:267: error: declaration for parameter 'enc' but no such parameter
/root/php-5.2.4/ext/mbstring/oniguruma/regerror.c:266: error: declaration for parameter 'bufsize' but no such parameter
/root/php-5.2.4/ext/mbstring/oniguruma/regerror.c:334: error: expected '{' at end of input
make: *** [ext/mbstring/oniguruma/regerror.lo] Error 1


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-03 08:17 UTC] jani@php.net
Assigned to the mbstring maintainer.
 [2007-09-04 14:06 UTC] hirokawa@php.net
Please show me if HAVE_STDARG_PROTOTYPES and HAVE_STDARG_H are
 defined or not in your main/config.h

I think that HAVE_STDARG_PROTOTYPES isn't properly defined.
If it is not defined stdarg.h is not existing in you include path.

 [2007-09-11 20:39 UTC] supportnew at byethost dot com
Hi ,

 find -name config.h
./ext/pcre/pcrelib/config.h
./ext/pdo_sqlite/sqlite/src/config.h
./ext/bcmath/libbcmath/src/config.h
./ext/mbstring/libmbfl/config.h
./ext/mbstring/oniguruma/win32/config.h
./ext/mbstring/oniguruma/config.h
./ext/sqlite/libsqlite/src/config.h

I cant see a file called main/config.h could this be the cause ? 

This is a direct extract from php-5.2.4.tar.bz2 sources.
 [2007-09-11 20:44 UTC] supportnew at byethost dot com
ahh , the file 

main/php_config.h exists , and

the following values are present

/* Define if stdarg.h is available */
/* #undef HAVE_STDARG_PROTOTYPES */


/* Define if you have the <stdarg.h> header file.  */
#define HAVE_STDARG_H 1
 [2007-09-12 11:58 UTC] jani@php.net
Rui, feedback given.
 [2007-09-13 05:31 UTC] chris at acu dot edu
This problem is also reproduceable on Solaris 10.

./configure --prefix=/opt/php-5.2.4
--with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-libxml-dir=/usr --enable-calendar --with-gd=/usr/local --with-ttf=/usr --with-freetype-dir=/usr --enable-exif --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xsl --with-pdo-sqlite --with-pdo-mysql=/usr/local/mysql --with-pear --with-iconv=/usr/local --enable-ftp --with-curl=/opt/php-5.2.4 --enable-mbstring --enable-embedded-mysqli --with-gettext

using

$ gcc -v
Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/specs
Configured with: /builds2/sfwnv-gate/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++,f77,objc --enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-20050802)

produces the same error as supportnew at byethost dot com
 [2007-09-16 09:52 UTC] hirokawa@php.net
#include <stdarg.h>
int foo(int x, ...) {
	va_list va;
	va_start(va, x);
	va_arg(va, int);
	va_arg(va, char *);
	va_arg(va, double);
	return 0;
}
int main() { 
return foo(10, "", 3.14); 
}
 [2007-09-16 09:56 UTC] hirokawa@php.net
The variable length argument defined in stdarg.h is not properly
detected for your system.

A possible workaround is force to define HAVE_STDARG_PROTOTYPES
in your main/php_config.h

#define HAVE_STDARG_PROTOTYPES 1

Could you show me the return code of 
a small program shown bellow ?

sample.c

#include <stdarg.h>
int foo(int x, ...) {
	va_list va;
	va_start(va, x);
	va_arg(va, int);
	va_arg(va, char *);
	va_arg(va, double);
	return 0;
}
int main() { 
  return foo(10, "", 3.14); 
}

> gcc sample.c -o sample



 [2007-09-16 15:59 UTC] supportnew at byethost dot com
I done the following

web3:~# cd /root
web3:~# vi sample.c
web3:~# gcc sample.c -o sample
web3:~# ./sample
web3:~#                            

web3:~# cat sample.c
#include <stdarg.h>
int foo(int x, ...) {
        va_list va;
        va_start(va, x);
        va_arg(va, int);
        va_arg(va, char *);
        va_arg(va, double);
        return 0;
}
int main() {
  return foo(10, "", 3.14);
}

on running the compiled sample nothing is returned.

Just a note, php 5.2.3 compiles file still on the same servers / with same gcc, etc.
 [2007-09-18 21:38 UTC] hirokawa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Detection routine for stdarg.h in ext/mbstring/config.m4 is modified/simplified.



 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC