bazel-ios/rules_ios

`bazel build //tests/ios/xcframeworks/Basic:xcframeworks` is failing

qyang-nj opened this issue · 2 comments

This is on the latest master branch. bazel build //tests/ios/xcframeworks/Basic:xcframeworks is failing with the following error.

tests/ios/xcframeworks/Basic/Sources/Foo.swift:6:16: error: cannot find 'FooDynamic' in scope
    let foo1 = FooDynamic(num: 9000)
               ^~~~~~~~~~
tests/ios/xcframeworks/Basic/Sources/Foo.swift:9:16: error: cannot find 'FooStatic' in scope
    let foo2 = FooStatic(num: 9000)
               ^~~~~~~~~
Target //tests/ios/xcframeworks/Basic:xcframeworks failed to build

Similarly, bazel build //tests/ios/xcframeworks/Basic:XCFrameworksApp fails on M1 laptop or with --cpu=ios_sim_arm64 option.

ld: 14 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in child process '/usr/bin/xcrun'. 1
Target //tests/ios/xcframeworks/Basic:XCFrameworksApp failed to build

So for //tests/ios/xcframeworks/Basic:xcframeworks you need to set --apple_platform_type=ios. Once #719 merges this should be as easy as --config=ios when building things under tests/ios.

For //tests/ios/xcframeworks/Basic:XCFrameworksApp you need to run it like:

bazel build //tests/ios/xcframeworks/Basic:XCFrameworksApp --apple_platform_type=ios --features=apple.virtualize_frameworks

Just tried both on my M1 and they're building with the platform flag (and vfs for app). It might be a bug though that Basic:XCFrameworksApp only works with VFS.

Interesting. Why don't we make --apple_platform_type=ios the default option, especial this repo is rules ios? 😏

It might be a bug though that Basic:XCFrameworksApp only works with VFS.

Yeah. It's probably less a problem if VFS is the default option.