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

[feature request] Support cc_import of .so with soname #7059

Closed
yongtang opened this issue Jan 8, 2019 · 4 comments · May be fixed by #16100
Closed

[feature request] Support cc_import of .so with soname #7059

yongtang opened this issue Jan 8, 2019 · 4 comments · May be fixed by #16100
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules type: feature request

Comments

@yongtang
Copy link

yongtang commented Jan 8, 2019

Description of the problem / feature request:

At the moment cc_import supports linking to a shared library like libmylib.so. However, it does not support .so with soname, e.g., libmylib.so.2. It would be good to support .so with soname.

Feature requests: what underlying problem are you trying to solve with this feature?

In linux .so with soname is very common so to expand the usage of cc_import to soname would be ideal.

@ghost
Copy link

ghost commented Mar 3, 2020

Looks like this was touched on by 5efc8c4. Since that commit, one can do something like

cc_import(
    name = "mylib",
    interface_library = "libmylib.so",  # ld searches for this w/ -lmylib
    shared_library = "libmylib.so.1",  # soname embedded in library; runtime linker searches for this
)

@c-mita
Copy link
Member

c-mita commented Nov 23, 2020

As mentioned above, I believe this is resolved. If there's still an issue, please reopen.

@c-mita c-mita closed this as completed Nov 23, 2020
@dfreese
Copy link

dfreese commented Feb 2, 2022

I ran into this as well, however, I was using provided_by_system=True, which means I'm limited to interface_library. That field doesn't allow for a version to be specified.

Ran into this trying to provide a solution for nvidia-encode.so. The nvidia docker runtime doesn't create the link from nvidia-encode.so to nvidia-encode.so.1. As a result, there doesn't seem to be a great way to specify this in a way that bazel uses the system library when running tests, for example.

Let me know if this should be brought up as a separate issue (or should be considered an issue).

@m3rcuriel
Copy link
Contributor

I am in a similar problem and don't understand why interface_library shouldn't be able to take versioned .so files. It seems impossible to otherwise specify that libfoo.so.21 should not end up as a runfile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules type: feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants