问题描述
如何使用Automake将共享库与--as-needed
链接?当我尝试将标志添加到LDFLAGS
时,我看到libtool
如此称呼:
How do I link a shared library with --as-needed
using Automake? When I tried adding the flag to LDFLAGS
, I saw libtool
called as so:
/bin/bash ../../libtool --mode=link ... -Wl,--as-needed ... dependencies
这将导致对GCC的呼叫,如下所示:
Which results in a call to GCC like so:
gcc -shared ... dependencies ... -Wl,--as-needed ...
但这是错误的顺序.
-
是否可以使用Libtool做到这一点?
Is there a way to do this with Libtool?
或者有没有一种好的方法可以使用Automake而不使用Libtool来构建共享库? (过去,由于各种其他原因,我对Libtool感到沮丧...)
Or is there a nice way to build shared libraries using Automake but without Libtool? (I've been frustrated at Libtool for various other reasons in the past...)
似乎Debian族人也遇到了这个问题(错误报告),但我希望能够为我的项目解决此问题,而不是弄乱我的系统(除非我误解了此修复程序).
It seems the Debian folks ran into this problem too (bug report) but I'd like to be able to fix this for my project rather than messing with my system (unless I misunderstand the fix).
推荐答案
您可以通过在项目源代码中修改ltmain.sh脚本,仅针对您的项目来解决此问题.您甚至可以将其添加为自动工具引导的一部分,如下所示: https://meego.gitorious.org/tracker/tracker/commit/cf2ca3414aeba146dceacc508dd6565f4>
这篇关于如何将共享库与--makeautomake所需的链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!