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
Fix linking against versioned shared library #513
Fix linking against versioned shared library #513
Conversation
e07622b
to
041f481
Compare
I believe this will likely fix #91 |
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.
Seems reasonable - any chance you can add/modify an example so that we have a test for this behaviour?
I was trying to figure out the right way to do this. I'm not sure if I can
get bazel to create a shared library with the appropriate suffix, so I
might have to include a very small dummy shared object as a binary in order
to write a test, would that be reasonable or do you have a better idea?
…On Tue, Dec 1, 2020 at 12:59 AM Daniel Wagner-Hall ***@***.***> wrote:
***@***.**** commented on this pull request.
Seems reasonable - any chance you can add/modify an example so that we
have a test for this behaviour?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#513 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA5AFZXCJGJADKUGHQZOTDSSSV7PANCNFSM4UHLPZBQ>
.
|
Maybe you could use copy_file to rename it? |
If |
45cf0da
to
d895bf4
Compare
I added a test, but I'm having trouble making it pass on non-linux platforms. The problem is that it appears that dynamic linking is not allowed on darwin:
Additionally, there doesn't appear to be a way to have targets that only build on one platform until bazel 4.0 comes out. 3.7.0 has compatible_with on the cc_library which looks like what I want, but it can't be used with contraints:
The last idea I had was to mark the rules manual and use
I'm out of ideas on how to make the test work on other platforms. Any tips? |
d895bf4
to
d885cd2
Compare
Sigh. Sorry about the wild chase! Let's make the test linux only, and add it as an excluded test in |
Can we please just add the test in a later PR? I'd rather not break the ability to |
If we tag it as |
ed518e3
to
4788dac
Compare
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.
Thanks!
Co-authored-by: Daniel Wagner-Hall <dawagner@gmail.com>
I was having trouble linking against
libruby.so
because at runtime the linker tries to find a versioned form likelibruby.so.2.7
. Versioned shared libraries were being filtered out of the depset because they don't end with.so
.rust_test
rules would then fail at runtime because althoughlibruby.so
existed in the sandboxed_solib
directory,libruby.so.2.7
did not.starlark does not have regex support, so I cannot directly check for version numbers after the extension. Instead, it uses the assumption (also made elsewhere) that library names do not contain periods before the extension.