欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

macosx-10.11 - 更新osx 10.11后,删除自带php版本,重新编译php 5.5.29,到make阶段提示错误。

程序员文章站 2022-04-27 15:58:06
...
配置命令:
--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/private/etc --with-apxs2=/usr/sbin/apxs --enable-cli --with-config-file-path=/etc --with-config-file-scan-dir=/Library/Server/Web/Config/php --with-libxml-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr --with-zlib-dir=/usr/lib --enable-bcmath --with-bz2 --enable-calendar --disable-cgi --with-curl=/usr/local/curl --enable-exif --enable-fpm --enable-ftp --with-png-dir --with-gd --with-jpeg-dir=/BinaryCache/apache_mod_php/apache_mod_php-95~11/Root/usr/local --enable-gd-native-ttf --with-icu-dir=/usr --enable-mbstring --enable-mbregex --with-mysql=mysqlnd --with-mysqli=mysqlnd --without-pear --with-pear=no --with-pdo-mysql=mysqlnd --with-mysql-sock=/var/mysql/mysql.sock --enable-shmop --with-snmp=/usr --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-xmlrpc --with-iconv=/usr/lib --with-xsl=/usr --enable-zip --with-freetype-dir=/usr/local/lib

配置完成的提示:
Thank you for using PHP.

config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands

make 编译时提示的错误:
Undefined symbols for architecture x86_64:
"_libiconv", referenced from:

  _do_convert in gdkanji.o
  _zif_iconv_substr in iconv.o
  _zif_iconv_mime_encode in iconv.o
  _php_iconv_string in iconv.o
  __php_iconv_strlen in iconv.o
  __php_iconv_strpos in iconv.o
  __php_iconv_appendl in iconv.o
  ...

"_libiconv_close", referenced from:

  _do_convert in gdkanji.o
  _zif_iconv_substr in iconv.o
  _zif_iconv_mime_encode in iconv.o
  _php_iconv_string in iconv.o
  __php_iconv_strlen in iconv.o
  __php_iconv_strpos in iconv.o
  __php_iconv_mime_decode in iconv.o
  ...

"_libiconv_open", referenced from:

  _do_convert in gdkanji.o
  _zif_iconv_substr in iconv.o
  _zif_iconv_mime_encode in iconv.o
  _php_iconv_string in iconv.o
  __php_iconv_strlen in iconv.o
  __php_iconv_strpos in iconv.o
  __php_iconv_mime_decode in iconv.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

回复内容:

配置命令:
--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/private/etc --with-apxs2=/usr/sbin/apxs --enable-cli --with-config-file-path=/etc --with-config-file-scan-dir=/Library/Server/Web/Config/php --with-libxml-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr --with-zlib-dir=/usr/lib --enable-bcmath --with-bz2 --enable-calendar --disable-cgi --with-curl=/usr/local/curl --enable-exif --enable-fpm --enable-ftp --with-png-dir --with-gd --with-jpeg-dir=/BinaryCache/apache_mod_php/apache_mod_php-95~11/Root/usr/local --enable-gd-native-ttf --with-icu-dir=/usr --enable-mbstring --enable-mbregex --with-mysql=mysqlnd --with-mysqli=mysqlnd --without-pear --with-pear=no --with-pdo-mysql=mysqlnd --with-mysql-sock=/var/mysql/mysql.sock --enable-shmop --with-snmp=/usr --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-xmlrpc --with-iconv=/usr/lib --with-xsl=/usr --enable-zip --with-freetype-dir=/usr/local/lib

配置完成的提示:
Thank you for using PHP.

config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands

make 编译时提示的错误:
Undefined symbols for architecture x86_64:
"_libiconv", referenced from:

  _do_convert in gdkanji.o
  _zif_iconv_substr in iconv.o
  _zif_iconv_mime_encode in iconv.o
  _php_iconv_string in iconv.o
  __php_iconv_strlen in iconv.o
  __php_iconv_strpos in iconv.o
  __php_iconv_appendl in iconv.o
  ...

"_libiconv_close", referenced from:

  _do_convert in gdkanji.o
  _zif_iconv_substr in iconv.o
  _zif_iconv_mime_encode in iconv.o
  _php_iconv_string in iconv.o
  __php_iconv_strlen in iconv.o
  __php_iconv_strpos in iconv.o
  __php_iconv_mime_decode in iconv.o
  ...

"_libiconv_open", referenced from:

  _do_convert in gdkanji.o
  _zif_iconv_substr in iconv.o
  _zif_iconv_mime_encode in iconv.o
  _php_iconv_string in iconv.o
  __php_iconv_strlen in iconv.o
  __php_iconv_strpos in iconv.o
  __php_iconv_mime_decode in iconv.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

iconv不要重新编译,用系统自带的,新版和旧版头文件不一样,会报错!

你有用homebrew么?还是有特殊的原因需要自己编译?不然感觉还是用homebrew在Mac下来管理开发的依赖好一点:)