【问题标题】:Autotools: top_srcdir and abs_top_srcdir are empty自动工具:top_srcdir 和 abs_top_srcdir 为空
【发布时间】:2023-03-05 18:51:01
【问题描述】:

我目前正在尝试从位于我当前项目旁边的另一个项目中包含一个 libtool 库。我可以使用

检查配置中的库
LDFLAGS="$LDFLAGS -L$top_srcdir../otherproject/libotherproject/.libs/"
AC_CHECK_LIB([otherproject],[init],[],[AC_MSG_ERROR([No otherproject libary found.])])

在我的 configure.ac 中。到目前为止一切都很好。但是,如果我使用 make 构建项目,当它位于 currentproject/sources/ 时,我会从 libtool 收到一个错误:

../libtool: line 5986: cd: ../otherproject/libotherproject/.libs/: No such file or directory
libtool: link: cannot determine absolute directory name of `../otherproject/libotherproject/.libs/'

这是合乎逻辑的,因为它应该类似于../../otherproject/libotherproject/.libs/。我试图调试它,发现 if 是使用

AC_MSG_NOTICE([Top src dir is: $top_srcdir])

在 configure.ac 中,配置脚本告诉我

configure: Top src dir is: 

仅限。 $abs_top_srcdir 的行为相同。 $srcdir 是“。”总是。我在文档中挖掘了一下,发现 $builddir 应该始终是“。”,但在我的情况下也是空的。这是一个错误吗?也许我忘了打电话给AC_init_anything?谢谢你的帮助!

【问题讨论】:

  • 不确定您是否真的打算将 .libs 子目录与 libtool 一起使用。你应该通过<path>/libxxx.la。您使用哪些步骤来生成configure 脚本和Makefile.in 模板?
  • 我通常执行 autoconf 和 automake 来生成我的文件。我应该在哪里传递 .la-File 的路径?

标签: autotools autoconf libtool


【解决方案1】:

您不应使用srcdir 作为变量来确定构建对象的路径。请改用$(top_builddir)

要使用 Makefile 变量,您需要使用方括号 $()${}

【讨论】:

  • 我对@9​​87654326@ 有同样的问题。问题是,Autoconf 手册说要使用ac_srcdir;请参阅 Autoconf 手册,Configuration Files | 4.6 Performing Configuration Actions。有什么想法为什么手册说使用空的ac_srcdir? (top_builddir 也是空的,但我没有在手册中看到它)。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-12
  • 2013-08-18
  • 1970-01-01
  • 2022-10-02
  • 2012-08-07
  • 1970-01-01
相关资源
最近更新 更多