Bug #68987 [Opn]: Failed to compile zend.c with gcc-4.9.2

From: Date: Thu, 05 Feb 2015 08:48:23 +0000
Subject: Bug #68987 [Opn]: Failed to compile zend.c with gcc-4.9.2
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190474@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68987&edit=1

 ID:                 68987
 Updated by:         laruence@php.net
 Reported by:        191919 at gmail dot com
 Summary:            Failed to compile zend.c with gcc-4.9.2
 Status:             Open
 Type:               Bug
 Package:            Compile Failure
 Operating System:   OS X
 PHP Version:        master-Git-2015-02-05 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

interesting , but why no such error before...


Previous Comments:
------------------------------------------------------------------------
[2015-02-05 08:07:21] 191919 at gmail dot com

Description:
------------
On my OS X Yosemite 10.10.2, gcc-4.9.2 failed to compile zend.c.

$ uname -a
Darwin localhost 14.1.0 Darwin Kernel Version 14.1.0: Mon Dec 22 23:10:38 PST 2014;
root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64

$ /opt/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/opt/bin/gcc
COLLECT_LTO_WRAPPER=/opt/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/lto-wrapper
Target: x86_64-apple-darwin14.0.0
Configured with: ../gcc-4.9.2/configure --prefix=/opt --enable-languages=c,c++,objc,obj-c++
Thread model: posix

$ CC=/opt/bin/gcc CFLAGS="-O3 -mssse3 -ftree-vectorize -funroll-loops -fomit-frame-pointer
-fno-stack-protector -fno-exceptions" ./configure --prefix=/opt/php7
$ make

... (a lot of lines omitted) ...

/bin/sh /Users/xx/box/php-src/libtool --silent --preserve-dup-deps --mode=install cp
ext/opcache/opcache.la /Users/xx/box/php-src/modules
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file:
/Users/xx/box/php-src/modules/opcache.a(shared_alloc_shm.o) has no symbols
/bin/sh /Users/xx/box/php-src/libtool --silent --preserve-dup-deps --mode=compile /opt/bin/gcc 
-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -IZend/ -I/Users/xx/box/php-src/Zend/ -DPHP_ATOM_INC
-I/Users/xx/box/php-src/include -I/Users/xx/box/php-src/main -I/Users/xx/box/php-src
-I/Users/xx/box/php-src/ext/date/lib -I/Users/xx/box/php-src/ext/ereg/regex
-I/usr/local/include/libxml2 -I/Users/xx/box/php-src/ext/sqlite3/libsqlite
-I/Users/xx/box/php-src/TSRM -I/Users/xx/box/php-src/Zend    -I/usr/include -O3 -mssse3
-ftree-vectorize -funroll-loops -ffast-math -fomit-frame-pointer -fno-stack-protector
-fno-exceptions -fvisibility=hidden  -c /Users/xx/box/php-src/Zend/zend.c -o Zend/zend.lo 
In file included from /Users/xx/box/php-src/Zend/zend.c:22:0:
/Users/xx/box/php-src/Zend/zend.h:86:30: error: redefinition of 'zend_error'
 # define zend_error_noreturn zend_error
                              ^
/Users/xx/box/php-src/Zend/zend.c:1214:29: note: in expansion of macro
'zend_error_noreturn'
 ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...)
                             ^
/Users/xx/box/php-src/Zend/zend.c:1205:15: note: previous definition of 'zend_error' was
here
 ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
               ^
make: *** [Zend/zend.lo] Error 1

I checked the problem lines in zend.c:

#if (defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) &&
!defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__))
void zend_error_noreturn(int type, const char *format, ...) __attribute__
((alias("zend_error"),noreturn));
#elif defined(ZEND_WIN32) || defined(DARWIN)
ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
{
	va_list va;

	va_start(va, format);
	zend_error_va_list(type, format, va);
	va_end(va);
}

ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...)
{
	va_list va;

	va_start(va, format);
	zend_error_va_list(type, format, va);
	va_end(va);
}
/* }}} */
#endif

As defined in zend.h:

#ifdef HAVE_NORETURN
# if defined(ZEND_WIN32)
ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...);
# else
void zend_error_noreturn(int type, const char *format, ...) ZEND_NORETURN;
# endif
#else
# define zend_error_noreturn zend_error
#endif

zend_error_noreturn is defined as zend_error, so

ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...)

is expanded to

ZEND_API ZEND_NORETURN void zend_error(int type, const char *format, ...)

which is already defined.



Expected result:
----------------
Compilation succeeds.

Actual result:
--------------
Compilation failed.


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



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


Thread (8 messages)

« previous php.bugs (#190474) next »