如何使libtool指向用户安装的库?

发布于 2024-12-21 18:58:30 字数 285 浏览 2 评论 0原文

我正在尝试安装一个 ruby​​gem,它会继续尝试读取不可用的库。

grep: /usr/lib64/libgdbm.la: 没有这样的文件或目录 /bin/sed:无法读取/usr/lib64/libgdbm.la:没有这样的文件或目录 libtool: 链接: /usr/lib64/libgdbm.la' 不是有效的 libtool 存档 。

为了解决这个问题,我安装了自己的 libgdbm 并在 makefile LDFLAG 中提供了 libgdbm 的路径,但没有效果

非常感谢任何帮助。

I am trying to install a rubygem which keeps on trying to read a library which is not available.

grep: /usr/lib64/libgdbm.la: No such file or directory
/bin/sed: can't read /usr/lib64/libgdbm.la: No such file or directory
libtool: link: /usr/lib64/libgdbm.la' is not a valid libtool archive

In order to work around this, I installed my own libgdbm and provided the path to the libgdbm in the makefile LDFLAGs but to no avail.

Any help is much appreciated.

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

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

发布评论

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

评论(2

池予 2024-12-28 18:58:30

这个 ruby​​gem 似乎做了肮脏的事情,因为任何干净的库搜索(-L 或 pkg-config)都会导致类似“未找到库/包 gdbm”的消息。尤其是 la 文件上的 grep-and-sed 过程看起来真的很脏。确保圣诞老人知道这颗宝石的作者今年没有收到礼物。

gem 可能有硬编码的 libtool 存档的路径。首先,尝试在 gem 的 Makefile 中 grep 查找 /usr/lib64/libgdbm.la 。更改硬编码路径,并确保安装脚本对任何系统目录都没有写权限,因为它似乎与 sed 一起运行。

This rubygem seems to do dirty stuff, since any clean library search (-L or pkg-config) would have resulted in a message like "library/package gdbm not found". And especially the grep-and-sed procedure on the la file seems really dirty. Make sure Santa knows that the author of this gem gets no presents this year.

The gem probably has the path to the libtool archive hardcoded. First of all, try to grep for /usr/lib64/libgdbm.la in the Makefile of the gem. Change the hardcoded path, and make sure the installation script has no write permissions on any system directories, because it seems to run wild with seds.

深海少女心 2024-12-28 18:58:30

Libtool 需要对编译器套件和操作系统有深入的了解,以便能够创建共享库并正确链接它们。当您安装 libtool 发行版时,系统特定的 libtool 脚本将安装到您的二进制目录中。
但是,当您使用自己的软件包分发 libtool 时,您并不总是知道用于编译您的软件包的编译器套件和操作系统。

因此,必须先配置libtool才能使用它。任何使用过 GNU 配置脚本的人都应该熟悉这个想法。 configure 对系统功能运行许多测试,然后生成 Makefile(可能还有 config.h 头文件),之后您可以运行 make 并构建包。

Libtool 将其自己的测试添加到您的配置脚本中,以便为安装程序的主机生成 libtool 脚本。为此,您可以使用configure.ac 中的LT_INIT 宏。

简而言之,如果您的包有配置文件,请在运行 Make 之前运行它

make distclean //clean up all the previous generated files
autoconf //or autoreconf to generate configure script from configure.ac and configure.in
automake //to generate new Makefile.in from Makefile.ac
./configure //to generate new Makefile and libtool

Libtool requires intimate knowledge of your compiler suite and operating system in order to be able to create shared libraries and link against them properly. When you install the libtool distribution, a system-specific libtool script is installed into your binary directory.
However, when you distribute libtool with your own packages, you do not always know the compiler suite and operating system that are used to compile your package.

For this reason, libtool must be configured before it can be used. This idea should be familiar to anybody who has used a GNU configure script. configure runs a number of tests for system features, then generates the Makefiles (and possibly a config.h header file), after which you can run make and build the package.

Libtool adds its own tests to your configure script in order to generate a libtool script for the installer's host machine. For this you can play with LT_INIT macro in configure.ac.

So in short, if your package has configure file, run it before running Make

make distclean //clean up all the previous generated files
autoconf //or autoreconf to generate configure script from configure.ac and configure.in
automake //to generate new Makefile.in from Makefile.ac
./configure //to generate new Makefile and libtool
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文