bazelbuild / bazelbuild/rules_apple

objc_framework as dep in cc_library

Open
#385 1 comment 0 reactions 0 assignees View on GitHub
P3 type: feature request
Dominant language
Starlark
Stars
593
Forks
334
Avg merge
16h 48m
Merged PRs (30d)
9

Description

Hi,

I'm in the process of migrating our build system to Bazel.
I've been trying to import the prebuilt OpenCV framework for iOS with:

```
apple_static_framework_import(
name = "opencv-ios",
framework_imports = glob(["opencv2.framework/**"]),
visibility = ["//visibility:public"],
)
```

When I use it as dependency for a cc_library I get the following error:

`xxx/BUILD: in deps attribute of cc_library rule //xxx: apple_static_framework_import rule '//:opencv-ios' is misplaced here (expected cc_library, objc_library, cc_proto_library or cc_import) and '//:opencv-ios' does not have mandatory providers: 'CcInfo'`

The framework contains the static library that I want to use within C++ code, which is eventually linked into a iOS framework.
Is this (importing a framework and linking them against cc_*) currently not possible within Bazel or am I doing something wrong here?

Contributor guide

Open the contributing guide

Research direction

Start with the apple_static_framework_import rule and the cc_library deps validation described in the error. Trace which providers the imported framework exposes and compare them with the providers accepted by cc_library. Done means the prebuilt OpenCV iOS framework can be used as a dependency from C++ code without the reported misplaced-rule or missing-CcInfo errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, ios
Domain
build-system, mobile-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.