Leanplum / Leanplum-iOS-SDK

Leanplum's integrated solution delivers meaningful engagement across messaging and the in-app experience.
https://www.leanplum.com
Apache License 2.0
72 stars 59 forks source link

6.4.0 and 6.4.1 fail to build with error __swift_FORCE_LOAD_$_swiftXPC_$_Leanplum in Leanplum[arm64][75](MigrationManager+Constants.o) #589

Closed ashtl closed 1 week ago

ashtl commented 1 week ago

Expected Behavior

Project using this SDK builds when ingested using SPM and following instructions in the Leanplum iOS documentation.

Actual Behavior

Project fails to build with error;

ld: warning: search path '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.0.sdk/usr/lib/system' not found
ld: warning: Could not find or use auto-linked library 'swiftXPC': library 'swiftXPC' not found
ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found
ld: Undefined symbols:
  __swift_FORCE_LOAD_$_swiftXPC, referenced from:
      __swift_FORCE_LOAD_$_swiftXPC_$_Leanplum in Leanplum[arm64][75](MigrationManager+Constants.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I did this in an existing project and it failed, so to rule out variance I created a completely brand new fresh project and got the exact same error.

I have flags -ObjC and -all_load on in Other Linker Flags (but apparently -all_load isn't supported anymore Apple have scrubbed mention of it from the internet)

Steps to Reproduce the Problem

  1. Install Leanplum SDK 6.4.0+ with SPM
  2. Run Project
  3. Project fails to build
  4. Change version to anything before 6.4.0 (for example 6.3.0, project builds)

Specifications

ashtl commented 1 week ago

Upgrading to xcode 15.3 fixes this issue.

I'd still be interested in a fix for 15.0.1 if possible. We are doing this upgrade to try be compliant with Apples 1st May privacy manifest deadline. We are still getting warnings on our submitted builds and we believe Leanplum might be one of the culprits. Upgrading our fleet of agents isn't feasible in a week.

Thanks for any help.

nzagorchev commented 1 week ago

Hi @ashtl, I believe this issue is not caused by the SDK. Can you check the resolutions suggested in this thread: https://stackoverflow.com/questions/57096863/cannot-fix-could-not-find-or-use-auto-linked-library? Is the project a purely Objective-C one? If yes, adding an empty Swift file will resolve this, since it will include the swift libraries in question. You can also check the other suggestions from the above thread.

ashtl commented 1 week ago

I think it is caused by the SDK. I tested against a brand new swift project with no code.

No dependencies added it builds find Add Leanplum 6.3.0 or less and it builds fine Add Leanplum 6.4.0 or 6.4.1 and the build fails with the above error.

I've tried the solutions you linked + a number of others before I created the issue. Are you able to replicate my findings if you switch to xcode 15.0.1 and create a new project with leanplum 6.4.1?

Thanks for your help :)

nzagorchev commented 1 week ago

Hi @ashtl I was able to reproduce it with Xcode 15.0.1. The SPM is distributed with xcframework due to the SDK using mixed languages. Versions 6.4.0 and 6.4.1 were built with Xcode 15.3 due to changes which Xcode 15.3 introduced. I am researching possible solutions to the issue.

nzagorchev commented 1 week ago

@ashtl Can you try using 6.4.2 version? It should be fixed there. I can no longer reproduce it.

ashtl commented 1 week ago

@nzagorchev Managed to build successfully with xcode 15.0.1 - thanks for getting this fixed so fast, really appreciate it.

Closing as resolved with release 6.4.2