64 位 OpenSuse 发行版上的 Lib 目录
我正在开发的一个项目使用非标准分发系统,该系统在内部下载并编译依赖库。这个 crock 为每个库启动 configure
脚本,给出编译系统的内部目录作为前缀。然后它运行 make
和 make install
,然后通过使用 lib/
文件搜索安装目录来验证内容。最后一步失败了。
为了了解发生了什么,我自己编译了两个随机库,其中一个是我自己的作者。我注意到在我的发行版(openSUSE,64 位)下,安装路径不是用 /lib
填充的,而是用 /lib64
填充的。
很明显,这是发行版的一项设置,而且我非常确定该设置涉及发行版附带的 autotools 配置。
有没有办法改变这种行为,或者作为替代方案,从系统中读取此信息(以便我可以修补上述瓦罐)?
感谢您的帮助
更新:我了解了configure
中的--libdir
标志,所以我想我可以解决我的问题。我仍然想知道是否有一种方法可以通过某种方式查询发行版(例如读取一些配置文件)来了解此详细信息。
A project I'm working on uses a non-standard distribution system, which internally downloads and compiles the dependency libraries. This crock launches, for each library, the configure
script giving as prefix an internal directory of the compiling system. Then it runs make
and make install
, then it verifies the content by searching the install directory with the lib/<mylib>.a
file. This last step fails.
Trying to understand what's happening, I compiled a pair of random libraries by myself, including one I'm the author of. I noticed that under my distribution (openSUSE, 64 bit) the installing path is not populated with /lib
, but with /lib64
instead.
It's clear that this is a setting of the distribution, and I'm pretty sure that this setting concerns a configuration of autotools shipped with the distro.
Is there a way of changing this behavior or, as an alternative, to read this information from the system (so that I can patch the above mentioned crock)?
Thanks for your help
Update: I learnt about the --libdir
flag in configure
, so I think I can solve my problem. Still I would like to know if there's a way of knowing this detail from somehow querying the distribution (e.g. read some configuration file).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
配置脚本决不应该尝试对机器做出假设,或者尝试将库安装在 ${exec_prefix}/lib 之外的位置,除非用户明确请求 $libdir 的不同位置。用户可以显式请求备用位置的一种机制是通过 config.site 文件。如果文件 ${prefix}/share/config.site 存在,它可能会为 $libdir 指定备用值,导致用户在不知情的情况下显式指定备用安装位置。
The configure script should never try to make assumptions about the machine, or attempt to install libraries in locations other than ${exec_prefix}/lib unless the user explicitly requests a different location for $libdir. One mechanism by which the user can explicitly request an alternate location is through a config.site file. If the file ${prefix}/share/config.site exists, it may specify an alternate value for $libdir, causing the user to unknowingly explicitly specify an alternate installation location.
这是威廉·珀塞尔的一个很好的回答。我只是想补充一点,因为这个问题特别涉及 openSUSE,所以 openSUSE 不会安装名为 config.site 的文件。等效文件实际上通过
site-config
rpm 安装到/usr/share/site
中,然后通过/etc/profile/site.{c 激活,}sh
导出CONFIG_SITE
环境变量以指向此文件。该变量是 由 autoconf 授予荣誉,正如您可能已经看到的那样。That's a good answer by William Pursell. I just wanted to add, since this question specifically concerns openSUSE, that openSUSE doesn't install a file called
config.site
. The equivalent file is actually installed into/usr/share/site
via thesite-config
rpm, and then activated via/etc/profile/site.{c,}sh
which exports theCONFIG_SITE
environment variable to point to this file. That variable is then honoured by autoconf, as you may have already seen.