
我用 cmake 来当作一个动态库的编译工具。动态库的命名由于一些原因,现在定为了 libhaha.so.1.123abc 中间版本号实际上就是取的 git commitid 。
现在出现个问题,现在 /usr/local/lib 下有
-rwxr-xr-x 1 root root 196661112 5 月 29 11:20 libhaha.so.5.352efad6 -rwxr-xr-x 1 root root 196661112 5 月 28 19:24 libhaha.so.5.145f528c -rwxr-xr-x 1 root root 196627472 5 月 28 16:18 libhaha.so.5.6910a61a -rwxr-xr-x 1 root root 196627088 5 月 28 14:20 libhaha.so.5.dd1296e1 -rwxr-xr-x 1 root root 196616048 5 月 28 13:50 libhaha.so.5.74404bc4 -rwxr-xr-x 1 root root 196615760 5 月 28 10:46 libhaha.so.5.78393c5a -rwxr-xr-x 1 root root 196407288 5 月 28 10:32 libhaha.so.5.fb9da2af -rwxr-xr-x 1 root root 196313496 5 月 27 20:06 libhaha.so.5.8e217c7c -rwxr-xr-x 1 root root 195853792 5 月 27 15:37 libhaha.so.5.7a6fe752 这么些版本,
而我在make install后,是这样的(我是这么设计的)
lrwxrwxrwx 1 root root 29 5 月 29 12:42 libhaha.so.5 -> libframe_master.so.5.352efad6 lrwxrwxrwx 1 root root 20 5 月 29 12:14 libhaha.so -> libframe_master.so.5 -rwxr-xr-x 1 root root 196661112 5 月 29 11:20 libhaha.so.5.352efad6 -rwxr-xr-x 1 root root 196661112 5 月 28 19:24 libhaha.so.5.145f528c -rwxr-xr-x 1 root root 196627472 5 月 28 16:18 libhaha.so.5.6910a61a -rwxr-xr-x 1 root root 196627088 5 月 28 14:20 libhaha.so.5.dd1296e1 -rwxr-xr-x 1 root root 196616048 5 月 28 13:50 libhaha.so.5.74404bc4 -rwxr-xr-x 1 root root 196615760 5 月 28 10:46 libhaha.so.5.78393c5a -rwxr-xr-x 1 root root 196407288 5 月 28 10:32 libhaha.so.5.fb9da2af -rwxr-xr-x 1 root root 196313496 5 月 27 20:06 libhaha.so.5.8e217c7c -rwxr-xr-x 1 root root 195853792 5 月 27 15:37 libhaha.so.5.7a6fe752 但是当我再ldconfig后,就变成了这样:
lrwxrwxrwx 1 root root 29 5 月 29 12:43 libhaha.so.5 -> libframe_master.so.5.78393c5a lrwxrwxrwx 1 root root 20 5 月 29 12:14 libhaha.so -> libframe_master.so.5 -rwxr-xr-x 1 root root 196661112 5 月 29 11:20 libhaha.so.5.352efad6 -rwxr-xr-x 1 root root 196661112 5 月 28 19:24 libhaha.so.5.145f528c -rwxr-xr-x 1 root root 196627472 5 月 28 16:18 libhaha.so.5.6910a61a -rwxr-xr-x 1 root root 196627088 5 月 28 14:20 libhaha.so.5.dd1296e1 -rwxr-xr-x 1 root root 196616048 5 月 28 13:50 libhaha.so.5.74404bc4 -rwxr-xr-x 1 root root 196615760 5 月 28 10:46 libhaha.so.5.78393c5a -rwxr-xr-x 1 root root 196407288 5 月 28 10:32 libhaha.so.5.fb9da2af -rwxr-xr-x 1 root root 196313496 5 月 27 20:06 libhaha.so.5.8e217c7c -rwxr-xr-x 1 root root 195853792 5 月 27 15:37 libhaha.so.5.7a6fe752 我是始终没法理解这里 ldconfig 他的搜索顺序和规则。如果按照文件名上的版本号顺序,libhaha.so.5 不是应该指向 libhaha.so.5.8e217c7c 或者甚至 libhaha.so.5.fb9da2af 吗? 如果是按照文件的时间来排序,也是应该继续是 libhaha.so.5.352efad6 啊。
求解惑。
2 vivisidea 2024-05-29 13:45:03 +08:00 命名里面再加一个 build 时间戳呢 |