0

I'm trying to build a MacOS app for both x86_64 and arm64 architectures. I'm also linking it with some .dylib libraries which I have in both architectures. In XCode I figured that I can set the search paths in Build Settings: Runpath Search Path and Library Search Path. However, when I build for both architectures it shows the message of this kind:

ld: warning: ignoring file /path/to/lib.x86_64/libtorch.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

Accordingly, if I move the priority of the paths in Build Settings, then it shows

ld: warning: ignoring file /path/to/lib.arm64/libtorch.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

It seems it's not trying to look at another file from the paths list in the setting.

So, how do I tell it to link against different dylibs for different architecture builds?

(I can see these paths can be set separately for "Debug" and "Release", but not per architecture. I also found that switching Build Settings from "Combined" to "Levels" shows a configuration matrix with a lot more options, but I'm not sure how to navigate it.)

Soid
  • 2,585
  • 1
  • 30
  • 42
  • Does this answer your question? [How to create a universal dylib from pre-built dylibs for each architecture?](https://stackoverflow.com/questions/22783453/how-to-create-a-universal-dylib-from-pre-built-dylibs-for-each-architecture) – Siguza Apr 22 '23 at 10:59
  • Yes, I've seen this in my search and it's not exactly what I'm looking for. I just dislike the idea of combined dylibs cause in my case they are pretty large. One architecture is about 170Mb (it's PyTorch). For now I ended up just manually setting the paths for two separate builds, but it'd be nice to automate it. – Soid Apr 22 '23 at 16:23
  • Are these dylibs gonna be bundled within the app, or will they just exist in a global path and loaded from there at runtime? – Siguza Apr 22 '23 at 17:00
  • Yes, I'd like to bundle it within the app, so users don't need to install anything else. – Soid Apr 23 '23 at 17:20

0 Answers0