共享对象文件中的版本号 [英] Version numbers in shared object files

查看:178
本文介绍了共享对象文件中的版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用GCC从一组C ++源文件构建共享对象文件。所有关于构建 .so 文件的示例教程都会显示使用 .so 后缀之后的版本号创建的文件。例如:

I'm building a shared object file from a group of C++ source files using GCC. All the example tutorials on building .so files show the file created with a version number after the .so suffix. For example:

gcc -shared -Wl,-soname,libmean.so.1 -o libmean.so.1.0.1  calc_mean.o

这将产生 .so file libmean.so.1.0.1

This would produce the .so file libmean.so.1.0.1

此外,如果我浏览我的 / usr / lib 目录本地机器,我看到许多 .so 文件末尾有版本号。

Additionally, if I browse the /usr/lib directory on my local machine, I see that many of the .so files have version numbers at the end.

我编译一个共享对象文件并将它放在 / usr / lib 中,链接器无法找到它,如果我把一个版本号结束。如果我删除版本号,它工作正常。我真的不在乎放一个版本号或不是,我只是不明白为什么这似乎是一个共同的约定,但这导致共享库不能使用链接器。那么,这里发生了什么?为什么要将版本号放在 .so 文件名的末尾?

However, when I compile a shared object file and place it in /usr/lib, the linker is unable to find it if I put a version number at the end. If I remove the version number, it works fine. I really don't care about putting a version number or not, I just don't understand why this seems to be a common convention, and yet this causes the shared library to not work with the linker. So, what's going on here? Why is there a convention to place the version number at the end of an .so file name?

推荐答案

我认为这< a>可以帮助你。

I think this can help you.

这篇关于共享对象文件中的版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆