On Wed, 2022-06-15 at 13:59 +0200, IOhannes m zmoelnig wrote:
On 6/15/22 12:53, Dan Wilcox wrote:
make arch="x86_64 arm64"
That's cool to know. In the case of purest_json, I believe it ships with other dependencies (libjson?) and if those come from homebrew, they're probably not fat. Is my assumption correct, that a fat binary would have to link to fat binary?
I don't believe so. I think (not 100%) the system lib loading mechanism just needs to find the lib *and* have the right arch. I don't believe it matters if the lib is fat or not.
Ah, I see.
that is my experience as well. you can have a fat (say: amd64, arm64) external that links against "libfoo". if on the target system, there's only a non-fat (say: "amd64") version of "libfoo", then you will be able to use the external on amd64 (either natively or via Rosetta), but not as an "arm64" binary. if you then install "libfoo" also for arm64 (e.g. via homebrew), you can use the external on arm64 as well.
So you're saying: Because it searches pre-configured paths for finding libraries, it'll find the right arch if it is available. Thus, you don't need to link to fat libraries for full fat support, as long as both arch's libraries are installed.
Would it be better for externals shipping with local dependencies to provide them as fat binaries? For externals using localdeps I use separate non-fat files, because they both link to different hard-coded paths. I wouldn't how to do it differently.
Is there a best way for shipping externals with local dependencies? If yes, which is it?
Roman