MailCore / mailcore2

MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP. The API has been redesigned from ground up.
Other
2.6k stars 624 forks source link

OSX archiving problem #1907

Open mtegas opened 3 years ago

mtegas commented 3 years ago

Hi everyone,

I'm going crazy trying yo figure out how to avoid this error, I'm working at an app for OSX and building works fine, when i try to archive the project I keep getting this error :

Undefined symbols for architecture arm64: "_OBJC_CLASS_$_MCOAddress", referenced from: objc-class-ref in DownloadManager.o "_OBJC_CLASS_$_MCOAttachment", referenced from: objc-class-ref in DownloadManager.o "_OBJC_CLASS_$_MCOMessageBuilder", referenced from: objc-class-ref in DownloadManager.o "_OBJC_CLASS_$_MCOSMTPSession", referenced from: objc-class-ref in DownloadManager.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've implemented MailCore using Swift package manager because everytime i try using cocoapods or carthage with MailCore i get other errors and the only one working is SPM, but gives error when archiving.

janek commented 3 years ago

My error messages are a bit different (see below), but I think I have the same problem. It seems like this is because MailCore has not been updated to support Apple Silicon (M1) Macs. If you use a current version of macOS (11) and Xcode (12), you will not be able to make a release build (archive) of a project that uses MailCore.

I haven't fixed my problem yet, but I've found this SO question that suggests your best workaround is to disable building for new (M1/Apple Silicon) Macs.

To fix the problem, I found information suggesting that MailCore would have to provide a "universal binary" (see "precompiled binaries" section here: https://www.wwdcnotes.com/notes/wwdc20/10214/).

My error message(s) ``` ld: warning: ignoring file /Users/janek/Library/Developer/Xcode/DerivedData/EmailAuthTestingBuilds-dstvmkpvnvryaxdrzgbunobkvmnq/Build/Intermediates.noindex/ArchiveIntermediates/EmailAuthTestingBuilds/BuildProductsPath/Release/MailCore.framework/MailCore, building for macOS-arm64 but attempting to link with file built for macOS-x86_64 Undefined symbols for architecture arm64: "_OBJC_CLASS_$_MCOIMAPSession", referenced from: objc-class-ref in ContentView.o ld: symbol(s) not found for architecture arm64 ``` Screenshot 2021-04-08 at 13 06 56
janek commented 3 years ago

This SO answer worked for me, and it also should work for you as long as you're on an Intel Mac. Keep in ming that this will mean your app won't run Apple Silicon Macs.