I'm trying to build PHP on my new computer with this configuration:
我正在尝试在我的新电脑上构建PHP,配置如下:
export MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS="-arch x86_64" CXXFLAGS="-arch x86_64" LIBS=-lresolv
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib
./configure --prefix=/usr/local --with-apxs2=/usr/sbin/apxs --with-ldap=/usr --with-kerberos=/usr --enable-cli --with-zlib-dir=/usr --enable-exif --enable-ftp --enable-mbstring --enable-mbregex --enable-sockets --with-iodbc=/usr --with-curl=/usr --with-config-file-path=/etc --sysconfdir=/private/etc --with-mysql-sock=/var/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql=/usr/local/mysql --with-openssl=/usr --with-xmlrpc --with-xsl=/usr --without-pear --with-libxml-dir=/usr --with-iconv=/usr/local --with-pdo-mysql=/usr/local/mysql/bin/mysql_config --with-gd --with-jpeg-dir=/usr/local/Cellar --with-png-dir=/usr/X11 --with-freetype-dir=/usr/X11 --with-mcrypt=/usr/local/Cellar --enable-pcntl
The configuration runs fine, but when I try to run "make" it ends up at this error:
配置运行良好,但当我尝试运行“make”时,它会出现以下错误:
Generating phar.phar
dyld: Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/mdiamond/Downloads/php-5.3.8/sapi/cli/php
Reason: image not found
make: *** [ext/phar/phar.phar] Trace/BPT trap: 5
This is pretty bizarre, considering I specified "export DYLD_LIBRARY_PATH=/usr/local/mysql/lib" and libmysqlclient.18.dylib is in that path. It seems the linker is looking for libmysqlclient.18.dylib without a path (in the root?). I also ran otool on my php binary and got this:
这很奇怪,因为我指定了“export DYLD_LIBRARY_PATH=/usr/local/mysql/lib”和libmysqlclient.18。dylib在这条路上。似乎链接器正在寻找libmysqlclient.18。没有路径的dylib(在根中?)我还在我的php二进制文件上运行了otool,得到了这个:
/usr/lib/libexslt.0.dylib (compatibility version 9.0.0, current version 9.13.0)
/usr/lib/libiodbc.2.dylib (compatibility version 4.0.0, current version 4.18.0)
libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
/usr/local/lib/libmcrypt.4.dylib (compatibility version 9.0.0, current version 9.8.0)
/usr/local/lib/libltdl.7.dylib (compatibility version 11.0.0, current version 11.0.0)
/System/Library/Frameworks/LDAP.framework/Versions/A/LDAP (compatibility version 1.0.0, current version 2.2.0)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/X11/lib/libfreetype.6.dylib (compatibility version 13.0.0, current version 13.2.0)
/usr/X11/lib/libpng15.15.dylib (compatibility version 17.0.0, current version 17.0.0)
/usr/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/local/lib/libjpeg.8.dylib (compatibility version 12.0.0, current version 12.0.0)
/usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.0.0)
/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 46.0.0)
/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.3.0)
/usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 46.1.0)
/System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos (compatibility version 5.0.0, current version 6.0.0)
/usr/lib/libxslt.1.dylib (compatibility version 3.0.0, current version 3.24.0)
Note how libmysqlclient is the only library without a path. Does anyone know how I can solve this? Am I running the configure wrong?
注意libmysqlclient是唯一没有路径的库。有人知道我怎么解决这个问题吗?我的配置运行错误吗?
3 个解决方案
#1
2
I had a similar problem and I think it was related to the fact that /usr/local/mysql
is symlinked to /usr/local/mysql-5.5.15-osx10.6-x86_64
on my computer (MySQL installed via DMG). Changing DYLD_LIBRARY_PATH
to use the fully qualified path seemed to get make
to work for me.
我也遇到过类似的问题,我认为这与/usr/local/mysql与/usr/local/mysql- 5.15-osx10.6-x86_64(通过DMG安装的MySQL)相关联有关。将DYLD_LIBRARY_PATH更改为使用完全限定的路径似乎对我有用。
However, I did encounter a follow-up problem during the make install
process. The same error message came up during the Installing PEAR environment
step. The solution to that issue was to do this beforehand:
但是,我在make安装过程中遇到了一个后续问题。在安装PEAR环境步骤中出现了相同的错误消息。解决这个问题的办法是事先这样做:
install_name_tool -change libmysqlclient.18.dylib \
/usr/local/mysql-5.5.15-osx10.6-x86_64/lib/libmysqlclient.18.dylib \
/path/to/php-5.3.8/sapi/cli/php
#2
1
A similar thing happened to me when I tried to compile PHP 5.4.16 together with MariaDB 5.5 on MacOS X 10.6.8 Snow Leopard. During make
, the process stopped unexpectedly with this error report:
当我尝试在MacOS X 10.6.8雪豹上与MariaDB 5.5一起编译PHP 5.4.16时,也发生了类似的事情。在make过程中,进程意外停止,错误报告如下:
Undefined symbols:
"_res_9_dn_expand", referenced from:
_php_parserr in dns.o
_php_parserr in dns.o
_php_parserr in dns.o
_php_parserr in dns.o
_php_parserr in dns.o
_php_parserr in dns.o
_php_parserr in dns.o
_zif_dns_get_mx in dns.o
"_res_9_search", referenced from:
_zif_dns_check_record in dns.o
_zif_dns_get_mx in dns.o
_zif_dns_get_record in dns.o
"_res_9_init", referenced from:
_zif_dns_check_record in dns.o
_zif_dns_get_mx in dns.o
_zif_dns_get_record in dns.o
"_res_9_dn_skipname", referenced from:
_zif_dns_get_mx in dns.o
_zif_dns_get_mx in dns.o
_zif_dns_get_record in dns.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
I'm using a whole bunch of non-standard directories for running my server (apache with PHP-CGI), so my configure settings are somewhat odd and unhelpful to others. They have worked for the whole 5.4 branch of PHP with MariaDB 5.2, and only today did it stop working as expected.
我正在使用大量的非标准目录来运行我的服务器(使用PHP-CGI的apache),所以我的配置设置有些奇怪,对其他人也没有帮助。他们与MariaDB 5.2一起为PHP的整个5.4分支工作,直到今天才停止工作。
Thanks to your postings, this is what I came up with to get it to compile and install successfully again (of course, change paths depending on own requirements):
感谢您的发帖,这就是我想让它再次成功编译和安装的原因(当然,根据自己的需求更改路径):
-
prior to
compile
, set the path to the database lib directory:在编译之前,设置到数据库库库目录的路径:
export DYLD_LIBRARY_PATH=/customserver/maria55/lib
出口DYLD_LIBRARY_PATH = / customserver / maria55 / lib
-
run
./compile
with options as required运行。/根据需要使用选项进行编译
- run
make
- 运行make
-
run this to fix the broken path to the mysql client library inside both the CGI and CLI binaries:
运行此命令,修复CGI和CLI二进制文件中通往mysql客户端库的中断路径:
install_name_tool -change install_name_tool -change libmysqlclient.18.dylib /customserver/maria55/lib/libmysqlclient.18.dylib /sources/php-5.4.16/sapi/cli/php
install_name_tool—更改install_name_tool—更改libmysqlclient.18。dylib / customserver maria55 / lib / libmysqlclient.18。dylib /资源/ php-5.4.16 / sapi / cli / php
install_name_tool -change libmysqlclient.18.dylib /customserver/maria55/lib/libmysqlclient.18.dylib /sources/php-5.4.16/sapi/cgi/php-cgi
install_name_tool改改libmysqlclient.18。dylib / customserver maria55 / lib / libmysqlclient.18。dylib /资源/ php-5.4.16 / sapi / cgi / php-cgi
-
run
sudo make install
运行sudo make install
Hope this is helpful for other in the same situation
希望这对同样情况下的其他人有所帮助
#3
0
The second _php_parserr in dns.o
bug (mentioned here, and here) can also be resolved by doing the following:
dns中的第二个_php_parserr。o bug(这里提到,这里也提到)也可以通过以下步骤来解决:
Edit your Makefile
and add the following flag to the EXTRA_LIBS =
section (in addition to the other flags already there):
编辑您的Makefile,并向EXTRA_LIBS = section添加以下标志(除了已有的其他标志之外):
EXTRA_LIBS = -lsresolv
Though if you can resolve it by changing your paths, as mentioned above, that would be preferable.
尽管如前所述,如果您可以通过改变路径来解决这个问题,那将是更好的选择。
#1
2
I had a similar problem and I think it was related to the fact that /usr/local/mysql
is symlinked to /usr/local/mysql-5.5.15-osx10.6-x86_64
on my computer (MySQL installed via DMG). Changing DYLD_LIBRARY_PATH
to use the fully qualified path seemed to get make
to work for me.
我也遇到过类似的问题,我认为这与/usr/local/mysql与/usr/local/mysql- 5.15-osx10.6-x86_64(通过DMG安装的MySQL)相关联有关。将DYLD_LIBRARY_PATH更改为使用完全限定的路径似乎对我有用。
However, I did encounter a follow-up problem during the make install
process. The same error message came up during the Installing PEAR environment
step. The solution to that issue was to do this beforehand:
但是,我在make安装过程中遇到了一个后续问题。在安装PEAR环境步骤中出现了相同的错误消息。解决这个问题的办法是事先这样做:
install_name_tool -change libmysqlclient.18.dylib \
/usr/local/mysql-5.5.15-osx10.6-x86_64/lib/libmysqlclient.18.dylib \
/path/to/php-5.3.8/sapi/cli/php
#2
1
A similar thing happened to me when I tried to compile PHP 5.4.16 together with MariaDB 5.5 on MacOS X 10.6.8 Snow Leopard. During make
, the process stopped unexpectedly with this error report:
当我尝试在MacOS X 10.6.8雪豹上与MariaDB 5.5一起编译PHP 5.4.16时,也发生了类似的事情。在make过程中,进程意外停止,错误报告如下:
Undefined symbols:
"_res_9_dn_expand", referenced from:
_php_parserr in dns.o
_php_parserr in dns.o
_php_parserr in dns.o
_php_parserr in dns.o
_php_parserr in dns.o
_php_parserr in dns.o
_php_parserr in dns.o
_zif_dns_get_mx in dns.o
"_res_9_search", referenced from:
_zif_dns_check_record in dns.o
_zif_dns_get_mx in dns.o
_zif_dns_get_record in dns.o
"_res_9_init", referenced from:
_zif_dns_check_record in dns.o
_zif_dns_get_mx in dns.o
_zif_dns_get_record in dns.o
"_res_9_dn_skipname", referenced from:
_zif_dns_get_mx in dns.o
_zif_dns_get_mx in dns.o
_zif_dns_get_record in dns.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
I'm using a whole bunch of non-standard directories for running my server (apache with PHP-CGI), so my configure settings are somewhat odd and unhelpful to others. They have worked for the whole 5.4 branch of PHP with MariaDB 5.2, and only today did it stop working as expected.
我正在使用大量的非标准目录来运行我的服务器(使用PHP-CGI的apache),所以我的配置设置有些奇怪,对其他人也没有帮助。他们与MariaDB 5.2一起为PHP的整个5.4分支工作,直到今天才停止工作。
Thanks to your postings, this is what I came up with to get it to compile and install successfully again (of course, change paths depending on own requirements):
感谢您的发帖,这就是我想让它再次成功编译和安装的原因(当然,根据自己的需求更改路径):
-
prior to
compile
, set the path to the database lib directory:在编译之前,设置到数据库库库目录的路径:
export DYLD_LIBRARY_PATH=/customserver/maria55/lib
出口DYLD_LIBRARY_PATH = / customserver / maria55 / lib
-
run
./compile
with options as required运行。/根据需要使用选项进行编译
- run
make
- 运行make
-
run this to fix the broken path to the mysql client library inside both the CGI and CLI binaries:
运行此命令,修复CGI和CLI二进制文件中通往mysql客户端库的中断路径:
install_name_tool -change install_name_tool -change libmysqlclient.18.dylib /customserver/maria55/lib/libmysqlclient.18.dylib /sources/php-5.4.16/sapi/cli/php
install_name_tool—更改install_name_tool—更改libmysqlclient.18。dylib / customserver maria55 / lib / libmysqlclient.18。dylib /资源/ php-5.4.16 / sapi / cli / php
install_name_tool -change libmysqlclient.18.dylib /customserver/maria55/lib/libmysqlclient.18.dylib /sources/php-5.4.16/sapi/cgi/php-cgi
install_name_tool改改libmysqlclient.18。dylib / customserver maria55 / lib / libmysqlclient.18。dylib /资源/ php-5.4.16 / sapi / cgi / php-cgi
-
run
sudo make install
运行sudo make install
Hope this is helpful for other in the same situation
希望这对同样情况下的其他人有所帮助
#3
0
The second _php_parserr in dns.o
bug (mentioned here, and here) can also be resolved by doing the following:
dns中的第二个_php_parserr。o bug(这里提到,这里也提到)也可以通过以下步骤来解决:
Edit your Makefile
and add the following flag to the EXTRA_LIBS =
section (in addition to the other flags already there):
编辑您的Makefile,并向EXTRA_LIBS = section添加以下标志(除了已有的其他标志之外):
EXTRA_LIBS = -lsresolv
Though if you can resolve it by changing your paths, as mentioned above, that would be preferable.
尽管如前所述,如果您可以通过改变路径来解决这个问题,那将是更好的选择。