【问题标题】:Run ./configure from bash script fails due "error: cannot compute suffix of object files"由于“错误:无法计算目标文件的后缀”,从 bash 脚本运行 ./configure 失败
【发布时间】:2020-01-31 14:23:29
【问题描述】:

我正在尝试使用 bash 脚本在 Linux RHEL7 主机上自动执行某些阶段的编译/构建,但是当我尝试使用 ./configure 时它会失败,原因是:

configure:3793: error: in `/app/compiling/BUILD_AREA/TEST/SRC/zabbix-4.2.6':
configure:3795: error: cannot compute suffix of object files: cannot compile

使用:

CC="gcc"
PATH="/app/app_lib/mysql/bin:/app/app_lib/bin:/app/app_lib/build-1:/app/app_lib:$PATH"
LD_LIBRARY_PATH="/app/app_lib:/app/app_lib/include:/app/app_lib/lib:/app/apache/modules:/app/app_lib/ssl:/app/app_lib/lib/iconv:/app/oracle/product/12.1.0/lib:/app/ap_lib/mysql/lib:$LD_LIBRARY_PATH"

export CC
export PATH
export LD_LIBRARY_PATH

ARG_ZABBIX="--prefix=/app/zabbix --datarootdir=/app/zabbix/share --docdir=/app/zabbix/share/doc/$PKGAPPDIR --enable-agent --enable-ipv6 --enable-java --enable-server --includedir=/app/zabbix/include --libdir=/app/zabbix/lib --mandir=/app/zabbix/share/man/$PKGAPPDIR --with-libcurl=/app/app_lib/bin/curl-config --with-libxml2=/app/app_lib/bin/xml2-config --with-mysql=/app/mysql/bin/mysql_config --with-net-snmp=/app/app_lib/bin/net-snmp-config --with-openipmi=/app/app_lib --with-ssh2=/app/app_lib"
CONFIGURE="configure"

cd /app/compiling/BUILD_AREA/TEST/SRC/zabbix-4.2.6
"./${CONFIGURE}" "${ARG_ZABBIX}" 2>&1

任何帮助将不胜感激!

【问题讨论】:

    标签: linux gcc compiler-errors configure


    【解决方案1】:

    任何帮助将不胜感激!

    找到相应的config.log(如$(builddir)/gcc 中的那个)并查看。一些配置测试可能会失败,因为配置正在查询主机功能的可用性;相关的失败通常记录在相关config.log的末尾。

    这个错误的一个常见原因是找不到目标Binutilsas,汇编程序),因为 configure 试图找出用于目标文件的后缀。或者在实际应该使用目标 as(截至 --target=)的地方使用主机 as,并且主机 as 抛出语法错误,因为它提供了目标程序集。

    ./配置

    GCC 执行 not support configuring in the source directory 或其任何子文件夹:

    “首先,我们强烈建议将 GCC 构建到与源代码不同的目录中,该目录驻留在源代码树中。”

    【讨论】:

    • 在 config.log 我看到:configure:3775: gcc -c -I conftest.c >&5 gcc: 致命错误:没有输入文件编译终止。配置:3779:$? = 4 配置:失败的程序是:| /* confdefs.h / | #define PACKAGE_NAME "Zabbix" | #define PACKAGE_TARNAME "zabbix" | #define PACKAGE_VERSION "4.2.6" | #define PACKAGE_STRING "Zabbix 4.2.6" | #define PACKAGE_BUGREPORT "" | #define PACKAGE_URL "" | #define 包“zabbix”| #define 版本“4.2.6”| / 结束 confdefs.h。 */ | |整数 |主要 () | { | | ; |返回0; | }
    • configure:3795: 错误:无法计算目标文件的后缀:无法编译有关详细信息,请参阅“config.log”
    • -I 中的 Igcc -c -I conftest.c 中的大写字母吗?
    • 是的是“-I”:似乎很奇怪 ./configure 在 bash 脚本之外的同一路径中使用相同的 ENV 成功完成
    • -I 后面是包含路径,conftest.c 不是。据推测,无论出于何种原因,一些应该保存路径的 shell 变量都是空的。也许您可以找出扩展至此特定configure 测试的configure.ac 的相应行,并找出哪个shell / configure 变量是无效的。
    猜你喜欢
    • 2019-10-22
    • 2020-12-25
    • 2012-09-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多