如何将共享库与--makeautomake所需的链接? [英] How do I link a shared library with --as-needed with automake?

查看:99
本文介绍了如何将共享库与--makeautomake所需的链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用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>

You can fix that just for your project by modifying the ltmain.sh script in your project sources. You can even add it as part of autotools bootstrapping, as in: https://meego.gitorious.org/tracker/tracker/commit/cf2ca3414aeba146dceacc5ecd84765f4c08a06f

这篇关于如何将共享库与--makeautomake所需的链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆