Build ios app for mac os in Xcode 11 Get error. May Xcode11 bug?

My project link a .a static library, and when I try to build for Mac os, I get an error:

Building for UIKit for Mac, but the linked library 'libprotobuf.a' was built for <unknown>. You may need to restrict the platforms for which this library should be linked in the target editor.


But the ibprotobuf.a did contain x86_64, lipo -info is:


Architectures in the fat file: /Users/power/Documents/trunk/isdk/apple/protocolbuffer/Products/ios/libprotobuf.a are: armv7 i386 x86_64 arm64


And I also choose macOS + iOS platfroms in the tartget -> Build Phases -> LinkBinary With Libraries.
So I can't find any other ways to solve this issue.
Is this Xcode 11 bug? or any workaround way?

Answered by DTS Engineer in 364519022

Libraries built for the iOS simulator with previous versions of Xcode need to be rebuilt with Xcode 11 for the Project Catalyst environment specifically for the Mac -- there are differences in the compiled product, and a build for the iOS simulator is not sufficient.

I had this same issue too; I was able to get it to compile for macOS by manually specifying the x86_64h architechture in both the ARCHS and VALID_ARCHs.


Accepted Answer

Libraries built for the iOS simulator with previous versions of Xcode need to be rebuilt with Xcode 11 for the Project Catalyst environment specifically for the Mac -- there are differences in the compiled product, and a build for the iOS simulator is not sufficient.

Edford this must be added to the release notes of Xcode. I'm struggling with this problems for days. I saw others post about the subject, and not a piece of documentation is presented to confirm your answers. If we use a third-party lib this will break our code, and we need to know the reason things stopped working from day to night.

Build ios app for mac os in Xcode 11 Get error. May Xcode11 bug?
 
 
Q