[PD-dev] Compiling fat external binaries for Mac OS X

IOhannes m zmoelnig zmoelnig at iem.at
Wed Jun 15 13:59:41 CEST 2022


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.

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.

this is basically what's happening for the experimental Gem binaries 
right now:
- the Gem.pd_linux is built as a fat amd64/arm64 binary (and all the 
backend plugins and helper externals as well)
- the build machine is an amd64 host, so "homebrew" only installs amd64 
binaries on that machine
- Gem tries to bundle up the dependencies, but since they are only for 
amd64, whatever the build-scripts embeds is for amd64 only as well
- thus downloading the CI-built Gem will work find on amd64 hosts or 
with Rosetta
- if you want to run Gem (with all the backends) natively on your M1, 
you need to manually "brew install" the missing libraries. the 
Gem-binaries will pick them up and :tada:

gfmasdr
IOhannes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20220615/7695ab88/attachment.sig>


More information about the Pd-dev mailing list