https://github.com/osquery/osquery logo
#macos
Title
# macos
i

ihor

05/03/2023, 7:40 AM
Hi All, I'm trying to build osquery from source on MacOS, but I can't find how to make one package for both architectures (arm, x86). I would be grateful for any hints.
s

Stefano Bonicatti

05/03/2023, 9:42 AM
While technically CMake can make a build for a single binary with both architectures, we build different pieces depending on the architecture, so you need to do 2 separate builds. You pass the architecture to the CMake configuration phase with
-DCMAKE_OSX_ARCHITECTURES
,
x86_64
or
arm64
then use the
lipo
tool to stitch the two binaries together, with
lipo -create <binary x86_64> <binary arm64> -output <universal binary>
i

ihor

05/03/2023, 9:45 AM
thanks a lot!
a

allister

05/03/2023, 2:52 PM
If you meant the actual pkg and not just the binary, there’s a line you’d put in the distribution file that’s fed to pkgbuild which specifies applicable architectures, IIRC. To my ahem let’s go with delight, a vendor that shall rename nameless Duo screwed this up for a solid year after releasing universal binaries, so the installer itself continuously required Rosetta 🤪