-
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
Generate shared library version arguments on macOS #1451
Comments
PS: there is already an open PR about this: #1445 |
(transferring info found on anholt/libepoxy#108) This is the code that libtool generates for setting compatibility and current versions:
Besides libtool doing that,
This is contradicted by Apple's developer documentation which say [0, 65535] for In an extra twist, cmake behaves in its own way. This is the list of libraries created by
It maps the The next question is, what does XCode do ;) I'm sure it doesn't use libtool so it should actually be the canonical source to find out what Apple wants us to do. |
Based on the The autotools |
Any progress on this? Thanks! |
I'll look into this tomorrow. |
Did you have a chance to look into this already? Thanks |
Nope, soon after I said that I caught Dengue fever, and I'm still away from work. Can only look at this next week. |
Sorry to hear that! Hope you recover soon! |
Have you been able to address this issue? With GNOME 3.26 being released now, and a lot of packages being meson only at this point, it would be really great to see a fix for this. I hope you recovered well from your dengue. I was in India myself for the past two weeks and have heard a lot of stories about people getting dengue and chikungunya! |
@tschoonj yes, I am better now, but I was away from work again for some other reason. I think I can look into this on Wednesday or Thursday. Thanks for reminding again, there's a lot of open issues and PRs and it's getting hard to keep track. 😄 |
Glad to hear you're better. Thanks for looking into this. It's getting kind of urgent now ;-) |
I stole the behaviour for all of these things from CMake, because their backend is usually correct. This issue may be due to a) not doing the same thing as them or b) we did do the same thing but implementation drifted. We should check what they do currently and try to do the same if possible. |
I just rebuild a CMake project and saw that the generated Makefiles use both ``-compatibility_version and FWIW I would recommend to copy the behavior from libtool, in order to ensure a smooth transition on macOS for autotools based projects to meson/ninja, as otherwise one may have to provide different library versions for Linux and macOS if CMake does something different (which I think it does). |
We are hesitant to copy anything from libtool because on average everything it does is terrible, wrong and unmaintainable. Instead we should do the "platform native thing" which is what CMake mostly does as well. |
I can confirm that in this particular case, libtool does it right 😄 |
Hi @nirbheek Any progress here? Thanks! |
We now use the soversion to set compatibility_version and current_version by default. This is the only sane thing we can do by default because of the restrictions on the values that can be used for compatibility and current version. Users can override this value with the `darwin_versions:` kwarg, which can be a single value or a two-element list of values. The first one is the compatibility version and the second is the current version. Fixes #3555 Fixes #1451
We now use the soversion to set compatibility_version and current_version by default. This is the only sane thing we can do by default because of the restrictions on the values that can be used for compatibility and current version. Users can override this value with the `darwin_versions:` kwarg, which can be a single value or a two-element list of values. The first one is the compatibility version and the second is the current version. Fixes #3555 Fixes #1451
With this, the compatibility version and current version values in macOS and iOS dylibs will match the values set by Autotools. See: mesonbuild/meson#1451
With this, the compatibility version and current version values in macOS and iOS dylibs will match the values set by Autotools. See: mesonbuild/meson#1451
We now use the soversion to set compatibility_version and current_version by default. This is the only sane thing we can do by default because of the restrictions on the values that can be used for compatibility and current version. Users can override this value with the `darwin_versions:` kwarg, which can be a single value or a two-element list of values. The first one is the compatibility version and the second is the current version. Fixes #3555 Fixes #1451
We now use the soversion to set compatibility_version and current_version by default. This is the only sane thing we can do by default because of the restrictions on the values that can be used for compatibility and current version. Users can override this value with the `darwin_versions:` kwarg, which can be a single value or a two-element list of values. The first one is the compatibility version and the second is the current version. Fixes mesonbuild#3555 Fixes mesonbuild#1451
With this, the compatibility version and current version values in macOS and iOS dylibs will match the values set by Autotools. See: mesonbuild/meson#1451
With this, the compatibility version and current version values in macOS and iOS dylibs will match the values set by Autotools. See: mesonbuild/meson#1451
See also: anholt/libepoxy#108.
On macOS libraries should be annotated with
-compatibility_version
and-current_version
, which are used by the linker to determine the ABI of a shared library.While the major number is set in the name of the library itself, e.g.
libfoo.1.dylib
, the minor version is set using-current_version 1.0
, for a minor version of1.0
. A newer micro/patch version oflibfoo
would have a-current_version 1.1
, and so on, and so forth.The
-compatibility_version
argument allows the linker to load backward compatible libraries. Thus, iflibfoo.1.dylib
with current version of 1.1 is backward compatible withlibfoo1.dylib
with current version 1.0, it would set-compatibility_version 1.0
.Meson currently does not set any of these fields, which means they default both to 0. The macOS linker does not really like it when that happens, and flags libraries built with Meson as ABI-incompatible with the same library built with autotools.
Libtool uses the soversion as a way to generate those values, instead:
version_info = "{}:{}:{}".format(current, revision, age)
major = current - age
current_version = "{}.{}".format((current + 1), revision)
compatibility_version = current + 1
The
major
field is used to determine the major version in the dylib file.The text was updated successfully, but these errors were encountered: