freeotp / freeotp-ios

Apache License 2.0
686 stars 173 forks source link

Use xcframeworks in conjunction with Carthage #251

Closed jdandrea closed 2 years ago

jdandrea commented 3 years ago

Carthage-built Frameworks have been replaced with XCFrameworks. As part of this change:

In order to use XCFrameworks, the Carthage directory must first be populated from the repository root, for example:

carthage update --use-xcframeworks

In a future revision, it may be desirable to have these XCFrameworks bootstrapped/built/updated/cleaned as part of a new Carthage build phase, so long as this can be done gracefully and blend in well with the overall Xcode developer experience.

justin-stephenson commented 3 years ago

Thanks very much for the migration to xcframeworks PR @jdandrea . Could you please also update the README? Everything looks good to me and the .xcframework files are being built properly but linking is failing when trying to run FreeOTP on my device (working fine with simulator).

dyld: Library not loaded: @rpath/TinyConstraints.framework/TinyConstraints
  Referenced from: /private/var/containers/Bundle/Application/0DC5810A-4E2F-42CD-B61E-4A7F2C8809EF/FreeOTP.app/FreeOTP
  Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib

I'll have to spend more time looking into it, could be something on my end only

jdandrea commented 3 years ago

You're welcome! Ah, good catch - I will update the README.

I will also double-check the config to ensure it's project-relative and not absolute (e.g., my local project path). I thought it was, but I could have missed something.

jdandrea commented 3 years ago

README updated. I've also double-checked the source tree and didn't find any mention of an absolute path, however it does use Group- (aka folder-) relative paths. I'm wondering if the Carthage-built frameworks should use Project-relative paths instead, like so:

Screenshot 2021-10-05 at 4 02 48 PM

Either one works for me. I'm curious to know if Project-relative works better for you though! If so—or if it's just a more appropriate choice in general—I'll update.

justin-stephenson commented 2 years ago

Hi @jdandrea Sorry for the long delay, I finally had time to come and look at this. I followed the steps myself and everything works if the Frameworks are set to Embed and Sign in the FreeOTP target, it seems this is necessary with removing the copy frameworks build phase (or building on physical devices errors with image not found').

Could you update your PR to set 'Embed and Sign'?

I'll test the changes once done then I just need to make sure the FreeOTPTests/FreeOTPUITests still run.

Perhaps the readme can also be updated to carthage update --use-xcframeworks --platform iOS

jdandrea commented 2 years ago

Thank you @justin-stephenson - no worries! Good catch.

I should be able to confirm same on my end and update within the week, and I will update the README further as well.

justin-stephenson commented 2 years ago

Hi @jdandrea, happy new year. When you have time would you mind pushing the Embed and Sign framework changes to this PR? That will help a lot.

Thanks!

jdandrea commented 2 years ago

Beg pardon - laptop is now back, and I will look at this today. I appreciate the reminder!

jdandrea commented 2 years ago

@justin-stephenson - changes made. Compile-and-Run works for me. Let me know if it looks good, thanks!