bazel-ios/rules_ios

Adding --ios_minimum_os in CLI causing duplicate symbol issue

nanwng opened this issue · 6 comments

I created a reproducer for the issue in the the branch

It's mainly changing a framework's platform to be "13.0"
Then I run bazel build --ios_minimum_os=13.0 tests/ios/app:App
It's getting error:

duplicate symbol '_OBJC_CLASS_$_FW' in:
    bazel-out/ios-x86_64-min13.0-applebin_ios-ios_x86_64-dbg-ST-70a2d60cb7ad/bin/tests/ios/app/libFW_objc.a(FW.o)
    bazel-out/ios-x86_64-min13.0-applebin_ios-ios_x86_64-dbg-ST-5fd3ee858804/bin/tests/ios/app/libFW_objc.a(FW.o)
duplicate symbol '_OBJC_METACLASS_$_FW' in:
    bazel-out/ios-x86_64-min13.0-applebin_ios-ios_x86_64-dbg-ST-70a2d60cb7ad/bin/tests/ios/app/libFW_objc.a(FW.o)
    bazel-out/ios-x86_64-min13.0-applebin_ios-ios_x86_64-dbg-ST-5fd3ee858804/bin/tests/ios/app/libFW_objc.a(FW.o)
ld: 2 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It seems there are multiple configs being produced for FW

However if I ran: bazel build --ios_minimum_os=13 tests/ios/app:App then it builds fine

@nanwng thank you kindly for sending the issue, is this a new thing that you encountered as of yesterday?

It'd be great to get this better covered on CI also, I think there is missing coverage on some of the linker invocations. If we treat warnings as errors on ld it should catch this?

@jerrymarino I'm not sure if it's a new thing. I think we started to see this since we adopted rules-ios. Could be there for a long time.

Ok makes sense, we got some different kinds of tests to verify outputs are built for that platform one time, even in the face of transitions bugs in bazel / rules_apple and different versions.

Today we build that app with a different OS version 10.2 than in platforms but it seems to work there. Can you add a case for this on CI
https://github.com/bazel-ios/rules_ios/blob/master/.github/workflows/tests.yml#L128

Sent this to run on github actions for a repro as it didn't happen for me locally - one other thing to check is if you're on the latest version of the rules. There was a few problems with this about a year ago

@nanwng are you able to confirm if this is still happening with the latest version of the rules? Let me know if we should keep this issue open to investigate or not 🙏