Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';在Mac OS X上构建PHP7.1-错误:使用不同类型重新定义typedef(';long';vs';long';)_Php_Macos_Build - Fatal编程技术网

Can';在Mac OS X上构建PHP7.1-错误:使用不同类型重新定义typedef(';long';vs';long';)

Can';在Mac OS X上构建PHP7.1-错误:使用不同类型重新定义typedef(';long';vs';long';),php,macos,build,Php,Macos,Build,我试图在OS X 10.11.6上使用Xcode 8.2.1构建一个完全干净的PHP 7.1,但我遇到了以下错误: make distclean ./configure ... gawk: fatal: cannot open file `date/*.h*' for reading (No such file or directory) ... make

我试图在OS X 10.11.6上使用Xcode 8.2.1构建一个完全干净的PHP 7.1,但我遇到了以下错误:

make distclean
./configure
...
gawk: fatal: cannot open file `date/*.h*' for reading (No such file or directory)
...
make                                                                                                                                                                                                                                                                                                                   BR php-7.1 
/bin/sh /Users/myusername/Sites/php-src/libtool --silent --preserve-dup-deps --mode=compile gcc -Iext/date/lib -Iext/date/ -I/Users/myusername/Sites/php-src/ext/date/ -DPHP_ATOM_INC -I/Users/myusername/Sites/php-src/include -I/Users/myusername/Sites/php-src/main -I/Users/myusername/Sites/php-src -I/Users/myusername/Sites/php-src/ext/date/lib -I/Users/myusername/Sites/php-src/ext/ereg/regex -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 -I/Users/myusername/Sites/php-src/ext/sqlite3/libsqlite -I/Users/myusername/Sites/php-src/TSRM -I/Users/myusername/Sites/php-src/Zend  -no-cpp-precomp  -I/usr/include -g -O2 -fvisibility=hidden  -c /Users/myusername/Sites/php-src/ext/date/php_date.c -o ext/date/php_date.lo 
In file included from /Users/myusername/Sites/php-src/ext/date/php_date.c:21:
In file included from /Users/myusername/Sites/php-src/main/php.h:35:
In file included from /Users/myusername/Sites/php-src/Zend/zend.h:31:
In file included from /Users/myusername/Sites/php-src/Zend/zend_types.h:27:
In file included from /Users/myusername/Sites/php-src/Zend/zend_portability.h:52:
In file included from /Users/myusername/Sites/php-src/Zend/../TSRM/TSRM.h:23:
/Users/myusername/Sites/php-src/main/php_stdint.h:172:14: error: typedef redefinition with different types ('long' vs 'long long')
typedef long int64_t;
             ^
/usr/include/sys/_types/_int64_t.h:30:20: note: previous definition is here
typedef long long               int64_t;
                                ^
In file included from /Users/myusername/Sites/php-src/ext/date/php_date.c:21:
In file included from /Users/myusername/Sites/php-src/main/php.h:35:
In file included from /Users/myusername/Sites/php-src/Zend/zend.h:31:
In file included from /Users/myusername/Sites/php-src/Zend/zend_types.h:27:
In file included from /Users/myusername/Sites/php-src/Zend/zend_portability.h:52:
In file included from /Users/myusername/Sites/php-src/Zend/../TSRM/TSRM.h:23:
/Users/myusername/Sites/php-src/main/php_stdint.h:198:23: error: typedef redefinition with different types ('unsigned long' vs 'unsigned long long')
typedef unsigned long uint64_t;
                      ^
/usr/include/_types/_uint64_t.h:31:28: note: previous definition is here
typedef unsigned long long uint64_t;
                           ^
配置期间缺少的日期头看起来不太好,但我不清楚这是本地配置问题还是PHP源代码问题。有什么想法吗

更新根据l'l'l的建议,我尝试以其他方式进行构建。然而,从tarball构建是可行的,我更喜欢从git构建,因为我希望能够将PR提交回phpsrc,如果我这样做的话,一切都将正确跟踪。git构建步骤不是很满意:

./genfiles
Zend/zend_language_parser.y:49.1-5: invalid directive: '%code'
Zend/zend_language_parser.y:49.7-14: syntax error, unexpected identifier
make: *** [Zend/zend_language_parser.c] Error 1
+ CLEANUP_FILES='   ext/pdo/pdo_sql_parser.c   ext/date/lib/parse_date.c   ext/standard/url_scanner_ex.c   ext/standard/var_unserializer.c '
+ for f in '$CLEANUP_FILES'
+ cp ext/pdo/pdo_sql_parser.c ext/pdo/pdo_sql_parser.c.orig
+ grep -v '#line ' ext/pdo/pdo_sql_parser.c.orig
+ for f in '$CLEANUP_FILES'
+ cp ext/date/lib/parse_date.c ext/date/lib/parse_date.c.orig
+ grep -v '#line ' ext/date/lib/parse_date.c.orig
+ for f in '$CLEANUP_FILES'
+ cp ext/standard/url_scanner_ex.c ext/standard/url_scanner_ex.c.orig
+ grep -v '#line ' ext/standard/url_scanner_ex.c.orig
+ for f in '$CLEANUP_FILES'
+ cp ext/standard/var_unserializer.c ext/standard/var_unserializer.c.orig
+ grep -v '#line ' ext/standard/var_unserializer.c.orig
这个错误似乎不是致命的

./buildconf
You should not run buildconf in a release package.
use buildconf --force to override this check.
这是
PHP-7.1.0
分支的问题-
master
未显示此错误


为了确保一切都是完全干净的,我扔掉了我的克隆并重新开始——这一次,重新定义错误消失了,我的构建现在正在工作。这最终回答了我的问题-这似乎是一个本地配置问题,尽管我不知道具体是什么问题。

我建议尝试稳定版本的。使用不稳定的alpha/beta/dev版本可能会遇到一些问题(您尝试编译的版本在技术上是“不稳定的”7.2.0)。稳定版本还包含所有正确的构建脚本,因此启动和运行起来非常简单

$ curl --location --output php-7.1.0.tar.gz http://ca3.php.net/get/php-7.1.0.tar.gz/from/this/mirror
$ tar -xzvf php-7.1.0.tar.gz
$ cd php-7.1.0
$ ./configure
$ make
$ make test
测试结果

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :   48
Exts tested     :   26
---------------------------------------------------------------------

Number of tests : 15222            10166
Tests skipped   :  5056 ( 33.2%) --------
Tests warned    :     1 (  0.0%) (  0.0%)
Tests failed    :     4 (  0.0%) (  0.0%)
Expected fail   :    35 (  0.2%) (  0.3%)
Tests passed    : 10126 ( 66.5%) ( 99.6%)
---------------------------------------------------------------------
Time taken      :  228 seconds
=====================================================================

PHP_VERSION : 7.1.0
ZEND_VERSION: 3.1.0-dev
PHP_OS      : Darwin - Darwin Orion.local 16.3.0 Darwin Kernel Version 16.3.0: 
Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64
如果您想继续使用版本,编译的唯一区别在于需要事先生成生成脚本:

$ git clone https://github.com/php/php-src.git
$ cd php-src 
$ ./genfiles
$ ./buildconf
$ ./configure
$ make
$ make test 

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :   47
Exts tested     :   26
---------------------------------------------------------------------

Number of tests : 15223            10218
Tests skipped   :  5005 ( 32.9%) --------
Tests warned    :     1 (  0.0%) (  0.0%)
Tests failed    :     3 (  0.0%) (  0.0%)
Expected fail   :    36 (  0.2%) (  0.4%)
Tests passed    : 10178 ( 66.9%) ( 99.6%)
---------------------------------------------------------------------
Time taken      :  233 seconds
=====================================================================

PHP_VERSION : 7.2.0-dev
ZEND_VERSION: 3.2.0-dev
PHP_OS      : Darwin - Darwin Orion.local 16.3.0 Darwin Kernel Version 16.3.0: 
Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64

您为什么选择
构建
路线而不是使用
brew
?我正在为PHP中的一个问题进行修复,因此我需要能够编译它。我也有它安装从自制,但这是一个工作的建设,我不需要触摸。啊。。。有道理。希望你能用深度日志(不确定)来编写,并找出它们的构建与你的不同之处。我怀疑homebrew会添加很多额外的东西来处理本地配置路径、扩展包和多版本支持——我不需要这些,只需要构建核心二进制文件,而不需要额外的东西。OSX是一个受支持的开箱即用的操作系统,所以这应该可以工作-在我报告PHP错误之前,我不知道这是PHP错误还是本地配置问题…@Synchro:不客气!这对你有帮助吗?我猜是你编辑的。如果原始克隆在编译过程中已经弄糟了,我发现最好还是从新的克隆开始。一旦我发现genfiles和buildconf中看起来致命的错误实际上不是致命的,它就可以正常运行了!即将推出我的第一个php src程序。。。