Ableton / LinkKit

iOS SDK for Ableton Link, a new technology that synchronizes musical beat, tempo, and phase across multiple applications running on one or more devices.
http://ableton.github.io/linkkit
Other
147 stars 10 forks source link

ARM Mac - Cannot link when building with LinkKit to target (ARM based...) iOS Emulator #60

Closed sseyod closed 2 years ago

sseyod commented 3 years ago

Hi!

As the title says: when building using ARM-based Mac, it is not possible to link with LinkKit when targeting the iOS Emulator.

The reason is that on ARM Macs, the Simulator requires ARM code; as opposed to Intel Macs, where the Simulator requires x86 code, and LinkKit can be compiled-in successfully.

In case it helps, you can look at the latest version of the Audiobus SDK, where they've updated to solve this problem for Audiobus developers.

Thanks in advance, Pete

fgo-ableton commented 3 years ago

Are you trying to link the .a or the .xcframework? The .xcframework should contain symbols for ARM. But I have not been able to test it on an actual ARM machine yet.

sseyod commented 3 years ago

Hi! Using on an Apple Silicon Mac, using the .xcframework you provide. I hope that helps!

Best wishes, Pete

cdi-ableton commented 3 years ago

Could you please test building LinkHut? I'm able to build it targeting the Simulator on an M1 Macbook Air using LinkKit 3.1.5 and Xcode 12.3.

sseyod commented 3 years ago

HI! Yes, of course, I'll try that out for you. Just been maxed-out getting a release together for past couple of days!

NB: can I please ask you to double-check that your framework is set-up correctly for bitcode, before I try this?

Technical background is here: https://stackoverflow.com/questions/58740662/does-bitcode-support-weak-linking-third-party-frameworks

... as I yesterday saw that problem in another 3rd party library the was trying to use a xcframework for iOS...

Best wishes, Pete

fgo-ableton commented 2 years ago

Please reopen the issue if this is still relevant.

sseyod commented 2 years ago

Hi! Now that I finally have an M1 mac, I'm finding that:

1) if I build using libABLLink.a, I cannot build and run on the Simulator, seeing this error:

"building for iOS Simulator, but linking in object file built for iOS, file '........./libABLLink.a' for architecture arm64

2) if I build using the Framework, this runs on the Simulator, but I cannot export an archive built to target the generic iOS app to IPA file for AdHoc distribution

My only work-around for now would be:

Can you please fix this ASAP.

sseyod commented 2 years ago

Hi @fgo-ableton I can't see how to re-open this issue :)

Best wishes, Pete

sseyod commented 2 years ago

Furthermore, I'm prevented from enabling bitcode for my project, as the Ableton library for iOS isn't build to include bitcode.

sseyod commented 2 years ago

NB: my code is built such the the App and Audio engine are separated, with my audio engine in a private framework. It is the private framework that uses LinkKit - and I can only link with static libraries from my Framework, as my Framework is used in an App Extension (the AUv3 version of my app).

So, I really require a fix from you for the libABLLink.a problem reported above.

Best wishes, Pete

fgo-ableton commented 2 years ago

Hey @sseyod, Could you check out this build? It is built with Xcode 13 so it should support Apple Silicon. I just tried archiving the example app for both: Any iOS Device and Any Mac and it worked. Bitcode is enabled. You should be able to use for the .xcframework for all targets. The .a is mostly in there for backwards compatibility, it doesn't support all architectures.

sseyod commented 2 years ago

Hi @fgo-ableton, I'll be happy to try that out for you later this morning, and will report back.

However - to be 100% clear, I require a working .a file implementation, because the LInkKit library in my system needs to be built-in to a private framework. NB this is the exact approach I'm using with AudioBus SDK library, where they're clearly building the static .a file differently to the way that you've been doing!

Best wishes, Pete

sseyod commented 2 years ago

@fgo-ableton on first test, that now allows me to build and run on Simulator from M1 Mac, which is great progress, thank you.

sseyod commented 2 years ago

NB that was using the Framework version of LinkKit

sseyod commented 2 years ago

@fgo-ableton if I try to export the archive to .ipa file, I get the same problem as previously reported

image
sseyod commented 2 years ago

From the logs:

[OPTIONAL] Didn't find platform (null) or cert (null) for <DVTFilePath:0x3811bb3f0:'/Users/....., 08.44.xcarchive/Products/Applications/..../Frameworks/libLinkKit.a'>: Error Domain=DVTFoundationNSBundleAdditionsErrorDomain Code=1 "Couldn't find platform family for "libLinkKit.a"." UserInfo={NSLocalizedDescription=Couldn't find platform family for "libLinkKit.a"., NSLocalizedRecoverySuggestion=Couldn't find CFBundleSupportedPlatforms in the Info.plist, LC_VERSION_MIN, or LC_BUILD_VERSION in the Mach-O for path "/Users/....../Frameworks/libLinkKit.a".}

sseyod commented 2 years ago

@fgo-ableton I'm optimistic that from the above info, you might be able to figure-out the problem. Hoping this helps, Pete

sseyod commented 2 years ago

@fgo-ableton just to further report, I've tried using the static library in what you've given me, and still get this:

libABLLink.a(ABLNotificationView.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/..../libABLLink.a' for architecture arm64

To be 100% clear, if you can fix the static library, then I think that will clear all of my problems.

fgo-ableton commented 2 years ago

Hmm, I am still not clear on what the issue is. I compared the supported architectures with what audiobus supports. It looks pretty similar:

libABLLink.a: Mach-O universal binary with 4 architectures: [arm64:current ar archive] [arm_v7] [x86_64] [i386]
libABLLink.a (for architecture arm64):  current ar archive
libABLLink.a (for architecture armv7):  current ar archive
libABLLink.a (for architecture x86_64): current ar archive
libABLLink.a (for architecture i386):   current ar archive

libAudiobus.a: Mach-O universal binary with 4 architectures: [i386:current ar archive] [arm_v7] [x86_64] [arm64]
libAudiobus.a (for architecture i386):   current ar archive
libAudiobus.a (for architecture armv7):  current ar archive
libAudiobus.a (for architecture x86_64): current ar archive
libAudiobus.a (for architecture arm64):  current ar archive

Also the .xcarchive and the .a versions of LinkKit are pretty much the same. The .xcarchive additionally supports Catalyst. But both use the exact same symbols for iphoneos and iphonesimulator. https://github.com/Ableton/LinkKit/blob/1b21fe7b400774353844e875af52553c45c9adcc/makefile#L43 So regarding linking the .a vs the .xcframework, I don't understand why you need to link to the .a. According to this article linking a framework from another framework should be possible.

It would be good to know if you can reproduce the issue with the LinkHut example app! Maybe that gives a lead.

sseyod commented 2 years ago

@fgo-ableton Hi - sorry, I've made a dumb mistake earlier

sseyod commented 2 years ago

I'd accidentally reverted your updated LinkKit.zip file changes, before building for archive an .iap export (!)

The build and iap export is working fine now, using the framework.

sseyod commented 2 years ago

@fgo-ableton so, sorry about that!!

fgo-ableton commented 2 years ago

@sseyod No worries! Glad it is resolved. 😄

sseyod commented 2 years ago

Thank you very much @fgo-ableton 😄

Best wishes, Pete