bazelbuild / bazelbuild/rules_cc

system_library failing on MacOS

Open
#416 0 comments 0 reactions 0 assignees View on GitHub
P3 type: bug
Dominant language
Starlark
Stars
247
Forks
196
PR merge metrics
No merged PRs in 30d

Description

With latest `bazel_dep(name = "rules_cc", version = "0.1.1")` I add to MODULE.bazel:

```
system_library = use_repo_rule("@rules_cc//cc:system_library.bzl", "system_library")
system_library(
name = "libmagic",
hdrs = ["magic.h"],
static_lib_names = ["libmagic.a"],
shared_lib_names = ["libmagic.dylib", "libmagic.so"],
# Look into homebrew specific /lib and /include directories.
lib_path_hints = ["/opt/homebrew/lib"],
includes = ["/opt/homebrew/include"]
)
```

But it fails to build:

```
alexeagle@aspect-build bazel105 % find $(brew --prefix) -name magic.h
/opt/homebrew/include/magic.h
/opt/homebrew/Cellar/libmagic/5.46/include/magic.h
/opt/homebrew/Cellar/imagemagick/7.1.1-47/include/ImageMagick-7/MagickCore/magic.h
alexeagle@aspect-build bazel105 % find $(brew --prefix) -name libmagic.dylib
/opt/homebrew/lib/libmagic.dylib
/opt/homebrew/Cellar/libmagic/5.46/lib/libmagic.dylib
alexeagle@aspect-build bazel105 % bazel build @libmagic
INFO: Repository +_repo_rules+libmagic instantiated at:
: in
Repository rule system_library defined at:
/private/var/tmp/_bazel_alexeagle/4477e74205cb05f1e66aea9fd72f89b1/external/rules_cc+/cc/system_library.bzl:325:33: in
ERROR: /private/var/tmp/_bazel_alexeagle/4477e74205cb05f1e66aea9fd72f89b1/external/rules_cc+/cc/system_library.bzl:154:13: An error occurred during the fetch of repository '+_repo_rules+libmagic':
Traceback (most recent call last):
File "/private/var/tmp/_bazel_alexeagle/4477e74205cb05f1e66aea9fd72f89b1/external/rules_cc+/cc/system_library.bzl", line 154, column 13, in _system_library_impl
fail("Library {} could not be found".format(repo_name))
Error in fail: Library +_repo_rules+libmagic could not be found
```

FYI @thesayyn

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.