line / rules_apple_line

LINE's Apple rules for Bazel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Building a mixed_static_framework with fully_static_link feature

karamach opened this issue · comments

I am trying to make a simple framework for ios that has dependencies on some swift code as well as objc and cpp libraries. For the purpose of shipping it to thirdparty, it needs to be a single statically linked binary. While ios_static_framework does not allow transitive dependencies, mixed_static_framework seems to work well with transitive dependencies. But I am failing to get it to build a single static binary even after using the "fully_static_link" feature.

The documentation for mixed_static_framework mentions that the default behavior is to not link in dependencies but was hoping it would work with the fully_static_link. When I do nm on the library in the framework, I see the cpp class related symbols are not found.

Any help is appreciated.

Below is a sample bazel repo which is a simple counter. The swift code calls objc which in turn calls the cpp code that has the counter logic.

https://github.com/karamach/test

Building the target from the counter directory using the following command
bazel build //counter_swift_objc_cpp:counter_mixedFramework --apple_platform_type=ios --ios_multi_cpus=arm64 --apple_bitcode=embedded --copt=-fembed-bitcode

Please try adding avoid_deps = [], to your framework target.