Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode Cloud + Bitcode Issues #624

Closed
dcilia opened this issue Oct 5, 2021 · 32 comments
Closed

Xcode Cloud + Bitcode Issues #624

dcilia opened this issue Oct 5, 2021 · 32 comments
Assignees
Labels
awaiting response Waiting for response / confirmation from the reporter compilation issue SDK doesn't compile or gives warnings.

Comments

@dcilia
Copy link

dcilia commented Oct 5, 2021

The issue

Integrating with Xcode 13 / SPM

When integrating the sdk in an app that uses Xcode Cloud, there are two issues with the archival / Testflight submission process that is done by Xcode Cloud:

  1. Bundle identifier mismatch with Datadog SPM Swift
  2. Error occurs in app thinning / bitcode process, Apple references Tech Note 2432

Datadog SDK version:

Which version of the Datadog SDK causes this problem? e.g. 1.7.0

Last working Datadog SDK version:

None

Dependency Manager:

SPM

Other toolset:

Xcode Cloud

Xcode version:

Xcode 13

Swift version:

5.5

Deployment Target:

iOS 14.0

macOS version:

N/A

@dcilia dcilia added the compilation issue SDK doesn't compile or gives warnings. label Oct 5, 2021
@ncreated
Copy link
Member

ncreated commented Oct 6, 2021

Hey @dcilia , thanks for details 👋. Before we dig further, we need some more info:

  1. Bundle identifier mismatch with Datadog SPM Swift
  • What is the exact error message for this? I'm wondering of what kind of match does Xcode Cloud expect.
  1. Error occurs in app thinning / bitcode process
  • What's the error exactly saying?
  • What is your "Enable Bitcode" setup for each target (especially the one you use for archiving)?

Screenshot 2021-10-06 at 14 32 42

@ncreated ncreated self-assigned this Oct 6, 2021
@lanserxt
Copy link

lanserxt commented Oct 11, 2021

@ncreated Hi! Have faced the same issues with original Xcode (Version 13.0 (13A233))

Apple says that there are problem in app thinning process and bitcode:
Image from iOS

@buranmert
Copy link
Contributor

hi @dcilia and @lanserxt 👋
we ship our iOS app with Datadog SDK and have never faced this issue so far.
i've also been trying to reproduce the issue by Validate App button in Xcode Organizer window but unfortunately no success so far.

  1. does the issue still persist for you?
  2. if yes, can you reproduce it by Validate App in Organizer? or does the app need to be submitted to App Store?
  3. does the issue disappear when you remove Datadog SDK?

@lanserxt
Copy link

Hi @buranmert,

  1. Yes, still persist. Had to move to other provider so far.
  2. Validate app - OK, after upload Apple processing fails.
  3. Yes, without it thinning process goes fine.

Try to upload to TF any build with latest Xcode, iOS 15 SDK

@buranmert
Copy link
Contributor

hey again @lanserxt 👋

unfortunately i haven't been able to reproduce the exact same error yet.
but i'm able to crash Xcode 13 while compiling bitcode for Datadog SDK, here are the repro steps:

  1. create a new project
  2. via Swift Package Manager, add Datadog target from dd-sdk-ios repo
  3. by default, Xcode 13 adds the library to my app with Do not embed option. let's not change it for now.
  4. archive the app (Product -> Archive) and Distribute App from Organizer window with Development method

after the very last step (selecting code signing method, i chose "Automatically manage signing") Xcode 13 crashes while "Compiling bitcode..." text is on the screen. I'm guessing this might be the same issue since Tech Note 2432 says that this is the way to reproduce App Thinning process locally.

i managed to solve this problem by making sure that Datadog is added with Embed & Sign option as seen below.
Screenshot 2021-10-25 at 15 41 50
alternatively, you can try adding DatadogStatic target to your app.

prior to Xcode 13, packages were added with correct default attributes (Do not embed if static, Embed & Sign if dynamic). it seems like Xcode 13 has a bug here.

can you please let us know if that solves the issue whenever you have a chance? 🙏

@buranmert buranmert added the awaiting response Waiting for response / confirmation from the reporter label Oct 25, 2021
@lanserxt
Copy link

Hi @buranmert!

Interesting... Will try and let you know!

@buranmert
Copy link
Contributor

hey @lanserxt 👋
does the issue still persist?

@floriangbh
Copy link

floriangbh commented Nov 10, 2021

I'v just had the same issue this morning with Xcode Cloud :
Screenshot 2021-11-10 at 15 10 47

With Datadog SDK v1.7.2, Datadog SDK is with "Embed & Sign" option with SPM

@lanserxt
Copy link

Hi @buranmert !

Sorry, checked just now. Still persists. The same error that @floriangbh have.

@flipbosch
Copy link

flipbosch commented Nov 11, 2021

Hi,

We have the same problem when we try to Archive on Xcode cloud. Building is working. But Archiving is giving the same error:

image

Also we use SPM to install Datadog SDK.

If you upload it manually trough Xcode its working fine. We only have this error with Xcode Cloud

@buranmert
Copy link
Contributor

unfortunately, i can't reproduce Invalid Code Signature Identifier.
but i found this thread from Apple Dev Forums: can you please try DatadogStatic target in dd-sdk-ios package (instead of Datadog target which is .dynamic) in your projects?

@dcilia
Copy link
Author

dcilia commented Nov 12, 2021

Hi, using static version of Datadog will cause bitcode not to work. The error goes away though.

@buranmert
Copy link
Contributor

hey again @dcilia 👋

from Tech Note 2432:

Static libraries included in an app bundle cause failures

Static libraries should be linked into your app but not copied into the app bundle. Workaround: Verify that your app does not mistakenly include static libraries

can you look inside your app bundle?

@dcilia
Copy link
Author

dcilia commented Nov 12, 2021

hey again @dcilia 👋

from Tech Note 2432:

Static libraries included in an app bundle cause failures
Static libraries should be linked into your app but not copied into the app bundle. Workaround: Verify that your app does not mistakenly include static libraries

can you look inside your app bundle?

Sure, I can spend some time looking into this, will report back what I find.

@flipbosch
Copy link

@buranmert I tried with below and for me this is solving the issue with Archiving the app on Xcode Cloud.

unfortunately, i can't reproduce Invalid Code Signature Identifier.
but i found this thread from Apple Dev Forums: can you please try DatadogStatic target in dd-sdk-ios package (instead of Datadog target which is .dynamic) in your projects?

After changing it to static in SPM its compiling and submitted to testflight without any problems.
Thx! Hope for others it will work aswel.

image

@buranmert
Copy link
Contributor

the issue seems to be resolved.
i'm closing it now but feel free to reopen if it arises again.

@Kaspik
Copy link

Kaspik commented Jan 22, 2022

Not sure if this should be closed. The XCode Cloud issue still persist, there is just temporary workaround to use static version. I believe this should be reopen so people like me can find it easier in the future until the Dynamic version is reworked. I believe it's the same issue as #250 and similar.

@jostster
Copy link

I think this might be resolved with Xcode 13.3.1? Can anyone confirm?

@pf-AliKemal
Copy link

pf-AliKemal commented May 30, 2022

@buranmert This issue was fixed with DatadogStatic instead of Datadog library. But I think DatadogStatic repository is removed.

https://github.com/DatadogStatic/dd-sdk-ios.git getting 404.

Is it removed or moved to different source ?

@ncreated
Copy link
Member

Is it removed or moved to different source ?

Hey @pf-AliKemal 👋. DatadogStatic library is shipped through the same Package.swift as Datadog, see our Package.swift. You should see it when using https://github.com/DataDog/dd-sdk-ios in SPM. It was always like this 🙂.

@pf-AliKemal
Copy link

@ncreated ok cool. now it is working as expected thanks 👍

@kylebrowning
Copy link

Using DataDogStatic is not a foolproof fix because it breaks SwiftUI Previews.

Is there no solution to getting either DataDog to be dynamic, or fixing SwiftUI previews for DatadogStatic?

@smadsenjc
Copy link

+1 to the above; using DatadogStatic isn't an option for those of us using DatadogCrashReporting, either. While DatadogCrashReporting is a static library, it depends on Datadog, a dynamic library, and there isn't another option to get the crash reporting functionality with a static version of the Datadog library.

@kylebrowning
Copy link

Just an FYI Xcode 14 does not fix this issue either.

@smadsenjc
Copy link

What is the history behind explicitly offering both dynamic and static versions of the library, versus letting SPM and the build system handle it? Searches elsewhere consistently point to using .dynamic as a problem with Xcode Cloud, and it working when no explicit type: is provided.

@smadsenjc
Copy link

@kylebrowning I noticed that the develop branch and the 1.12.0-beta2 tag have changes to Package.swift that remove the explicit .dynamic designation from the Datadog product. Switching to the beta and pointing at that library name works in Xcode Cloud.

@ncreated
Copy link
Member

Hello 👋. Thanks for update folks. Speaking of SwiftUI previews, this was recently fixed in #949 and the Package.swift we now declare in 1.12.0-beta2 lets Xcode to infer the type it needs for Datadog and DatadogCrashReporting.

What is the history behind explicitly offering both dynamic and static versions of the library, versus letting SPM and the build system handle it?

I feel it is a legacy after we added multiple patches to our SPM support. I gave some more context in this comment.

Until we make 1.12.0 GA, could someone 🙏 validate if 1.12.0-beta2 fixes the issue?

@kylebrowning
Copy link

Wow look at that timing haha

@El-Fitz
Copy link

El-Fitz commented Sep 13, 2022

Hello 👋. Thanks for update folks. Speaking of SwiftUI previews, this was recently fixed in #949 and the Package.swift we now declare in 1.12.0-beta2 lets Xcode to infer the type it needs for Datadog and DatadogCrashReporting.

What is the history behind explicitly offering both dynamic and static versions of the library, versus letting SPM and the build system handle it?

I feel it is a legacy after we added multiple patches to our SPM support. I gave some more context in this comment.

Until we make 1.12.0 GA, could someone 🙏 validate if 1.12.0-beta2 fixes the issue?

In my case, it did. Funny enough, it was also my first day setting up Datadog in my Swift project.
Quite.a funny coincidence.

@mleavy
Copy link

mleavy commented Sep 13, 2022

@ncreated I can verify that with releases prior to 1.12.0-betaX I had the same bundle identifier mismatch issue when building with Xcode Cloud, and that after switching to 1.12.0.beta2, that build error no longer exists and I can successfully build my project in Xcode Cloud

@Kaspik
Copy link

Kaspik commented Sep 14, 2022

Thanks for the new betas @ncreated ! Do you have any ETA when the 1.12.0 will be out? :)

@ncreated
Copy link
Member

1.12.0 is out 🙂. Thank you for feedback everyone! I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting response Waiting for response / confirmation from the reporter compilation issue SDK doesn't compile or gives warnings.
Projects
None yet
Development

No branches or pull requests