Skip to content
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

Stop hardcoding SOVERSION for stdlibs #43223

Closed
wants to merge 3 commits into from
Closed

Stop hardcoding SOVERSION for stdlibs #43223

wants to merge 3 commits into from

Conversation

nalimilan
Copy link
Member

Hardcoding versions is actually not needed as the build already creates symlinks from libXXX.so to libXXX.so.Y.Z. Since Julia does not always need a particular version, it is better to use the link which is created based on the one which was available at build time.
It also reduces the number of places to edit when upgrading to a new SOVERSION.
This was already the case for several libraries on Windows.

Fixes #40198.

Hardcoding versions is actually not needed as the build already creates
symlinks from libXXX.so to libXXX.so.Y.Z. Since Julia does not always
need a particular version, it is better to use the link which is created
based on the one which was available at build time.
It also reduced the number of places to edit when upgrading to a new SOVERSION.
This was already the case for several libraries on Windows.
Comment on lines 23 to 27
elseif Sys.isapple()
const libuv = "@rpath/libuv.2.dylib"
else
const libuv = "libuv.so.2"
const libuv = "libuv.so"
end
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why, but on Windows only libuv-2.dll is in the ZIP, not libuv.dll like for other libraries. So I skipped it on Windows and Mac to avoid breaking something (I couldn't check Mac).

@giordano
Copy link
Contributor

giordano commented Nov 25, 2021

I suspect this will make #40556 even more problematic

This was already the case for several libraries on Windows.

Probably mainly because Windows doesn't really have the concept of SONAME/SOVERSION.

Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would seem to be the wrong name for these libraries, however, since the SONAME is the 'real' name and that includes the version number. We also can't test CI against all possible incompatible versions of a library, which is what an SONAME bump indicates.

@staticfloat
Copy link
Member

I'm kind of against this; there's no guarantee that loading libfoo.so.3 when you expected libfoo.so.2 will work; it may in some cases, it may not in others, and when we ignore SONAMEs completely, we kine of throw away any ability to reject an improper library. I don't think it's worth it if installing a newer version of libfoo on your system suddenly causes Julia to stop working.

@nalimilan
Copy link
Member Author

I don't think it's worth it if installing a newer version of libfoo on your system suddenly causes Julia to stop working.

AFAIK it shouldn't, as we always create symlinks from unversioned libXXX.so to libXXX.so.X.Y in $libdir/julia.

This change would only make a difference when passing USE_SYSTEM_XXX=1 explicitly anyway, which is only used by people who by definition prefer using the system library as much as possible. The idea is to get closer to how programs written in C typically work: they define version bounds for their dependencies, and as long as they match the build works and the SOVERSION is defined to be the one used at compile time. This is essential because a given program never uses all of the API of its dependencies, so it's quite common that it works with several SOVERSIONs.

@fingolfin
Copy link
Member

But for those typical C programs, you do hardcode the SOVERSION; however, you can recompile them to support a newer SOVERSION. In the case of Julia, of course you recompile Julia itself. But then there are many many JLLs out there, which also contain binary code which may link against those standard libraries.

E.g. a ton link against GMP or MPFR. Now, right now, all of them are actually safe to use with any GMP 6.x version. But this may change: perhaps GMP 7 is released tomorrow and you want to use it on your system, and it happens to be "compatible enough" for Julia itself; but for some of those JLLs it may not be.

The result then will be segfaults.

So I think any change made here also needs to come with a plan to deal with JLLs that were built against specific versions of stdlibs.

@nalimilan
Copy link
Member Author

One of the reasons why changing SOVERSIONs are so annoying is that MbedTLS breaks its API and bumps SOVERSION in minor releases, because its developers want to change a field or two in a struct. This isn't a sane versioning scheme. :-/ JuliaPackaging/Yggdrasil#4179 (comment) JuliaPackaging/Yggdrasil#4180 (comment)

@fingolfin
Copy link
Member

Aye. But the solution for that can't be to just not track the SOVERSION. That'd be like "uncaught exception are annoying so let's not throw any exceptions anymore" :-)

@ViralBShah
Copy link
Member

Is this ready to merge?

@giordano
Copy link
Contributor

giordano commented Feb 8, 2022

I don't think there is much agreement on this change.

@ViralBShah
Copy link
Member

Is it ok to convert it to draft in that case?

@fingolfin
Copy link
Member

I think this has no chance of being merged for reasons outlined in the discussion.

@fingolfin fingolfin closed this Feb 23, 2024
@giordano giordano deleted the nl/soversion branch February 23, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't hard-code libmbedcrypto.so version
6 participants