50ButtonsEach / fliclib-ios

The fliclib framework for iOS
35 stars 5 forks source link

Building for Mac Catalyst with Xcode 12 #43

Closed arlomedia closed 3 years ago

arlomedia commented 4 years ago

I'm using the fliclib framework in my iOS and Mac Catalyst project. I have the latest version of the framework (1.4.0), I have the project set to embed it only in iOS, and I have all the related code hidden from macOS with #if !TARGET_OS_MACCATALYST.

Before Xcode 12, the project would build for both platforms. With Xcode 12, the project will only build for iOS with the framework set to "Embed and Sign" and will only build for macOS with the framework set to "Embed Without Signing." I'm attaching the error that is shown if I try building with "Embed and Sign" as in previous Xcode versions. Two other third-party frameworks are fine.

Is this an issue with Xcode, or something that needs to be addressed in the framework?

Screen Shot 2020-09-23 at 1 04 28 PM

Screen Shot 2020-09-23 at 1 09 37 PM

AntonMeier commented 4 years ago

I honestly don't have much experience with Catalyst, but I am surprised that it did work at all with older versions. The XCFramework does not build any x86_64 slices for Catalyst. I guess that in Xcode 11 it would default to the x86_64 slice built for the Simulator. If that was the case, then sure it would build and run, but it would not be able to use bluetooth. Can you confirm this?

I know that, starting with Xcode 12, it now requires you to build for both x86_64 and ARM when targeting macOS. I believe this is in order to support the upcoming ARM Macs. Perhaps that would explain why the Simulator slice is not working any more.

I will have to look into this a bit further though. But, yes, it is likely that I'm going to add dummy slices for Catalyst so that it can at least build.

arlomedia commented 4 years ago

I should clarify that I wasn't trying to use Flic on Mac; I have the Flic framework's Platforms set to iOS, and excluded all the Flic code from the Mac builds. This meant I could build for iOS or Mac with the same settings and the Flic framework was ignored in the Mac version.

Now, however, it seems that Xcode tries to include the Flic framework with the Mac version even when set to embed on iOS only. The build finishes if I change Embed and Sign to Embed Without Signing when building for Mac, but then I have to remember to change that setting back and forth whenever I change which platform I'm building for.

Doing anything with the framework when its Platforms is set to iOS and I'm building for Mac seems like an Xcode bug, but I filed this in case you needed to make an update in the framework.

I'm using the current Xcode version 12.0.1. It looks like 12.1 is coming soon, and I can try it again with that.

arlomedia commented 4 years ago

I updated to Xcode 12.1, but that has the same problem. I also integrated the Flic 2 library last week, alongside the original Flic library, and it has the same problem.

JB-CHAUVIN commented 3 years ago

So, how can we build for x86_64 ?

❌ ld: symbol(s) not found for architecture x86_64

arlomedia commented 3 years ago

Are you still thinking of adding dummy slices for Mac Catalyst? I'm now using Xcode 12.4 and still bothered by this problem. It takes my app about 10 minutes to build, and if I forget to switch the framework embed settings when going between iOS and Mac Catalyst, I have to restart the build and wait 10 minutes again.

Also, sometimes the build only works when I switch to Embed Without Signing and sometimes it only works when I switch to Do Not Embed -- I haven't found a pattern to that -- so even when I remember to switch it, it often fails and I have to repeat the build. (Naturally, the error only displays near the end of the build process.)

AntonMeier commented 3 years ago

Sorry for the delay on this. I am just getting around to it now. I need to do some testing on my end to see if it works well, but after that I'll post a beta version here so you can try it out, if you like.

I have to admit that I don't know for sure how Catalyst works now that Apple also runs ARM on Macs, but hopefully it should not be too difficult to figure out.

AntonMeier commented 3 years ago

I have built a beta that includes slices for Mac Catalyst. If anyone wants to try it out you can download it here: LINK REMOVED

Otherwise we will do some further testing on our end and possibly release a public version in a few days.

AntonMeier commented 3 years ago

Edit: sorry the one I linked is for Flic 2. There will be one for Flic 1 later.

arlomedia commented 3 years ago

I tried the new Flic 2 framework and it solves the problem! I can now build for iOS or Mac Catalyst without changing the Embed setting. My app uses both frameworks, so I'm looking forward to the same solution applied to the Flic 1 framework.

AntonMeier commented 3 years ago

Thank you for letting me know, good to hear! I have now released 1.5.0 of the Flic 1 framework as well. I'll close this issue now, but feel free to open it again if you have any further questions or issues.