bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Unable to depend on cc_library from objc_library

Open trevorgray opened this issue 11 years ago • 4 comments

Is there a way to use a cc_library in both a cc_binary and an objc_binary other than adding an objc_library for the cc_library?

Sample build command output:

bazel build examples/objc:PrenotCalculatorClasses
ERROR: /Users/trevorgray/code/src/github.com/google/bazel/examples/objc/BUILD:45:12: in deps attribute of objc_library rule //examples/objc:PrenotCalculatorClasses: cc_library rule '//examples/cpp:hello-lib' is misplaced here (expected objc_library, objc_import, objc_framework, objc_proto_library or j2objc_library).
ERROR: Analysis of target '//examples/objc:PrenotCalculatorClasses' failed; build aborted.
INFO: Elapsed time: 0.285s

Build rule:

objc_library(
    name = "PrenotCalculatorClasses",
    srcs = [
        "PrenotCalculator/AppDelegate.m",
        "PrenotCalculator/CalculatedValues.m",
        "PrenotCalculator/CalculatorViewController.m",
        "PrenotCalculator/CoreData.m",
        "PrenotCalculator/Equation.m",
        "PrenotCalculator/Literal.m",
        "PrenotCalculator/ValuesViewController.m",
    ],
    hdrs = glob(
        ["**/*.h"],
        exclude = ["PrenotCalculator/Expression.h"],
    ),
    bundles = [":PrenotCalculatorResources"],
    sdk_frameworks = ["CoreData"],
    xibs = ["PrenotCalculator/CalculatorViewController.xib"],
    deps = [
        ":CoreDataResources",
        ":ExpressionPrebuilt",
        "//examples/cpp:hello-lib",
    ],
)

trevorgray avatar Apr 26 '15 10:04 trevorgray

I thought there was a feature request for that already, but apparently not. In any case, this is (one of) the highest priority items for us, but it's a bit tricky to make work properly.

ulfjack avatar Apr 27 '15 13:04 ulfjack

+1

applmak avatar Apr 30 '15 16:04 applmak

@ulfjack Can someone more experienced with our iOS stuff have a look at this?

philwo avatar Sep 03 '15 21:09 philwo

This should be possible these days, this feature was introduced a while back.

aragos avatar Sep 18 '15 22:09 aragos