-
Notifications
You must be signed in to change notification settings - Fork 74.2k
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
Add soversion to libraries #22797
Add soversion to libraries #22797
Conversation
@perfinion : Thanks for the PR, but could you elaborate a bit on this? When building from source we'll always only have a single shared library, not a versioned one. So perhaps what you want is for this versioning to be done in the binary distributions rather than by changes to the BUILD rules? Or am I missing something? |
@asimshankar Sorry, the background is at https://groups.google.com/a/tensorflow.org/forum/#!topic/build/0FjOGrinf5k I should have linked that in the beginning. |
@asimshankar, @perfinion mentioned the other day that this naming setup was working for everything but Java. Could you take another look at it? (@perfinion, can you describe what you're doing again, like you did in the SIG Build meeting?) |
A summary of the reasons for this change: Distros are quite strict about versioning the libraries properly so that binary compatibility is easy. Whenever a library makes a breaking change the verison in the library is supposed to change accordingly, then other binaries will link to those specific versions. Lets take nsync as a specific example.
when building a program that uses nsync, you'd build with The linking is like this, notice the .1 that its using.
Bazel does not really understand these versioning things so I've used a bunch of genrules to make the symlinks and they work well for all the C++ and go stuff. java is the bit that isn't linking quite right to them. or rather, it is linking to them properly, but later fails because it needs the lib itself and the symlink but only has one. |
Asim has left the company, and @sjamesr is the new owner for the Java releases -- maybe he can help with the breakages. |
Hi there, I looked at this a couple of days ago and couldn't reproduce the failures. I'll take another shot at it again today. |
@sjamesr hey, thanks for looking into this! yeah, I rebased and tried recently too and the java tests pass on my machine. I'm not sure what changed to make it work now tho. The tests still appear to be failing on some of the builders (but not all, so it clearly sometimes works?). I've been playing around with building with the remote execution in a container to see if that'll help find the error but not gotten that going yet. Do let me know if you find how to repro the issues :) |
I managed to get the java tests to fail using RBE. The targets all build properly, just the tests fail at runtime. Hopefully i'll figure out how to make them run now. |
@angersson @sjamesr It should pass java and go tests now. RBE is a lot stricter so I could track things down. Basically added tf_binary_additional_srcs() to data= and a few places like that so It was properly in the deps. The symlink is not a proper library according to bazel so it can't be put in srcs= or deps= like normal but data= followed the same pattern as several other libs. I'm seeing a failure of the tests in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks for this!
|
||
return select({ | ||
clean_dep("//tensorflow:macos_with_framework_shared_object"): [ | ||
clean_dep("//tensorflow:libtensorflow_framework%s.dylib" % suffix), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@allenlavoie about the macos change here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me; sounds like name.major.minor.dylib is idiomatic.
PiperOrigin-RevId: 239834034
tensorflow#22797 added the versioned tensorflow_framework libraries. The pip wheel had both the .so.1 and .so.1.13.1 libs but was missing the unversioned .so lib. This adds it back. The full .so.1.13.1 lib is probably not needed here but removing it should come separately later on. Signed-off-by: Jason Zaman <jason@perfinion.com>
tensorflow#22797 added the versioned tensorflow_framework libraries. The pip wheel had both the .so.1 and .so.1.13.1 libs but was missing the unversioned .so lib. This adds it back. Also, fix //tensorflow/tools/lib_package:clib tar file to include versioned libs. Signed-off-by: Jason Zaman <jason@perfinion.com>
Add version to library sonames
Previously the libs were just "libtensorflow.so" without any version.
This adds the version to the library (eg libtensorflow.so.1.13.0) and
adds the appropriate symlinks to the full name from the base and
soversion.
The soname is used by compilers to fill in the DT_NEEDED section in the
header of binaries that link to the library. Having the version means
that different versions of the library are able to co-exist and if the
ABI changes, programs linking to the lib do not break.
For more info see:
https://www.debian.org/doc/debian-policy/ch-sharedlibs.html
https://autotools.io/libtool/version.html
Signed-off-by: Jason Zaman jason@perfinion.com