|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 13:00:01 2025 UTC |
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) {