Boost、bjam 和符号链接
我用 bjam 生成了一些 Boost 库,并且得到了许多符号链接。
对于 date_time :
libboost_date_time-gcc41-mt-1_39.a
libboost_date_time-gcc41-mt-1_39.so -> libboost_date_time-gcc41-mt-1_39.so.1.39.0
libboost_date_time-gcc41-mt-1_39.so.1.39.0
libboost_date_time-gcc41-mt.a -> libboost_date_time-gcc41-mt-1_39.a
libboost_date_time-gcc41-mt.so -> libboost_date_time-gcc41-mt-1_39.so.1.39.0
为什么我不直接获取 .a 和 .so ? 为什么是这 3 个符号链接? 为什么原始文件的 .so 名称如此复杂,并且发布版本被提及两次?
是不是可以只拥有:
libboost_date_time-gcc41-mt-1_39.a libboost_date_time-gcc41-mt-1_39.so
感谢您的帮助。我不知道如何处理这些符号链接。
注意:我是 Linux 新手。
I generated some Boost librairies with bjam, and I get many symbolic links.
For date_time :
libboost_date_time-gcc41-mt-1_39.a
libboost_date_time-gcc41-mt-1_39.so -> libboost_date_time-gcc41-mt-1_39.so.1.39.0
libboost_date_time-gcc41-mt-1_39.so.1.39.0
libboost_date_time-gcc41-mt.a -> libboost_date_time-gcc41-mt-1_39.a
libboost_date_time-gcc41-mt.so -> libboost_date_time-gcc41-mt-1_39.so.1.39.0
Why don't I just get the .a and .so ?
Why these 3 symbolic links ?
And why do the original files have a so complicated name for the .so, with the release version mentionned twice ?
Isn't it possible to just have :
libboost_date_time-gcc41-mt-1_39.a
libboost_date_time-gcc41-mt-1_39.so
Thanks for help. I don't know what to do of these symbolic links.
Note : I am a newbie in Linux.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
符号链接是在两个名称之间共享同一文件的一种方式。例如,如果 A 链接到 B,则打开 A 或 B 将为调用程序提供相同的数据。
在这种情况下,您有 2 个文件 libboost_date_time-gcc41-mt-1_39.so.1.39.0 和 libboost_date_time-gcc41-mt-1_39.a。 .so 文件是共享库,.a 是静态库。
没有版本号的链接 libboost_date_time-gcc41-mt.so 和 libboost_date_time-gcc41-mt.a 存在,以便不关心版本号的构建可以使用这些库。
对于共享库,存在版本号的命名约定,因此完整的版本号位于末尾,以便构建系统可以精确控制版本号。
请参阅 Boost 文档 了解完整说明
A symbolic link is a way of sharing the same file between two names. For example if A is linked to B then opening A or B will give the same data to the calling program.
In this case you have 2 files libboost_date_time-gcc41-mt-1_39.so.1.39.0 and libboost_date_time-gcc41-mt-1_39.a. The .so files are shared libraries and .a are static libraries.
The links without version numbers libboost_date_time-gcc41-mt.so and libboost_date_time-gcc41-mt.a are there so that builds that do not care about the version number can use these libraries.
For shared libraries there is a naming convention with version numbers so that the full version number is at the end so the build system can have exact control of the version number.
see Boost docs for full explanation
我不知道任何关于 boost 或 bjam 的具体信息。
但最后两个,如果你看到的话,是版本无关的。因此,该 .so 或 .a 文件的任何使用者都可以仅使用基本名称来达到其目的。如果这些库的任何更新版本可用,则可以将其放在那里并只需修改符号链接以指向新版本。通过这种方式,他们可以同时拥有两个版本,这样如果任何人想要使用特定版本,他们可以直接使用它而无需符号链接。不关心版本的人可以使用基本名称本身来获取最新版本!
我认为如果你在unix机器上安装不同版本的java,就可以使用这种方式。至少,我记得在我的 Ubuntu 中看到过它。我们为 java 的每个版本/更新都有单独的文件夹。并且您还有另一个文件夹符号链接,它始终指向最新的 jre 版本文件夹。如果您在现有版本上安装不同版本的 gcc(尤其是 Linux 中的 rpm 包),也会出现这种情况
I dont know anything specific to boost or bjam.
But the last two, if you see are version independent. So any consumer of this .so or .a file could just use the base name for their purposes. In case, any newer version of those libaries are available, one could put it there and just modify the sym links to point to new version. In this way, they can have both versions in place, so that if any one wants to use the particular version they could use it directly without sym links. And people who dont care about version can use the base name itself to get the latest version!
I think this way is used if you install different versions of java in a unix machine. Atleast, i remember seeing it in my Ubuntu. We have separate folders for each version/update of java. And you have the another folder sym link which always points to latest jre version folder. This can also be seen if you install different version gcc over an existing version (especially rpm packages in linux)