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

LLDB crashing when Stripe Terminal is added to our project #111

Closed
sammcewan opened this issue Sep 7, 2021 · 7 comments
Closed

LLDB crashing when Stripe Terminal is added to our project #111

sammcewan opened this issue Sep 7, 2021 · 7 comments

Comments

@sammcewan
Copy link

sammcewan commented Sep 7, 2021

We've noticed across two products (entirely separate) that the presence of the Stripe Terminal SDK causes LLDB to crash at any breakpoint.

So far I've been unsuccessful in replicating it in the example app provided.

Summary

Hitting any breakpoint in our codebase causes no variables to show up and any input in the the console fails.

Code to reproduce

We used SPM to drop in 2.1.0 into an existing mixed source codebase, compared notes with another org and they've noticed the same.

When we remove the SDK and clean things out LLDB works again.

iOS version

Target is 12.0+

Installation method

SPM, we're tried Cocoapods 2.0 too. Same issue.

SDK version

2.1.0 and 2.1.1

Other information

We've looked at some LLDB logging when the issue occurs and can see the following entry.

SwiftASTContext("xx")::GetModule("xx") -- <module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/StripeTerminal.h"
        ^

error: /Users/xx/Library/Developer/Xcode/DerivedData/xx-bbecncmwvkciaicnlsxqmpcbiejd/Build/Products/Debug-iphonesimulator/StripeTerminal.framework/Headers/StripeTerminal.h:20:2: error: Module StripeTerminal requires deployment target of iOS 10.0 or later.
#error Module StripeTerminal requires deployment target of iOS 10.0 or later.
 ^

error: could not build Objective-C module 'StripeTerminal'

 SwiftASTContext("xx")::CreateInstance((Module*)0x7f985e9376d8, "xx") = 0x7f9864cc70a0
 SwiftASTContext("xx")::() -- Failed to create module context - <module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/StripeTerminal.h"
        ^

error: /Users/xx/Library/Developer/Xcode/DerivedData/xx-bbecncmwvkciaicnlsxqmpcbiejd/Build/Products/Debug-iphonesimulator/StripeTerminal.framework/Headers/StripeTerminal.h:20:2: error: Module StripeTerminal requires deployment target of iOS 10.0 or later.
#error Module StripeTerminal requires deployment target of iOS 10.0 or later.
 ^

error: could not build Objective-C module 'StripeTerminal'
@bric-stripe
Copy link
Collaborator

not 100% sure what's going on here 😞 I'm trying to reproduce it in another sample app we have internally but so far no luck.

You may have already seen where that #error line is in the StripeTerminal.h:

...
// The Stripe Terminal iOS SDK requires iOS >= 10.0.
// If your app needs to target iOS 9, you can skip this check by defining
// `SCP_SKIP_OS_VERSION_CHECK` in your build settings.
// If you do this, make a runtime check and only use Terminal from iOS 10+,
// otherwise you may encounter undefined breakages.
#ifndef SCP_SKIP_OS_VERSION_CHECK
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0
#error Module StripeTerminal requires deployment target of iOS 10.0 or later.
#endif
#endif
...

If you haven't already, could you try defining SCP_SKIP_OS_VERSION_CHECK as a build flag to skip that check? Or may also be interesting to edit the StripeTerminal.h header directly in the xcframework and comment it out completely.

@sammcewan
Copy link
Author

@bric-stripe Yep this was it! Had to modify the framework to make this happen. Is this something that can be removed?

@bric-stripe
Copy link
Collaborator

bric-stripe commented Sep 7, 2021

weird :/ that fully fixed the LLDB issues?

we only recently dropped support for iOS 9 so we'd really like to keep a build error like this in. I've been unable to reproduce the issue 😞 but was hoping to try a few things to see if this would work. If you have a minute could you try editing the header to have that #if __... line read as:

...
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0
...

my guess is something is importing that header with __IPHONE_OS_VERSION_MIN_REQUIRED undefined so that added defined check should prevent that from tripping the error while still letting us #error during normal compile time where it should definitely be defined.

@sammcewan
Copy link
Author

Yep this worked for me as well, ace! Can we get that added and the package bumped?

@Jake000
Copy link

Jake000 commented Sep 8, 2021

I have also run into this and have replicated it with the example app.

Adding PromiseKit as a dependency via SPM seems to cause the LLDB crash. Using CocoaPods seems to work fine. I have made the relevant changes on a fork here.

In my particular case it seems __IPHONE_OS_VERSION_MIN_REQUIRED is defined but set to some low value. So adding the extra check unfortunately has not resolved it for me, however removing the whole block has indeed worked.

@bric-stripe
Copy link
Collaborator

Sorry about the trouble here. We're investigating replacing that check with a API_AVAILABLE... on SPCTerminal which should get us the same protection against making sure it's advertised that iOS 9 is no longer supported while hopefully also not causing issues like this.

@bric-stripe
Copy link
Collaborator

👋 2.2.0 is out now and switches to API_AVAILABLE on SCPTerminal and removes the troublesome __IPHONE_OS_VERSION_MIN_REQUIRED. Going to optimistically close this, but let us know if any issues after updating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants