This is an archive of the discontinued LLVM Phabricator instance.

Add minor version to libclang.so and libclang-cpp.so SONAME
AbandonedPublic

Authored by tstellar on Jan 18 2021, 8:19 PM.

Details

Summary

This patch is for the release/11.x branch. We need to bump the SONAME, because
the ABI of the shared library is changing

Diff Detail

Event Timeline

tstellar created this revision.Jan 18 2021, 8:19 PM
tstellar requested review of this revision.Jan 18 2021, 8:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2021, 8:19 PM
dim added a subscriber: dim.Jan 19 2021, 12:16 PM

@sylvestre.ledru removed the minor version from the binary (on purpose, I think?) in rGa8b717fda42294d1c8e1f05d71280503e5839f14:

commit a8b717fda42294d1c8e1f05d71280503e5839f14
Author: Sylvestre Ledru <sylvestre@debian.org>
Date:   Thu Mar 29 10:05:46 2018 +0000

    Rename clang link from clang-X.Y to clang-X

    Summary:
    As we are only doing X.0.Z releases (not using the minor version), there is no need to keep -X.Y in the version.
    So, instead, I propose the following:
    Instead of having clang-7.0 in bin/, we will have clang-7

    Since also matches was gcc is doing.

    Reviewers: tstellar, dlj, dim, hans

    Reviewed By: dim, hans

    Subscribers: dim, mgorny, cfe-commits

    Differential Revision: https://reviews.llvm.org/D41808

    llvm-svn: 328769

But this seems to have been mainly about the clang executable that gets installed into $prefix/bin, i.e. clang-11 instead of clang-11.1.

I think this doesn't matter for the clang executable here, since nobody uses its ABI. But indeed for the shared library it looks like a good solution, if you would want to install both versions side-by-side.

I might be wrong but if the ABI is incompatible, are we not supposed to update the SONAME itself?

I might be wrong but if the ABI is incompatible, are we not supposed to update the SONAME itself?

That's what this patch does, it updates the SONAME from *-11 to *-11.1.

Yeah, my question is more "is that enough for distro?"
https://www.debian.org/doc/manuals/maint-guide/advanced.en.html
https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html

I might be wrong but if 11.1 and 11.0 aren't compatible (not just adding a new function), I was wondering if if should not be 12 (I know it is terrible).
Maybe we can expect that packagers will know that 11.1 is like a 12 in term of soname

If the SONAME is different in any way, it is totally distinct to the dynamic linker. There's no semver parsing or anything like that. That's all we can do from a technical perspective, and the rest is just communication in the release.

sylvestre.ledru accepted this revision.Jan 20 2021, 8:41 AM

Let's do it then :)

This revision is now accepted and ready to land.Jan 20 2021, 8:41 AM

I guess this will be clearly mentioned in the release notes :)

cuviper added inline comments.Jan 20 2021, 11:32 AM
clang/tools/clang-shlib/CMakeLists.txt
54

I think you also need VERSION here, or else it symlinks back to .so.11.

tstellar added inline comments.Jan 20 2021, 1:50 PM
clang/tools/clang-shlib/CMakeLists.txt
54

I think add_clang_library is setting VERSION. This is what I get when I build:

lib/libclang-cpp.so -> libclang-cpp.so.11.1
lib/libclang.so -> libclang.so.11.1

cuviper added inline comments.Jan 20 2021, 1:59 PM
clang/tools/clang-shlib/CMakeLists.txt
54

I see those links, but also lib/libclang-cpp.so.11.1 -> libclang-cpp.so.11, with the latter being the real file. If I add VERSION explicitly, that goes away.
(I had to delete lib/libclang*.so* before rebuilding too.)

tstellar added inline comments.Jan 20 2021, 2:02 PM
clang/tools/clang-shlib/CMakeLists.txt
54

OK, I see it now. I can fix that.

tstellar updated this revision to Diff 318003.Jan 20 2021, 2:07 PM

Fix shared object symlinks.

cuviper accepted this revision.Jan 21 2021, 10:31 AM
tstellar abandoned this revision.May 12 2021, 10:30 AM