【问题标题】:pecl install sqlsrv FAILS with configure error: C compiler cannot create executables on SLES 12pecl install sqlsrv 失败并出现配置错误:C 编译器无法在 SLES 12 上创建可执行文件
【发布时间】:2018-07-23 21:19:37
【问题描述】:

在过去的几个小时里,我一直对此束手无策,试图弄清楚发生了什么。我正在运行 SLES 12 SP3 服务器并且需要从 PHP 连接到 Microsoft SQL Server 数据库,我按照 microsoft 的文档直到它要求我运行这个命令:

pecl install sqlsrv

命令失败并显示以下相关输出:

checking whether the C compiler works... no
configure: error: in `/tmp/pear/temp/pear-build-rootLa81RX/sqlsrv-5.3.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
rolling back 8 file operations
ERROR: `/tmp/pear/temp/sqlsrv/configure --with-php-config=/usr/bin/php-config' failed

我很想查看 config.log 以获取更详细的错误信息,但似乎 /tmp/pear/temp 目录中的所有内容在尝试失败后立即被删除,包括日志。为了诊断错误,我尝试使用 gcc 构建以下 C 文件:

#include <stdio.h>
int main() { printf("hello world\n"); return 0; }

得到了同样奇怪的错误:

/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/8/../../../../lib64/crt1.o: unrecognized relocation (0x2a) in section `.text'
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

此时,我正式不知道该去哪里尝试诊断这里实际发生的情况。

【问题讨论】:

  • 你从哪里得到 GCC 8 的安装?我认为 SLES SP3 工具链模块仍处于 GCC 7。
  • 我所做的只是 zypper install gcc
  • 你也更新了 binutils 吗?

标签: sql-server gcc pear pecl


【解决方案1】:

重定位 0x2a 是 R_X86_64_REX_GOTPCRELX,用于创建某些可放松的 x86-64 重定位(可以由链接器优化的重定位)。您至少需要 binutils 2.26 来处理这些目标文件。

【讨论】:

    猜你喜欢
    • 2013-09-24
    • 2012-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-12
    • 2021-04-23
    • 2019-02-03
    • 1970-01-01
    相关资源
    最近更新 更多