-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert #3358 which added libtool versioning to macOS libraries #3550
Comments
CCing @tschoonj @ryandesign |
I would suggest that we add Either that, or we start using libtool versioning consistently everywhere in Meson, which is not something I would recommend. |
I don't see the confusion really: my patch emulates libtool behaviour on macOS, which is exactly what I wanted it to do. I was always very clear about this. Just so you know: my patch works fine as it has been applied successfully (in fact the full version from #2577, including the I also fail to understand why you say that Apple does not recommend the libtool style versioning, even though their own example (from your link) uses it. Even though the linker does not use |
Where does it say that? The only reference to libtool I could find was Apple saying that you can use it to generate libraries for you. As far as I could see, the examples use
The issue is that we purposely do not use libtool versioning in Meson elsewhere, so it's a matter of consistency. I can see how this would cause issues in Homebrew because the ABI changes as soon as a project moves to Meson, but as I understand it, that would be solved by doing a rebuild of everything that uses that project? At least that's how Linux distros handle ABI breakage. Alternatively, you can patch the project to set |
Apples reference to libtool is very likely about Apples libtool not GNU libtool, I think. |
Note that this issue was originally brought up in the initial PR by @ryandesign, I just pointed out that this was never really addressed before merging the PR. |
Apple sets compatibility version and current version on everything in /usr/lib: |
Indeed, very similar to what my patch does. Before my patch there was no use of
Rebuilding is something that we avoid whenever possible as it is very time-consuming, and causes trouble for users who have built their own libraries against an old version of a library: when updated with the package manager, their own own library will refuse to load at run time.
|
I am not disputing whether we should set
Thanks for that link. It seems Apple does not use libtool versioning. From what I can tell, they set it to Would be great to figure out what XCode does for this. |
As I mentioned in the previous PR, I am not convinced that they are. GNU libtool is able to compute the library's major version, minor current version and minor compatibility version because the library author has to follow very specific rules when specifying the |
In my initial exchange with @jpakkane (as well as the PR title...) in #2577 I made it abundantly clear that I was trying to emulate the libtool versioning scheme on macOS. I appreciate that libtool is problematic in many ways but this particular thing it does well. This did not appear to be a problem at the time. |
I don't think that will be instructive. Since Xcode is a Mac-specific IDE, it merely lets the developer specify the library's major version, minor current version and minor compatibility version directly. The fact that these concepts don't map one-to-one to how other operating systems version their libraries is not Xcode's concern. |
From what I understand, GNOME projects that migrated to meson are now putting hacks into their Some projects are manually adding From json-glib:
and
|
Certainly, if the library changes in an incompatible way (e.g. a public function is removed), increase its major version number so that all consumers must rebuild to link with the new library. But if the library has not changed incompatibly, don't change the major version! This and other aspects of sane library version number curation are the responsibility of each developer who makes a library. Unfortunately, many developers don't realize that they have this responsibility, or don't realize that switching build systems will have an impact on it. This happened recently with the release of libebml 1.3.6 and libmatroska 1.4.9 in which the developers switched from autotools with libtool to cmake, which had the unintended side effect of decreasing the library's minor version numbers on macOS thus making the new library incompatible with all software that had been linked with the previous version. The developers didn't realize that libtool uses a different library version numbering scheme on macOS than it does on Linux, while cmake doesn't have that difference. I'm not sure how far a build system can go mitigate this problem. It's not necessarily meson's problem that libtool uses the library versioning scheme it does. If meson adopted libtool's versioning scheme, with all of its platform differences, that would help projects coming to meson from libtool, but wouldn't help those coming from cmake or other build systems. Perhaps it would be helpful to document information about this problem and how to avoid it, if that hasn't already been done. |
The problem of Libtool's versioning scheme is that the we have to fully support it and all its bugs and I'm fairly sure it is not properly documented anywhere. Also libtool as a project is as good as dead. If we ever need to support a platform that libtool does not, then we are again in trouble. And in fact I would not be that surprised if Apple removed their own libtool altogether in some future release of macOS. They have done it before with e.g. OpenSSL. If we could have exact, specific and unambiguous data that does "the right thing" or a fairly good approximation thereof on all platforms, then that would probably the better thing to do. |
Just to be abundantly clear (since you linked to my project): the only reason those hacks were added was because you opened a bug about it asking for backward compatibility with libtool in homebrew. I'd be happy to:
|
@ebassi That's only true for the second hack involving |
@jpakkane Apple's libtool is not used by Autotools. The libtool that gets used during a build is actually a script that is generated when running configure, and which does not make use of Apple's libtool. |
As per discussion on IRC with @jpakkane, we will revert the original patch for 0.46.1, and add new API in 0.47 which will allow projects to set
I will work on a mechanism that allows projects to easily set the version/soversion/compatibility_version/current_version/etc to more accurately match libtool's versioning if they have releases to maintain ABI compatibility with. Will open a new bug about it. |
Ok, fair enough. Hope this will get resolved in 0.47 then. Homebrew currently has two meson formulas: We use Users that just want to build their own projects with meson are expected to use the regular |
I'm happy to hear that, I was concerned that people that are using meson in their workflow might be affected/confused by the patch you have been carrying. Glad that you already thought of it! |
(copying my comment from the PR to this issue)
After discussing with @ePirat it looks like we merged this PR incorrectly. -current_version is not used for any decisions by the linker (so we can set it to be the project version), and -compatibility_version is meant to be set by the developer to signal backwards-compatibility, so that older apps can load newer libraries if the compatibility version matches.
This means that at best, we can set it to soversion. The versioning in this PR is not recommended by Apple, but is what is used by libtool, and we do not use libtool versioning anywhere else in Meson.
It is going to be very confusing if we version libraries on Linux in one way and on macOS using another way.
We should revert this PR.
See:
https://cmake.org/Bug/view.php?id=4383#c9569
https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/CreatingDynamicLibraries.html
The text was updated successfully, but these errors were encountered: