PlotJuggler icon indicating copy to clipboard operation
PlotJuggler copied to clipboard

Mac M1 CI build

Open adeebshihadeh opened this issue 3 years ago • 5 comments

GitHub Actions doesn't have M1 runners yet (#2187). We can either wait for that or try to have our current Mac CI build a universal build.

adeebshihadeh avatar Jan 02 '22 22:01 adeebshihadeh

@tecandrew want to take a stab at a universal build?

adeebshihadeh avatar Jan 02 '22 22:01 adeebshihadeh

sure. i've actually given this a try before putting up the M1 PR, but had little luck. brew installs either arm64 or x86 libs and i didn't find a way to indicate pulling universal2 brew libs (if they exist). Did find a way to pull x86 using Rosetta2 though 😅

I'll give it another whirl. Perhaps xcode+cmake would be the way to go

tecandrew avatar Jan 02 '22 22:01 tecandrew

I looked into that briefly too. If there's a way to install the ARM libraries on the x86 runner, then this should be pretty trivial. But nothing came up with a quick google, only for the other way around (x86 libs on M1).

adeebshihadeh avatar Jan 02 '22 22:01 adeebshihadeh

few findings:

  • couldn't get -GXcode cmake builder working properly, and pointing cmake in the direction to create for both x86_84;arm64 still complains that a lib isn't it the right architecture during the linking stage

  • i dont know scons enough to know how to cross build for x86_64 on M1 for libcereal. -archs= and -platform= variables don't seem to do anything

however, as a sanity check, I manually linked the binaries myself from the latest plugins releases (Darwin-x86_64 & Darwin-arm64) and it amazingly works with no issue lmao. I've tested the binaries myself both on Darwin x86 and arm64.

universal2-plugins.tar.gz

give them a try? its super hacky, but if you wanna avoid reworking the current codebase maybe a CI machine could just manually create the universal2 plugins using lipo -create -output <lib_nameoflib.dylib> <arm64.dylib> <x86.dylib>

image

tecandrew avatar Jan 03 '22 03:01 tecandrew

Ah, I forgot about building our own libraries. That indeed makes things trickier. We have a CI mac mini for agnos builds, but I'm not sure it's worth setting up Jenkins for an automatic PlotJuggler build. Let's see how often the M1 release actually needs to be updated. I'm hoping we either need to update the M1 release rarely or GitHub launches an M1 runner soonish.

adeebshihadeh avatar Jan 03 '22 03:01 adeebshihadeh