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

cc_libraries unable to depend on objc_import #10740

Closed
cpsauer opened this issue Feb 10, 2020 · 4 comments
Closed

cc_libraries unable to depend on objc_import #10740

cpsauer opened this issue Feb 10, 2020 · 4 comments
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules type: support / not a bug (process)

Comments

@cpsauer
Copy link
Contributor

cpsauer commented Feb 10, 2020

Hi awesome Bazel team,

Is there any way we could allow objc_imports to be direct deps of cc_libraries? It'd be really handy when working with C or C++ libraries on Apple platforms.

For context, I'm trying to use a .a archive for iOS that has a C interface. It needs to be imported with objc_import, because (as you'd expect) it uses sdk_frameworks as dependencies.

Right now this fails with the error message

in deps attribute of cc_library rule <<omitted cc_library rule>>: objc_import rule <<omitted objc_import rule>> is misplaced here (expected cc_library, objc_library, cc_proto_library or cc_import) and <<omitted objc_import rule>> does not have mandatory providers: 'CcInfo'

This isn't ideal because it's pretty reasonable to have C/C++ interfaces (conditionally) used from C++ code on Apple platforms. One can (and I will) temporarily work around by doing multiple layers of rule wrappers, but that's fairly ugly. (The simple workaround is blocked by #10738).

Thanks,
Chris
(ex-Googler)

@dslomov dslomov added team-Rules-CPP Issues for C++ rules untriaged labels Feb 10, 2020
@oquenchil oquenchil added P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Feb 18, 2020
@oquenchil
Copy link
Contributor

Hey Chris, you may be interested in this issue: #10674

I think once the work there is done, it will reduce a lot of the pains you are having.

@oquenchil oquenchil added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) type: support / not a bug (process) and removed P2 We'll consider working on this in future. (Assignee optional) labels Nov 19, 2020
@cpsauer
Copy link
Contributor Author

cpsauer commented Nov 20, 2020

Hey @oquenchil, saw you closed this. Any chance you'd be willing to keep it open as a dependent of the issue you mentioned until the CC/objc interop stuff gets fixed?

Definitely still feels like a bug/oversight (rather than support), since cc_libraries can depend on objc (as they should). Seems like the same should hold, even if the objc is precompiled.

@cpsauer
Copy link
Contributor Author

cpsauer commented Dec 16, 2020

@oquenchil ?

@cpsauer
Copy link
Contributor Author

cpsauer commented Apr 16, 2021

For anyone else looking, this was fixed in 4.0, along with a bunch of other objc_library issues bundled in #10674.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules type: support / not a bug (process)
Projects
None yet
Development

No branches or pull requests

3 participants