PHP 生成失败并显示错误:未定义的符号_XpmLibraryVersion


PHP make fails with error: Undefined symbols _XpmLibraryVersion

我正在尝试自己在Mac OS X Mavericks上编译PHP。

下面是配置命令:

./configure --prefix=/opt/local/php --with-config-file-path=/opt/local/php/conf 
--with-apxs2=/opt/local/apache/bin/apxs --with-mysql=/opt/local/mysql 
--with-mysql-sock=/tmp --with-libedit --with-pcre-dir=/opt/local 
--enable-bcmath --enable-mbstring --enable-sockets --enable-zip --with-bz2 
--with-curl --with-jpeg-dir=/opt/local --with-png-dir=/opt/local 
--with-freetype-dir=/opt/local --with-gd=/opt/local

当我尝试 d sudo make 时,出现此错误:

Undefined symbols for architecture x86_64:
 "_XpmLibraryVersion", referenced from:
   _zm_info_gd in gd.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

PHP 版本是 5.5.5,libgd 是用这个配置编译的

./configure --prefix=/opt/local --with-png=/opt/local --with-jpeg=/opt/local 
--with-tiff=/opt/local --with-freetype=/opt/local

如果没有 --with-gd 标志,PHP 编译得很好。

此错误是什么意思,我该如何解决?

你可以通过--with-xpm-dir=no来配置哪个应该禁用xpm支持,如果这不能解决它,请尝试安装适用于Mac OS X的X11更新。而且,您可能应该在安装该更新后重新编译libgd(以包含libXpm)

这个选项对我在 Debian 上有帮助:

--with-gd=/usr/ --with-xpm-dir=/usr/ '--with-libdir=lib/x86_64-linux-gnu'