Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to support M1 architecture #99

Closed
kikiya opened this issue Jul 7, 2021 · 12 comments
Closed

Update to support M1 architecture #99

kikiya opened this issue Jul 7, 2021 · 12 comments
Labels
enhancement New feature or request kalix-runtime Runtime and SDKs sub-team

Comments

@kikiya
Copy link
Contributor

kikiya commented Jul 7, 2021

Currently the install fails when using on M1 architecture Macs but the current fix is pretty straight forward:

Based on issue protocolbuffers/protobuf#8557

We should be able to add these lines and might want to reference the above PR in comments.

case "arm64":
          return makeDownloadFile("osx-x86_64"); 

The change should be added in this block --

https://github.com/lightbend/akkaserverless-javascript-sdk/blob/69f5578a000b990d02d685ffcf8514e89d985e48/sdk/bin/download-protoc.js#L17

@kikiya kikiya added the enhancement New feature or request label Jul 7, 2021
kikiya added a commit to kikiya/akkaserverless-javascript-sdk that referenced this issue Jul 7, 2021
kikiya added a commit to kikiya/akkaserverless-javascript-sdk that referenced this issue Jul 7, 2021
@ennru ennru added the kalix-runtime Runtime and SDKs sub-team label Dec 14, 2021
@johanandren
Copy link
Contributor

One more step is some details about building the docker image using docker buildx with amd64 as platform.

@johanandren
Copy link
Contributor

Adding that osx-x86_64 then goes on to fail with

[ 66%] Building C object CMakeFiles/cpu_features.dir/src/cpuinfo_arm.c.o
In file included from /Users/johan/Code/Lightbend/akka-serverless/akkaserverless-javascript-sdk/sdk/node_modules/cpu-features/deps/cpu_features/src/cpuinfo_arm.c:15:
/Users/johan/Code/Lightbend/akka-serverless/akkaserverless-javascript-sdk/sdk/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_arm.h:118:2: error: "Including cpuinfo_arm.h from a non-arm target."
#error "Including cpuinfo_arm.h from a non-arm target."
 ^

in "cpu_features" google/cpu_features#150

So looks like moving forward with this is blocked by that

@johanandren
Copy link
Contributor

Looks like this may be fixed by the switch in what proto/grpc tooling we use in current main.

@johanandren
Copy link
Contributor

Almost, it is not possible to build the kalix-tools because it depends on a native image of the codegen which is not available for Macos arm64.

@johanandren
Copy link
Contributor

I got that to work locally by doing the following:

  • install a graalvm that works on m1 ("22.1.0.r17-grl" with sdkman)
  • point the nativeImageGraalHome in kalix-codegen-js-cli to the graal directory
  • sbt kalix-codegen-js-cli/nativeImage
  • copy the built binary somewhere
  • set/export env KALIX_NPMJS_CODEGEN_BINARY to the complete path of that somewhere

@pvlugter
Copy link
Member

Looks like CircleCI doesn't yet support M1, so we won't be able to automate this yet.

https://circleci.canny.io/cloud-feature-requests/p/support-new-m1-arm-based-macs

Can it just run the x64 codegen binary via rosetta for now? (don't have an M1 mac to try it out)

Looks like there are protoc versions with osx-aarch downloads now.

Will nativeImageVersion := "22.1.0" work to have an M1 compatible graalvm downloaded automatically?

@pvlugter
Copy link
Member

Longer term, could make more sense to convert the codegen over to TypeScript, and not have the native image binaries.

@pvlugter
Copy link
Member

Published 1.0.0-M9 with changes from #358 — use protoc osx-aarch download, use x86 binary (with rosetta) for codegen.

@johanandren
Copy link
Contributor

Looks like 1.0.0-M9 works nicely up to building a docker image.

Building the image needs a cross build using buildx (this is how I've solved that in the Scala SDK samples: https://github.com/lightbend/kalix-jvm-sdk/blob/main/samples/scala-doc-snippets/build.sbt#L18 ), or you end up with an arm64 image on docker hub which can't be deployed to Kalix.

@johanandren
Copy link
Contributor

For the record, this is the command to cross-build and push the js-customer-registry sample:

docker buildx build --platform=linux/amd64 -f Dockerfile -t johanandren/js-customer-registry:2022-06-21 ../../.. --push

@pvlugter
Copy link
Member

We can include that in the kalix-scripts package docker command. And all samples and quickstarts should use the provided scripts.

@johanandren
Copy link
Contributor

Once #377 is merged this now works all the way from creating a project from a template to deploying it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request kalix-runtime Runtime and SDKs sub-team
Projects
None yet
Development

No branches or pull requests

4 participants