Currently, we do not have any precompiled binaries for the ARM platform.
Now that Windows is supported, we should look into compiling for ARM. That would enable users to Prisma 2 on Raspberry Pi and other all sorts of ARM-based devices.
This will also include adding ARM to the binaries spec: https://github.com/prisma/specs/tree/master/binaries#binary-files
This bit me post-dev as I got to the deployment pipeline stage of my project. Happy to see this is on the roadmap, is there a target timeline?
No concrete timeline target yet but building the binary yourself should already work.
@radicand can you provide some context for what your deployment setup looks like?
@schickling I'll see if I can do that; thanks for the info. My target deployment is on a Raspberry Pi ARM64 k3s cluster. In my container image for the backend, I have it execute lift up and also create the database if not present (for bootstrapping). Without the working binaries, these steps don't execute. I'll attempt to build manually to include in the image and follow up.
I've managed to cross-compile aarch64 (arm64) binaries (with some headache); once I've got them generated, what is the recommended step to make them usable? E.g., should I copy them somewhere specific; is there configuration to change, etc?
EDIT: I found the ENV variables. For those that follow:
Works great, thanks.
Is there a way to suppress the downloading of the engine binaries? In attempting to create an arm64 docker image, both npm i and prisma2 build will try to download the (non-existent) binaries and fail, even with the above ENV set.
@radicand I would consider that as a bug that we need to fix. Can you please open a new issue about that?
I can't generate prisma2 client on Raspberry pi 3b+: node_modules/prisma2/query-engine-debian-openssl-1.1.x: cannot execute binary file.. :'(
Open a new issue with the full error message and what instructions you are trying to follow please @Suniron.
I have a raspberry pi 4 development box and it would be awesome to have ARM support.
For now we document how to build yourself and how to use the built binaries at these links:
https://github.com/prisma/prisma-engines#building-prisma-engines
https://www.prisma.io/docs/understand-prisma/under-the-hood#using-custom-engine-binaries
In the interim, our friend @fabianmoronzirfas seemed to solve this and shared extensive instructions here:
Finally I got this working by (for future reference):
- installing rust and compiling the binaries directly on the Raspberry Pi
- adding the 4 environment variables to
./prisma/.envand made them point to my compiled binariesPRISMA_QUERY_ENGINE_BINARY=/home/pi/bin/query-engine PRISMA_INTROSPECTION_ENGINE_BINARY=/home/pi/bin/introspection-engine PRISMA_MIGRATION_ENGINE_BINARY=/home/pi/bin/migration-engine PRISMA_FMT_BINARY=/home/pi/bin/prisma-fmt
- forking and cloning the whole prisma package
- ran through first steps in CONTRIBUTING.md to get this setup
- added
'arm-openssl-1.1.x'toconst knowPlatforms: Platform[]=[…insrc/packages/engine-core/src/NodeEngine.ts- added
'arm-openssl-1.1.x'totype Platform = …andexport const platforms = […insrc/packages/get-platform/src/platforms.ts- ran through first steps in CONTRIBUTING.md again to build all packages
- adapted my project to use
pnpm- linked the cli to my project
pnpm link ../../prisma/prisma-fork/src/packages/cli- ran my generate commands
- got a beer from the fridge
- padded my back
See my changes github.com/fabianmoronzirfas/prisma/tree/feature-raspberry-pi
FWIW I also have a pipeline setup that builds the binaries using Cross. I haven't done as good a job at keeping up to date with releases, but the pipeline and artifacts are here: https://gitlab.com/npappas/prisma-engines/pipelines
Any updates on this? I managed to compile the binaries myself, but I'm having a hard time integrating them into another project that uses Prisma internally...
I'd also like to show my support for this request. I'm trying to deploy on the RPI4 (arm64) and it's a real blocker. Any prisma command results in this error.
Prisma Schema loaded from db/schema.prisma
Error: Get config Error: Command failed with Unknown system error -8: /app/node_modules/@prisma/cli/query-engine-linux-musl cli get-config
Thanks!
To add another voice of support: I've had a difficult time since 2.8 compiling the binaries - I have not yet been successful on arm64 since then. I'm still trying, but have been getting errors at the linker stage. It'd would be great it they just came out of the box.
@radicand I was able to successfully compile the binaries on my RPI4 this morning. I created a docker image of it and made it accessible to copy the binaries straight from it, rather than rebuilding all the time (it took an hour to compile). Here's a repo documenting how you can use it.
https://github.com/jcmcneal/prisma-arm64
Let me know if you have any luck with it!
Hey @jcmcneal, thanks for the detailed solution!
I'm trying to run the Dockerfile on my RPI4, but I get the following error:
dpkg: error processing archive direnv.deb (--install):
package architecture (arm64) does not match system (armhf)
Errors were encountered while processing:
direnv.deb
I have a 32 bit Raspebian Lite installed, is that the issue?
Update: I was able to overcome this by commenting out these lines from the Dockerfile:
RUN curl http://launchpadlibrarian.net/358480279/direnv_2.15.0-1_armhf.deb -o direnv.deb
RUN dpkg -i direnv.deb
And instead, running these:
RUN apt-get update
RUN apt-get install direnv
@dutzi That makes sense. I'm running 64bit Ubuntu 20 and dotenv would not install via apt-get. If you get that to build successfully then I can add you as a collaborator on docker hub and you can push up the build for arm32.
I'm not too familiar with Docker but I don't mind trying, I'm @dutzi at docker hub.
Well, I got it built, and I changed node_modules/@prisma/cli/build/index.js by hand, to quickly fix the missing arm-openssl-1.1.x, but now when I run npx prisma generate, I get the following error message:
Environment variables loaded from current directory
Warning Precompiled binaries are not available for arm.
Prisma Schema loaded from schema.prisma
Warning Precompiled binaries are not available for arm.
Warning Precompiled binaries are not available for arm.
Error:
TypeError: mappings.filter is not a function
at getMappings (/home/dutzi/repos/project-wi/node_modules/@prisma/client/generator-build/index.js:9716:19)
at externalToInternalDmmf (/home/dutzi/repos/project-wi/node_modules/@prisma/client/generator-build/index.js:9712:15)
at getPrismaClientDMMF (/home/dutzi/repos/project-wi/node_modules/@prisma/client/generator-build/index.js:9740:10)
at buildClient (/home/dutzi/repos/project-wi/node_modules/@prisma/client/generator-build/index.js:11337:21)
at generateClient (/home/dutzi/repos/project-wi/node_modules/@prisma/client/generator-build/index.js:11393:45)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Update: I gave up on running generate on my RPI4, I'm instead generating it on my mac and manually copying it to node_modules on my Pi. I also copy query-engine from the binaries built (locally) thanks to @jdmachogg's image.
I'm running generate on my RPI4 just fine, but maybe because it's arm64 OS. If you run prisma -v does it point to your custom binaries? I don't have to do anything other than put the .env file next to my schema file.
Hey, sorry, I gave up on Raspebian, it was too much a headache... I just installed Ubuntu Server 64. 🤷♂️
Regarding your question, I did put the .env file inside the folder where the schema file was. It ran for sure, but wasn't happy with the setup.
Sweet, hopefully you see better performance on 64 bit Ubuntu. Yeah, I tried doing some cross compiling of prisma for arm32 and it was also a headache. We ought to just leave that to the prisma team but I doubt they'll support it anytime soon. For now I'll just leave my repo as is for anyone who wants to use it and get back to developing my website 😄
@radicand I was able to successfully compile the binaries on my RPI4 this morning. I created a docker image of it and made it accessible to copy the binaries straight from it, rather than rebuilding all the time (it took an hour to compile). Here's a repo documenting how you can use it.
https://github.com/jcmcneal/prisma-arm64
Let me know if you have any luck with it!
Thanks - I specifically build for Alpine, and I suspect if I was using glibc it'd be working given your success with no hackarounds. I'll keep trying and see if I can determine what the issue is.
Hello there,
I'm encountering the issue described here.
I understand that you are not going to officially support arm platforms yourselves and that you just give instructions on how we can do it ourselves.
However it seems you are blocking (probably not on purpose) any execution on non supported platforms and the workaround is to simply add the name of the platform to a list (or 2).
Could you lift that restriction when using custom binaries so we don't have to fork the entire prisma in this situation?
If needed, I can create a new issue to track this, just tell me 😃
New issues sounds like a good idea @BaptisteLongy - maybe also add a suggestion on how you would achieve that from a user perspective (env var?).
Will ARM be supported now as we have Apple M1 CPUs on dev machines? 🤔
Most helpful comment
Hello there,
I'm encountering the issue described here.
I understand that you are not going to officially support arm platforms yourselves and that you just give instructions on how we can do it ourselves.
However it seems you are blocking (probably not on purpose) any execution on non supported platforms and the workaround is to simply add the name of the platform to a list (or 2).
Could you lift that restriction when using custom binaries so we don't have to fork the entire prisma in this situation?
If needed, I can create a new issue to track this, just tell me 😃