无法从非libtool对象构建libtool库 - 是否有解决方法?

发布于 2025-02-07 03:47:39 字数 603 浏览 1 评论 0原文

我有这个用于Makefile Automake的代码:

noinst_LTLIBRARIES = libwinsane.la
libwinsane_la_SOURCES = init.c
libwinsane_la_CXXFLAGS = -I$(top_srcdir)
libwinsane_la_DEPENDENCIES  = manifest.$(OBJEXT)
libwinsane_la_LIBADD = manifest.$(OBJEXT)
manifest.$(OBJEXT): manifest.rc utf8.xml
    windres -o $@ $(top_builddir)/libwinsane/manifest.rc

它配置了./configure可以,但最终,“ make”命令结果错误:

libtool:   error: cannot build libtool library 'libwinsane.la' from non-libtool objects on this host: manifest.o

但是我相信castest.o可以与init.o完全合并,我不明白,为什么Libtool如此努力地抱怨。有解决方案吗?

I have this code for makefile automake:

noinst_LTLIBRARIES = libwinsane.la
libwinsane_la_SOURCES = init.c
libwinsane_la_CXXFLAGS = -I$(top_srcdir)
libwinsane_la_DEPENDENCIES  = manifest.$(OBJEXT)
libwinsane_la_LIBADD = manifest.$(OBJEXT)
manifest.$(OBJEXT): manifest.rc utf8.xml
    windres -o $@ $(top_builddir)/libwinsane/manifest.rc

it configures with ./configure fine, but in the end, 'make' command results with error:

libtool:   error: cannot build libtool library 'libwinsane.la' from non-libtool objects on this host: manifest.o

But I belive that manifest.o can be totally merged with init.o, I don't understand, why libtool complains about that so hard. Is there any solution?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

noinst_LTLIBRARIES = libwinsane.la
libwinsane_la_SOURCES = init.c
libwinsane_la_CXXFLAGS = -I$(top_srcdir)
libwinsane_la_LIBADD = manifest.lo
libwinsane_la_DEPENDENCIES  = manifest.$(OBJEXT)

manifest.$(OBJEXT): manifest.rc utf8.xml
    libtool --mode=compile windres -o $@ $(top_builddir)/libwinsane/manifest.rc
noinst_LTLIBRARIES = libwinsane.la
libwinsane_la_SOURCES = init.c
libwinsane_la_CXXFLAGS = -I$(top_srcdir)
libwinsane_la_LIBADD = manifest.lo
libwinsane_la_DEPENDENCIES  = manifest.$(OBJEXT)

manifest.$(OBJEXT): manifest.rc utf8.xml
    libtool --mode=compile windres -o $@ $(top_builddir)/libwinsane/manifest.rc
傲鸠 2025-02-14 03:47:39

由于涉及libtool,因此将使用.lo后缀来保持一致性。这应该有助于检测源文件的双重使用(*)。

.rc.${OBJEXT}:
    ${RC} 
lt; $@
.rc.lo:
    libtool --mode=compile --tag=RC ${RC} 
lt; $@

使用它的相应的主要makefile片段,我希望这样做:

lib_LTLIBRARIES = libfoo.la
libfoo_la_SOURCES = manifest.rc
libfoo_la_LIBADD = manifest.lo
manifest.lo: utf8.xml
# Alternatively:
# bin_PROGRAMS = foo
# foo_SOURCES = manifest.rc
# foo_LDADD = manifest.o
# (*) Be wary of the usual "object 'manifest.$(OBJEXT)' created both with libtool and without"

如果Automake将来获得了.rc源的默认规则,这似乎是一种前向兼容的方法,因为Automake只会再次将Subtest.lo添加到Libadd,又将其添加到Libadd,这是势力。

对于默认RC,您可以添加到configure.ac:

LT_PROG_RC

Since libtool is involved, one would use the .lo suffix for consistency. That should help detect double use(*) of a source file.

.rc.${OBJEXT}:
    ${RC} 
lt; $@
.rc.lo:
    libtool --mode=compile --tag=RC ${RC} 
lt; $@

The corresponding main makefile fragment to use it, I would do like so:

lib_LTLIBRARIES = libfoo.la
libfoo_la_SOURCES = manifest.rc
libfoo_la_LIBADD = manifest.lo
manifest.lo: utf8.xml
# Alternatively:
# bin_PROGRAMS = foo
# foo_SOURCES = manifest.rc
# foo_LDADD = manifest.o
# (*) Be wary of the usual "object 'manifest.$(OBJEXT)' created both with libtool and without"

If automake gained a default rule for .rc sources in the future, this seems like a forward-compatible approach, since automake would just add manifest.lo to LIBADD again, which is idempotent.

For defaulting RC, you can add into configure.ac:

LT_PROG_RC
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文