-
Notifications
You must be signed in to change notification settings - Fork 393
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
The owner name is used instead of the filename when passing a static library using -lstatic
.
#2402
Comments
Sounds pretty reasonable to me - cc @UebelAndre who made the change in the first place. |
Sounds reasonable to me too! |
thb-sb
added a commit
to thb-sb/rules_rust
that referenced
this issue
Jan 9, 2024
…owner.name`. This commit fixes bazelbuild#2402 by using [`get_lib_name_default`] to pass libraries names to `rustc` through `-lstatic` instead of relying to the owner's name of the `File` object. [`get_lib_name_default`]: https://github.com/bazelbuild/rules_rust/blob/a1e9f9600cd22ecfdd08fc4a7572ccbdeba97395/rust/private/utils.bzl#L101
thb-sb
added a commit
to thb-sb/rules_rust
that referenced
this issue
Jan 9, 2024
…owner.name`. This commit fixes bazelbuild#2402 by using [`get_lib_name_default`] to pass libraries names to `rustc` through `-lstatic` instead of relying on the owner's name of the `File` object. [`get_lib_name_default`]: https://github.com/bazelbuild/rules_rust/blob/a1e9f9600cd22ecfdd08fc4a7572ccbdeba97395/rust/private/utils.bzl#L101
UebelAndre
added a commit
that referenced
this issue
Jan 9, 2024
…`. (#2405) This commit fixes #2402 by using [`get_lib_name_default`] to pass libraries names to `rustc` through `-lstatic` instead of relying on the owner's name of the `File` object. [`get_lib_name_default`]: https://github.com/bazelbuild/rules_rust/blob/a1e9f9600cd22ecfdd08fc4a7572ccbdeba97395/rust/private/utils.bzl#L101 Co-authored-by: UebelAndre <github@uebelandre.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello all,
In
_generate_cc_link_build_info
,-lstatic
is used to tellrustc
to link against a native static library:rules_rust/bindgen/private/bindgen.bzl
Line 116 in db03e3e
While this code should work in 99% of cases, it does not work when the archive does not bear the name of the rule that produced it.
Here is an example of a
WORKSPACE
and aBUILD
that showcases the issue:`WORKSPACE`
(
BUILD.zlib.bazel
can be found here)`BUILD`
And
$ touch foo.{c,h}
.The owner of
libfoo2.a
isfoo_copy
:$ bazel cquery --output=starlark :foo_proxy --starlark:expr="providers(target)['CcInfo'].linking_context.linker_inputs.to_list()[0].libraries[0].static_library.owner.name" foo_copy
But the filename is
libfoo2.a
:$ bazel cquery --output=starlark :foo_proxy --starlark:expr="providers(target)['CcInfo'].linking_context.linker_inputs.to_list()[0].libraries[0].static_library.basename" libfoo2.a
Building
:foo_bindgen
raises the following issue:Instead of using
lib.static_library.owner.name
, we should use something likelib.static_library.basename[3:-lib.static_library.extension - 1]
after checking the correctness of the filename.What do you think?
The text was updated successfully, but these errors were encountered: