【发布时间】:2011-07-27 23:23:11
【问题描述】:
如何使用 Automake 将共享库与 --as-needed 链接?当我尝试将标志添加到LDFLAGS 时,我看到libtool 是这样调用的:
/bin/bash ../../libtool --mode=link ... -Wl,--as-needed ... dependencies
这会导致像这样调用 GCC:
gcc -shared ... dependencies ... -Wl,--as-needed ...
但这是错误的顺序。
有没有办法用 Libtool 做到这一点?
或者有没有一种使用 Automake 但不使用 Libtool 构建共享库的好方法? (我过去因为各种其他原因对 Libtool 感到沮丧……)
似乎 Debian 的人也遇到了这个问题 (bug report),但我希望能够为我的项目解决这个问题,而不是弄乱我的系统(除非我误解了修复)。
【问题讨论】:
-
我希望事情发生了变化,因为您的参考来自 2006 年并提到了
libtool1.5,但似乎没有:sigquit.wordpress.com/2011/02/16/… -
是的,我正在运行 libtool 2.2.6。