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.)