自动工具和-Wl-完整档案 [英] autotools and -Wl,-whole-archive
本文介绍了自动工具和-Wl-完整档案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以告诉自动工具使用-Wl,-whole-archive标志链接其中一个库?
Is it possible to tell autotools to link one of the libraries with -Wl,-whole-archive flag?
Makefile.am
Makefile.am
bin_PROGRAMS = pktanon
pktanon_SOURCES = main.cpp
pktanon_DEPENDENCIES = $(lib_LIBRARIES)
pktanon_LDADD = libpktanon.a $(LDADD)
我需要将libpktanon.a与-Wl,-whole-archive标志链接,我也想使它执行如下操作:
I need to link libpktanon.a with -Wl,-whole-archive flag, also I want make to execute something like this:
g++ -o pktanon main.o -Wl,-whole-archive libpktanon.a -Wl,-no-whole-archive -l...
(如此问题)
推荐答案
I ran into a similar problem here. You can do this:
pktanon_LDFLAGS = -Wl,--whole-archive,libpktanon.a,--no-whole-archive
问题在于Libtool不保证链接器标志在其执行的实际命令行上的顺序,因此您必须像这样强制使用它.
The issue is that Libtool doesn't guarantee the order of linker flags on the actual command line it executes, so you have to force it like this.
这篇关于自动工具和-Wl-完整档案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文