2017-01-02 18 views
2

我試圖用Xcode 8.2.1從the official php-src/PHP-7.1.0 branch on github構建一個完全乾淨的PHP 7.1 OS X 10.11.6,但我得到這個錯誤:無法在Mac OS X上構建PHP 7.1 - 錯誤:使用不同類型的typedef重定義('long'vs'long long')

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提交回php-src,並且如果我這樣做,一切都將正確跟蹤。 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不顯示此錯誤。

爲了確保一切都完全清潔,我拋棄了我的克隆並重新開始 - 這一次重新定義錯誤消失了,我的構建正在工作。最終這回答我的問題 - 這似乎是一個本地配置問題,但我不知道究竟是什麼。

+0

任何特定的原因(只是好奇)爲什麼你會去'建立'路線,因爲○專注於使用'brew'? – YvesLeBorg

+1

我正在解決PHP中的問題,所以我需要能夠編譯它。我也有它從自制軟件安裝,但這是一個我不需要觸摸的工作版本。 – Synchro

+0

啊......說得通。你可以用深度記錄(不確定)來釀造,並找出它們的構造與你的構造有何不同。 – YvesLeBorg

回答

1

我會推薦嘗試穩定版本的。使用不穩定的alpha/beta/dev版本會遇到一些問題(您嘗試編譯的版本在技術上來說是「unstable」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版本編譯的唯一的區別是在需要事先生成構建腳本:

$ 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 
+0

感謝。請參閱我的Q. – Synchro

+0

更新@Synchro:不客氣!所以這對你有幫助嗎?我猜它是從你的編輯中完成的。如果在編譯過程中原始的克隆已經搞亂了,我發現最好從新開始。 –

+0

一旦我發現來自genfiles和buildconf的致命外觀錯誤實際上並不致命,它就很好!正要推我的第一個php-src PR ... – Synchro

相關問題