Hey all :wave: ! Any fix/workaround for getting &...
# pact-js
e
Hey all 👋 ! Any fix/workaround for getting
Cannot find binary for platform 'linux' with architecture 'arm64'
... during install?
👋 1
y
Could provide a little more context? • machine specs? • what you are trying to install? • what version?
e
This is part of a Docker build pipeline. The base image is Alpine, the host machine is an Apple M1 chipset, and trying to install
@pact-foundation/pact
version
9.16.0
message has been deleted
y
have you got rosetta in your container? tried setting the
--platform linux/amd64
on your docker command see https://github.com/pact-foundation/pact-js-core/issues/264 for additional context.
e
Haven't tried setting the platform flag. I'll give that a whirl...
@Yousaf Nabi (pactflow.io)@Yousaf Nabi (pactflow.io)@Yousaf Nabi (pactflow.io) Adding the --platform tag worked.
Ooof, sorry for all the @-mention spam on that last message. The Slack client for my iPad is acting buggy.
The flag did slow down the build quite a bit, though.
Any word on when native linux/arm64 binaries will be made available?
y
Slower than not working?
Don't worry about triple tags happens to me all the time. Slack things haha
Creating the build is trivial but testing it without macOS containers in CI causes difficulties, GH doesn't have arm64 runners. We could get a container on aws but it's costs monies. There was a gh issue where someone asked, will dig it out :)
e
Not sure I understand the question. The flag works--the build succeeds--but where the build may have taken 1 minute before, now it takes 5 minutes. I'm happy things work, but it would be nice to not have to pay that time cost repeatedly, ya know?
👍 1
This pipeline is part of a development pipeline, so it's likely the image will need to be rebuilt constantly, so those extra minutes add up.
y
You mentioned it didn't work before because of the error? But now it works but it's slower. Sorry replaying in a checkout queue Maybe I'm not understanding why it's slower without the specifics. I haven't ran or looked for perf benchmarked between Native intel and m1 in Rosetta emulation mode. I haven't noticed any discernible impact on my personal machine, so it may be something else at play
e
I imagine the increased slowness isn't specific to Pact, but rather because the entire image needs to be built in emulation mode. As Pact is the only thing in the pipeline that requires emulation, though, everything else has to go through it too.
y
Got you buddy, I'll dig out the gh issue and maybe it's something you may want to pick up, if it's going to be valuable and say you lots of build time. I'm sure a few users would appreciate it. I did consider a self hosted runner as I have 2 m1 MacBooks here when I briefly touched on it
Multiple open issues across the org https://github.com/search?q=org%3Apact-foundation+arm64&type=issues Matt recently put a request in for an m1 runner in the aws account for pact foundation https://github.com/pact-foundation/pact-net/pull/365#issuecomment-1111550122 Which we are waiting to be actioned
e
👍
y
This is what we really want <3 but it's bigger than just Pact! https://github.com/actions/virtual-environments/issues/2187
e
I hope that lands too!
y
Oh one last thing before I leave you be, could you try upgrade pact-js to the latest version. Your version is from July 2021, and there was some work done in the later versions to make it play nicer on m1 machines, in pact-node. Maybe worth trying that, but without the platform flag set on docker. Cheers for reaching out!
e
Cool, I'll give that a shot. Thanks for your help and prompt replies! Always appreciated. 😄
🙌 1
b
We might just have to go with a manual build and release until we can get a suitable hosted environment.
When I get my M1 set up I can have a look at it.
Back in the day, that's how I used to do all the releases!
m
It does work on M1 mac arm, but not linux arm
b
oooh. right. can't help there
m
(we publish core libs for apple arm, but not linux)
yeah
sad
Waiting for Github to have arm agents
AWS haven’t approved us for ARM EC2 yet either 😠
y
What is the world coming to when Bezo's won't even take your money.
😆 1
e
I'm most interested in linux/arm64; the fact my host is an M1 is incidental in this case--my target is Alpine Linux, not macOS. In some cases my host could be a RaspberryPi cluster.
m
I’ll be honest, alpine support is plausible but probably unlikely. See https://github.com/pact-foundation/pact-net/issues/387#issuecomment-1114365283 as to why
e
Are there instructions for building the pact binary myself? I get that the burden of maintaining seperate versions per Alpine on your end is burdensome, but I also see that as potentially a cost that I could shoulder in and for my own build process for my own use. If I could build the binary locally for the particular version of Alpine I am using (say, as part of my docker build pipeline), could the NPM compile/postinstall step detect that instead of trying to download a precompiled version from your end?
m
I don’t think we generally publish that guide because it’s implementation detail
It will then produce an ffi with the correct architecture
We could potentially add a matrix of common builds to https://github.com/pact-foundation/pact-reference/blob/master/.github/workflows/build-ffi.yml, so it’s not that it’s not doable
The hard part is on the client side (e.g. Pact JS), knowing which ffi lib to bundle/install into the correct path. The installer would need to know library versions in order to ensure the correct FFI is in the right place
At the moment, Pact JS (well, actually
pact-core
) expects the ffi to be colocated with the native module (currently in
build/Release/pact.node
)
I think that could allow an -rpath to another location, or we could (during e.g. an npm postinstall phase) move it to the correct location
e
At the moment, Pact JS (well, actually
pact-core
) expects the ffi to be colocated with the native module (currently in
build/Release/pact.node
)
What if I created that path and put the compiled binary (from running
cargo build
myself) in it before running NPM? Would that work? As
pact-core
is a top-level(ish) package, I shouldn't have to delve too deeply into the abyss that is
node_modules
, though I'm not sure how/where binaries are located with Yarn 2 PnP, which some of my projects may use in the near future...
m
I don’t believe (from memory) than Yarn 2 PnP is supported, but this could be my second hand interpretation of a separate issue. But yes, actually what you’re saying could work
e
Ok, good to know that at least in principal this should work. I’ll tinker around with this when I get a moment to see what I can make happen.
👍 1