【发布时间】:2019-01-11 18:56:24
【问题描述】:
我们在 AIX 上使用 Autotools 构建的项目中发现了段错误。根据 gdb,它在启动代码中即将死去。使用 GNUmakefile 构建的同一个项目很好。一个相关的问题是here。
Autotools 添加了一些不寻常的链接器标志,我们相当肯定这是问题的根本原因。 Autotools生成的Makefile在线here.
还有:
libtool: link: g++ -pthread -fdata-sections -ffunction-sections -pipe -g -O2 -pt
hread -o .libs/cryptestcwd cryptestcwd-test.o ...
yptestcwd-dlltest.o cryptestcwd-fipsalgt.o cryptestcwd-adhoc.o -L./.libs -lcryp
topp -L/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0 -lstdc++ -lm -pthread
-Wl,-blibpath:/usr/local/lib:/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0:
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0:/opt/freeware/lib/gcc/powerpc
-ibm-aix7.2.0.0/7.2.0/../../..:/usr/lib:/lib
标志并非来自环境或我们的configure.ac:
-bash-4.4$ echo $LDFLAGS
-bash-4.4$ echo $LDLIBS $LIBS
-bash-4.4$
还有我们添加的AM_CXXFLAGS 和AM_LDFLAGS:
AM_CXXFLAGS: -pthread -fdata-sections -ffunction-sections
AM_LDFLAGS: -pthread -Wl,--demangle
我尝试make LDFLAGS="" 并覆盖 Autotools 标志,但添加了相同的标志。
我的第一个问题是,他们如何覆盖我们的LDFLAGS? GNU makefile 不是这样工作的。 GNU 总是允许用户覆盖 makefile 的标志。
我的第二个问题是,我们如何阻止 Autotools 在链接阶段添加不需要的标志?
这是我们的configure.ac。以下是我们在运行 vanilla ./configure 后添加的选项摘要:
Auto-configuration complete. A summary of options are below. If
something looks wrong then please modify config.h and please report
it at http://github.com/noloader/cryptopp-autotools.
Build triplet: powerpc-ibm-aix7.2.0.0
Compiler target: powerpc-ibm-aix7.2.0.0
Compiler version: g++ (GCC) 7.2.0
Static library: yes
Shared library: yes
CRYPTOPP_PPC_FLAG: -mcpu=power8 -maltivec
CRYPTOPP_CHAM_FLAG: -mcpu=power7 -maltivec
CRYPTOPP_CRC_FLAG: -mcpu=power8 -maltivec
CRYPTOPP_LEA_FLAG: -mcpu=power7 -maltivec
CRYPTOPP_GCM_FLAG: -mcpu=power8 -maltivec
CRYPTOPP_AES_FLAG: -mcpu=power8 -maltivec
CRYPTOPP_SHA_FLAG: -mcpu=power8 -maltivec
CRYPTOPP_SIMECK_FLAG: -mcpu=power7 -maltivec
CRYPTOPP_SIMON_FLAG: -mcpu=power7 -maltivec
CRYPTOPP_SPECK_FLAG: -mcpu=power7 -maltivec
CRYPTOPP_SM4_FLAG: -mcpu=power7 -maltivec
Automake flags (can be overridden by user flags):
AM_CXXFLAGS: -pthread -fdata-sections -ffunction-sections
AM_LDFLAGS: -pthread -Wl,--demangle
User flags (overrides Automake flags on conflict):
CXXFLAGS: -g -O2
LDFLAGS:
【问题讨论】:
-
您好,您使用的自动工具命令是什么?
-
@Lorinczy - 我使用 Autotools 命令和我们通过
AM_CXXFLAGS和AM_LDFLAGS添加的标志添加了其他信息。 -
@Lorinczy - 你有什么想法吗?我很困惑这些额外的标志是从哪里来的,为什么我不能覆盖它们。
-
你应该找出这个 LDFLAGS 来自哪里,因为它是完全错误的。整个程序可以从某个地方下载吗?
-
@Lorinczy - 是的,Autotools 前端作为一个单独的项目在Crypto++ | Autotools 提供。
标签: linker aix autotools autoconf powerpc