Use prebuilt dylib built for macOS in macCatalyst?

Is there a way to link a prebuilt dylib that was built for the 'macOS' platform on Mac Catalyst without being warned by Xcode?

Generally it would be better to just recompile for Mac Catalyst but this is a third party library and they have a complicated build system with dozens of dependencies that doesn't support Mac Catalyst as of now (although they have iOS and Mac 'regular'). So I would have to spend quite a bit of time trying to sort through their build system to make a Catalyst version myself.

The library uses no platform specific UI code and I'm fairly certain that macOS build would work just fine on Mac Catalyst without any changes since it isn't UI related at all.

It seems to work fine (apart from Xcode warning me about linking a .dylib built for macOS on Mac Catalyst).

I could shim all this away in a NSBundle that is aware of the AppKit world but then I have to make all method calls to the third party framework on Mac Catalyst through the bundle and it would separate my iOS and Catalyst code relying on the same implementation which isn't great.

Is there a way I could just replace the 'macOS' platform in the .dylib with macCatalyst to get rid of the warning?

So I modified the .dylib and changed the LC_BUILD_VERSION's platform to 6 (signifies Mac Catalyst see <mach-o/loader.h>). I also discovered this post from Quinn https://developer.apple.com/forums/thread/659964 and discovered that I could have done this with vtool as well.

Accepted Answer

So I modified the .dylib and changed the LC_BUILD_VERSION's platform to 6 (signifies Mac Catalyst see <mach-o/loader.h>). I also discovered this post from Quinn https://developer.apple.com/forums/thread/659964 and discovered that I could have done this with vtool as well.

Use prebuilt dylib built for macOS in macCatalyst?
 
 
Q