php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70797 Error while making PHP7
Submitted: 2015-10-26 17:25 UTC Modified: 2015-10-27 09:06 UTC
From: php dot net at sjappa dot nl Assigned:
Status: Closed Package: hash (PECL)
PHP Version: 7.0Git-2015-10-26 (Git) OS: Ubuntu 14.04 LTS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php dot net at sjappa dot nl
New email:
PHP Version: OS:

 

 [2015-10-26 17:25 UTC] php dot net at sjappa dot nl
Description:
------------
The following error occured after several minutes trying to make php7 on Ubuntu 14.04

de -g -O2 -fvisibility=hidden   -c /home/user/php7/php-src/ext/hash/hash_sha3.c -o ext/hash/hash_sha3.lo
/home/user/php7/php-src/ext/hash/hash_sha3.c: In function ‘load64’:
/home/user/php7/php-src/ext/hash/hash_sha3.c:42:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (unsigned char i = 7; i >= 0; --i) {
  ^
/home/user/php7/php-src/ext/hash/hash_sha3.c:42:2: note: use option -std=c99 or -std=gnu99 to compile your code
/home/user/php7/php-src/ext/hash/hash_sha3.c: In function ‘store64’:
/home/user/php7/php-src/ext/hash/hash_sha3.c:49:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (unsigned char i = 0; i < 8; ++i) {
  ^
/home/user/php7/php-src/ext/hash/hash_sha3.c:50:3: error: assignment of read-only location ‘*(x + (sizetype)((unsigned int)i * 1u))’
   x[i] = val & 0xFF;
   ^
/home/user/php7/php-src/ext/hash/hash_sha3.c: In function ‘xor64’:
/home/user/php7/php-src/ext/hash/hash_sha3.c:55:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (unsigned char i = 0; i < 8; ++i) {
  ^
/home/user/php7/php-src/ext/hash/hash_sha3.c:56:3: error: assignment of read-only location ‘*(x + (sizetype)i)’
   x[i] ^= val & 0xFF;
   ^
make: *** [ext/hash/hash_sha3.lo] Error 1

Test script:
---------------
in /home/user/php7 i did:

git clone https://git.php.net/repository/php-src.git

cd php-src

./buildconf

./configure \
--prefix=/usr \
--with-config-file-path=/etc \
--enable-mbstring \
--enable-zip \
--enable-bcmath \
--enable-pcntl \
--enable-ftp \
--enable-exif \
--enable-calendar \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-curl \
--with-mcrypt \
--with-iconv \
--with-gmp \
--with-pspell \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-zlib-dir=/usr \
--with-xpm-dir=/usr \
--with-freetype-dir=/usr \
--with-t1lib=/usr \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-openssl \
--with-pdo-mysql=/usr \
--with-gettext=/usr \
--with-zlib=/usr \
--with-bz2=/usr \
--with-recode=/usr \
--with-mysqli=/usr/bin/mysql_config

then

make


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-10-27 02:08 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=69beb29e158a5658217a591c64cbb05f96df1d0c
Log: Fixed Bug #70797 (Error while making PHP7)
 [2015-10-27 02:08 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2015-10-27 09:06 UTC] php dot net at sjappa dot nl
Thanks, found the solution myself also. Unfortunately, another error appears:

/home/user/php7/php-src/ext/hash/hash_sha3.c: In function ‘store64’:
/home/user/php7/php-src/ext/hash/hash_sha3.c:52:3: error: assignment of read-only location ‘*(x + (sizetype)((unsigned int)i * 1u))’
 x[i] = val & 0xFF;
 ^
/home/user/php7/php-src/ext/hash/hash_sha3.c: In function ‘xor64’:
/home/user/php7/php-src/ext/hash/hash_sha3.c:59:3: error: assignment of read-only location ‘*(x + (sizetype)i)’
 x[i] ^= val & 0xFF;
 ^

I fixed it by removing the const type in the function, see below:

replacing lines
 - static inline void store64(const unsigned char* x, php_hash_uint64 val) {
 + static inline void store64(unsigned char* x, php_hash_uint64 val) {

 - static inline void xor64(const unsigned char* x, php_hash_uint64 val) {
 + static inline void xor64(unsigned char* x, php_hash_uint64 val) {
 [2016-04-18 09:30 UTC] bwoebi@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=69beb29e158a5658217a591c64cbb05f96df1d0c
Log: Fixed Bug #70797 (Error while making PHP7)
 [2016-07-20 11:35 UTC] davey@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=69beb29e158a5658217a591c64cbb05f96df1d0c
Log: Fixed Bug #70797 (Error while making PHP7)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 13:01:28 2025 UTC