autoconf忽略CFLAGS?

问题描述 投票:1回答:2

我正在构建使用GNU autoconf的程序包(vice 3.4)。运行./configure失败,并显示以下消息:

checking size of time_t... 0
configure: error: can not figure type of time_t
error: Bad exit status from /var/tmp/rpm-tmp.wIgnPw (%build)

正在检查config.log,由于以下错误,此操作似乎失败了:

/usr/bin/ld: /tmp/ccMTSdtB.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status

我尝试通过将-fPIC添加到CFLAGS环境变量来解决此问题:

CFLAGS=-fPIC ./configure

但是尽管在./configure ...的其他阶段中显然使用了此方法>

configure:3657: checking whether the C compiler works
configure:3679: gcc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE=1 -fPIC  -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld conftest.c  >&5

[time_t相关的功能测试中似乎没有使用它:

configure:9684: checking for time_t in time.h
configure:9700: gcc -c -g -O3 -Wall -Wformat -Wformat-signedness -Wshadow -Wpointer-arith -Wstrict-prototypes -Wuninitialized -Wunreachable-code -Wno-unused-parameter -Werror=implicit-function-declaration -Wfatal-errors  conftest.c >&5
[...]
configure:9753: checking size of time_t
configure:9758: gcc -o conftest -g -O3 -Wall -Wformat -Wformat-signedness -Wshadow -Wpointer-arith -Wstrict-prototypes -Wuninitialized -Wunreachable-code -Wno-unused-parameter -Werror=implicit-function-declaration -Wfatal-errors  -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld conftest.c  >&5

configure.ac,上面的代码是从以下位置生成的:

if test $bu_cv_decl_time_t_time_h = yes; then
  AC_CHECK_SIZEOF([time_t],[],[#include <time.h>])
else
  AC_CHECK_SIZEOF([time_t],[],[#include <sys/types.h>])
fi

我已经能够通过重新定义CC来解决此问题:

CC="gcc -fPIC" ./configure

这有效,但是很丑陋(如果有人想调用gcc without

-fPIC,该怎么办?)。是否有原因AC_CHECK_SIZEOF忽略了CFLAGS

我正在构建一个使用GNU autoconf的软件包(版本3.4)。运行./configure失败,并显示以下消息:check time_t ...的大小... 0 configure:错误:无法计算time_t的类型错误:...

c gcc autotools autoconf
2个回答
2
投票

看来我在评论中表达的怀疑得到了证实。 VICE在执行其某些检查时,包括与substitutes its own choice of CFLAGS for the user's specified ones有关的检查,有意配置了CFLAGS。因此,这不是Autoconf


0
投票

John正确地识别了问题,并根据该信息做了一些挖掘,并且弄清了正在发生的事情。

© www.soinside.com 2019 - 2024. All rights reserved.