2014-10-19 127 views
2

我试图在优胜美地上编译php(5.5.18,版本并不重要),但它在链接阶段失败。它看起来像一些Apache的符号消失了?在MacOSX 10.10上编译php5.5.18时出错(优胜美地)

(下面的工作完美的美洲狮,但未能在优胜美地)

cc -bundle -bundle_loader /usr/sbin/httpd -L/usr/lib -laprutil-1 -lldap -llber -lexpat -liconv -lsqlite3 -lldap -llber -L/usr/lib -lapr-1 -lpthread -I/usr/include -g -O2 -fvisibility=hidden -arch x86_64 -bind_at_load 
<SNIP> 
sapi/apache2handler/php_functions.o main/internal_functions.o -lcrypto -lssl -lcrypto -lz -lexslt -ltidy -lresolv -ledit -lncurses -lltdl -lldap -llber -lstdc++ -liconv -liconv -lz -lcrypto -lssl -lcrypto -lcurl -lbz2 -lz -lcrypto -lssl -lcrypto -lm -lxml2 -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lcurl -lxml2 -lz -lbz2 -lxml2 -lnetsnmp -lcrypto -lxml2 -lxml2 -lxml2 -lxml2 -lxml2 -lxml2 -lxml2 -lxslt -o libs/libphp5.bundle && cp libs/libphp5.bundle libs/libphp5.so 
Undefined symbols for architecture x86_64: 
    "_ap_get_server_version", referenced from: 
     _zif_apache_get_version in php_functions.o 
     _zm_info_apache in php_functions.o 
    "_ap_log_error", referenced from: 
     _php_pre_config in sapi_apache2.o 
     _php_handler in sapi_apache2.o 
     _php_apache_sapi_log_message in sapi_apache2.o 
    "_ap_log_rerror", referenced from: 
     _php_handler in sapi_apache2.o 
     _php_apache_sapi_log_message in sapi_apache2.o 
    "_unixd_config", referenced from: 
     _zm_info_apache in php_functions.o 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 
make: *** [libs/libphp5.bundle] Error 1 

任何想法?我检查了/usr/lib/libapr-1.dylib(使用nm -g)并且符号不存在。我通常应该在哪里找到这些符号?这是缺少一个库?真奇怪的是,我的自定义构建脚本在10.9上运行正常,但在10.10上运行失败。

感谢您的帮助! 萨科

+0

这可能不是直接回答你的问题,但考虑使用macports或home brew来安装php?另外,我认为OSx默认带有apache和PHP? – 2014-10-19 19:20:57

+0

@MatthewBrown Homebrew目前在优胜美地上断了。 – Qix 2014-10-19 19:28:31

+0

@Qix homebrew在优胜美地上工作得很好!你到底在说什么? – 2014-10-19 19:46:29

回答

2

原来,它是使用以下包含路径:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/apache2/ 

,而不是正常之一:

/usr/include/apache2/ 

一些更多的信息:

$ xcodebuild -version -sdk macosx 

MacOSX10.9.sdk - OS X 10.9 (macosx10.9) 
SDKVersion: 10.9 
Path: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk 
PlatformVersion: 1.1 
PlatformPath: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform 
ProductBuildVersion: 13F26 
ProductCopyright: 1983-2014 Apple Inc. 
ProductName: Mac OS X 
ProductUserVisibleVersion: 10.9.5 
ProductVersion: 10.9.5 

奇怪,我希望它能帮助别人。

最佳, 尼古拉斯

+0

如果你安装Xcode 6.1,你会得到'10。创建该目录的10个版本:'/ Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/apache2'。仅供参考:Mavericks随Apache 2.2和Yosemite随Apache 2.4一起发货。这些库有一些不同之处。 – Asaph 2014-10-21 17:18:37

0

在第一安装的Xcode 6.1,则:

sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include /usr/include 
0

我用MacPorts的安装一些库(比如mcrypt的),然后我编译5.5.18源代码(与Xcode命令行)使用以下./configure命令:

./configure --prefix =/usr --mandir =/usr/share/man --infodir =/usr/share/info - -sysconfdir =/private/etc --enable-gd-native-ttf --with-icu-dir =/usr --with-ldap =/usr --with-ldap-sasl =/usr --with-libedit =/usr --enable -mbstring --enable-mbregex --with- mysql = mysqlnd --with-mysqli = mysqlnd --without-pear --with-pear = no --with-pdo-mysql = mysqlnd --with-mysql-sock =/tmp/mysql.sock --with-readline =/usr --enable-shmop --with-snmp =/usr --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --enable- wddx --with-xmlrpc --with-iconv-dir =/usr --with-xsl =/usr --enable-zip --with-mcrypt =/opt/local/include --without-iconv --with- freetype-dir =/opt/local --with-apxs2 =/usr/sbin/apxs --with-openssl =/usr --with-curl =/usr --with-zlib =/usr --with-bz2 =/usr

相关问题