How to use "frameworks" for mac builds?
- Dominant language
- Rust
- Stars
- 4.4k
- Forks
- 394
- PR merge metrics
- No merged PRs in 30d
Description
Hi, new to the buck on Mac. I am adding "-framework SomeFramework" to the link flag on Mac (can be implemented by exported_link_flags). So I added the framework to the hello world, like
```
cxx_library(
name = "print",
srcs = glob(["**/*.cpp"]),
exported_headers = glob(["**/*.hpp"]),
visibility = ["PUBLIC"],
frameworks = [
'$SDKROOT/System/Library/CoreAudio.framework',
],
)
```
I am seeing missing apple toolchain error
```
4: Traceback (most recent call last):
File , in
* prelude/cxx/cxx.bzl:169, in cxx_library_impl
output = cxx_library_parameterized(ctx, params)
* prelude/cxx/cxx_library.bzl:427, in cxx_library_parameterized
shared_links, link_group_map, link_execution_preference = _get_shared_library...
* prelude/cxx/cxx_library.bzl:1067, in _get_shared_library_links
return apple_build_link_args_with_deduped_flags(
* prelude/apple/apple_frameworks.bzl:135, in apple_build_link_args_with_deduped_flags
link_info = _link_info_from_linkables(ctx, [merged.frameworks[link_style], fr...
* prelude/apple/apple_frameworks.bzl:194, in _link_info_from_linkables
framework_link_args = _get_apple_frameworks_linker_flags(ctx, merge_framework...
* prelude/apple/apple_frameworks.bzl:50, in _get_apple_frameworks_linker_flags
expanded_frameworks_paths = _expand_sdk_framework_paths(ctx, linkable.unresol...
* prelude/apple/apple_frameworks.bzl:92, in _expand_sdk_framework_paths
return [_expand_sdk_framework_path(ctx, unresolved_framework_path) for unreso...
error: Object of type `struct` has no attribute `_apple_toolchain`
--> prelude/apple/apple_frameworks.bzl:95:28
|
95 | apple_toolchain_info = ctx.attrs._apple_toolchain[AppleToolchainInfo]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
```
How should I make this work and passing apple_toolchain ?
Contributor guide
Research direction
Reproduce the hello-world cxx_library example with the frameworks entry and start in prelude/apple/apple_frameworks.bzl, following the call from prelude/cxx/cxx_library.bzl. Check how the Apple toolchain is expected to reach _expand_sdk_framework_path; done means the framework link flags are processed without the missing _apple_toolchain error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, macos
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100