【发布时间】:2018-08-31 05:27:55
【问题描述】:
我正在尝试编译 PHP 7.2.3 并将 clean 安装到具有 readline 支持的 /usr/local 中,以便 php -a 将提供交互式 shell 会话。
我不断收到错误
clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
Undefined symbols for architecture x86_64:
"_append_history", referenced from:
_readline_shell_run in readline_cli.o
"_history_list", referenced from:
_zif_readline_list_history in readline.o
"_rl_mark", referenced from:
_zif_readline_info in readline.o
"_rl_pending_input", referenced from:
_zif_readline_info in readline.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/libphp7.bundle] Error 1
PHP 编译似乎没有检测到 readline 安装?我怎样才能链接它们?或者至少,我该如何解决这个错误?
我开始了
php-7.2.3$ ./configure --without-iconv --with-apxs2=/usr/local/apache2/bin/apxs --with-pdo-mysql
php-7.2.3$ make
用于默认的 readline 配置。
当这不起作用时,我在/usr/local 中下载并安装了一个新的 GNU readline,默认为
readline-6.3$ ./configure
readline-6.3$ make
readline-6.3$ sudo make install
和 PHP 相同的 configure/make。
如果这不起作用,请尝试更明确地引用 readline 安装位置:
php-7.2.3$ ./configure --without-iconv --with-apxs2=/usr/local/apache2/bin/apxs --with-readline==/usr/local/lib --with-pdo-mysql
然后再次寻找默认安装位置。
理论上,错误的 not found for architecture x86_64 部分可能是错误架构的线索,我尝试用
./configure CFLAGS="-arch x86_64" LDFLAGS="-arch x86_64"
但是所有这些尝试都给出了相同的错误:append_history(和其他)是一个未定义的符号,引用自 _readline_shell_run in readline_cli.o
谷歌搜索错误产生了很多点击,但那些有响应的几乎都是关于使用包管理器,如 debian 上的 apt-get 或 mac 上的 brew 或 ports。如何在 Mac 上从源代码编译和安装?如何将我的 PHP 包链接到已安装的 readline 标头?
【问题讨论】:
-
如果你已经在运行 python 或许值得看看phpsh.org?你确定你拿了 readline 的开发包吗?抱歉,这些天我只在 mac 上使用 brew。
-
您安装的这条 readline 在哪里?可以分享一个链接吗?
-
尝试重新安装 readline
./configure CFLAGS="-arch x86_64" LDFLAGS="-arch x86_64" ./configure --prefix=/usr/local; make祝你好运! -
@ficuscr 我是从tiswww.case.edu/php/chet/readline/rltop.html 下载的。现在看页面,最近几天似乎发布了一个新版本。我想我会再试一次
-
@ficuscr 你的意思是给出两个配置命令,而不是一个配置所有三个标志的命令?
标签: php macos unix compilation installation