launchdarkly / react-native-client-sdk

LaunchDarkly Client-side SDK for React Native
Other
47 stars 32 forks source link

Build fails in Xcode 13.3.1 #142

Closed jeff-groove closed 2 years ago

jeff-groove commented 2 years ago

Describe the bug Project is unable to build when using the LaunchDarkly client SDK and Xcode 13.3.1. Build always fails with error ld: symbol(s) not found for architecture .... LaunchDarkly-specific context in logs below.

To reproduce Attempt to build a React Native project with the LaunchDarkly client SDK as a dependency using Xcode 13.3.1.

Expected behavior The project should successfully build.

Logs

Undefined symbols for architecture x86_64:
  "_swift_stdlib_isStackAllocationSafe", referenced from:
      function signature specialization <Arg[1] = Owned To Guaranteed> of generic specialization <Swift.String, Swift._NativeSet<Swift.String>> of Swift._NativeSet.genericIntersection<A where A == A1.Element, A1: Swift.Sequence>(A1) -> Swift._NativeSet<A> in libLaunchDarkly.a(FlagChangeNotifier.o)
      function signature specialization <Arg[1] = Owned To Guaranteed> of generic specialization <Swift.String> of Swift._NativeSet.intersection(Swift._NativeSet<A>) -> Swift._NativeSet<A> in libLaunchDarkly.a(FlagChangeNotifier.o)
      function signature specialization <Arg[1] = Owned To Guaranteed, Arg[2] = Owned To Guaranteed> of function signature specialization <Arg[0] = [Closure Propagated : closure #1 (Swift.String) -> Swift.Bool in LaunchDarkly.FlagChangeNotifier.(findChangedFlagKeys in _AAE936965AC09485A5BF28D82C960463)(oldFlags: Swift.Dictionary<Swift.String, LaunchDarkly.FeatureFlag>, newFlags: Swift.Dictionary<Swift.String, LaunchDarkly.FeatureFlag>) -> Swift.Array<Swift.String>, Argument Types : [[Swift.String : LaunchDarkly.FeatureFlag][Swift.String : LaunchDarkly.FeatureFlag]]> of generic specialization <Swift.String> of Swift._NativeSet.filter((A) throws -> Swift.Bool) throws -> Swift._NativeSet<A> in libLaunchDarkly.a(FlagChangeNotifier.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

SDK version 6.2.0

Language version, developer tools Xcode 13.3.1

OS/platform Builds attempted on Macbook Pro and CI/CD environment running a macOS image, failing in both locations.

Additional context Possibly related to open issue #140, however none of our build environments utilize M1 chips. Also this appears to only happen in "Release" builds, "Debug" builds are still able to be created.

louis-launchdarkly commented 2 years ago

Hello @jeff-groove, thank you for reaching out.

I suspect the reason is that the 6.2.0 RN SDK is now using the iOS v6 SDK as the native module, your project has reference to the older v5 iOS SDK still cached. Can you try deleting the Pods directory under the ios directory of your RN project and retry? Just to be safe, I would recommend deleting the node_modules folder also and reinstalling the dependencies.

If that still doesn't work, can you try to see can you run the ManualTestApp following the instruction?

Xcode becomes 13.4 when I test this out, so I am not using the exact same version as you. However, I was not able to reproduce the issue you encountered when I try reproducing using the ManualTestApp. So if you can reproduce from the ManualTestApp, there will be more information for us to debug the issue.

BlinkVonDoom commented 2 years ago

We also had the same issue on Xcode 13.4, our solution was to downgrade xcode to 13.0. Which then allowed us to Archive the app.

@jeff-groove @louis-launchdarkly

jacquesdev commented 2 years ago

Ouch...

louis-launchdarkly commented 2 years ago

Hello @BlinkVonDoom and @jacquesdev,

I am currently updating the CircleCI test for RN 0.69, and am wondering about this. Which version of React Native are you using? If the RN version is 0.66 or above, that should build correctly with Xcode 13.4.1. Please let us know in case there is another issue that we are not aware of.

Thank you.

martinbee commented 2 years ago

We're running into the same issue with Xcode 13.4.1. Our React Native version is 0.63.2, so we're decently far behind. I reverted the SDK to version 4.0.4 (the last version I could see that supported 0.63), but we got the same error.

Do we need to downgrade our Xcode or is it essential for us to upgrade our RN version and use the latest SDK?

louis-launchdarkly commented 2 years ago

Hello @martinbee, the SDK version 4.0.4 is past EOL, and 4.2.x is not far away from EOL either. I would recommend upgrading your React Native version to something newer. That will enable you to use the latest 6.x LaunchDarkly SDK.

If you need to keep at RN 0.63.x, please try out the 5.1.x LaunchDarkly React Native SDK.

louis-launchdarkly commented 2 years ago

After we have verified in the latest RN SDK version 6.2.2 build, the SDK is working with Xcode 13.2.1 and 13.4.1 (See the version we tested here)

A general suggestion would be to recreate the RN project when there is a new Xcode version, as the project initialization step of RN can be finicky. Given there is no more comments on this issue for more than a month, I am closing this issue.