I’m trying to create a Rust app in Glitch, and I’m having trouble installing new packages through cargo.
I’ve found at least two projects that are using Rust already:
hello-rust is using Iron as a backend, which it’s pulling into Cargo.toml. In a thread about language support from last year, the author mentions installing other Rust packages, like actix.
rust-web-server is using vanilla Rust, no third-party packages
The first example showed that installing packages worked at some point!
But if I remix either of these projects and start trying to installing my own dependencies (or in the cast of hello-rust, just run it in my own namespace), I get an error from Cargo:
$ cargo build
error: failed to load source for a dependency on `oauth-client`
Caused by:
Unable to update registry `https://github.com/rust-lang/crates.io-index`
Caused by:
failed to open: /opt/rust/cargo/registry/index/github.com-1ecc6299db9ec823/.cargo-index-lock
Caused by:
Permission denied (os error 13)
Inspecting it in the console, I see that the directory is owned by root:
$ ls -l /opt/rust/cargo
total 8
drwxr-xr-x 2 root root 4096 Jun 28 03:39 bin
-rw-r--r-- 1 root root 40 Jun 28 03:40 env
Am I missing something I should be doing to install packages with Rust? Have the permissions on this directory changed in the last year or something?
(This might also just be a bad idea, if Glitch has to recompile dependencies on cold start. Just curious if I’m missing something, because I couldn’t find explanations for this error elsewhere!)
Hi, I wrote the hello-rust template, and can confirm it did work at some point, but no longer does now that I check it.
At a guess, it would seem Glitch no longer allows access to the location cargo was using to store files, or else Glitch’s version of cargo has been updated and has breaking changes to the way it stores files that aren’t compatible with Glitch.
It’s difficult to say where the issue lies, without insight from the Glitch team.
Thanks for all the suggestions – I ended up writing my first Glitch app in Python instead of Rust, and I’ll probably stick to that better-trodden path until something changes.
They should then remove all the other compilers and possibly announce that they will be a NodeJS host. The issue right now is there are many references that state glitch supports other languages. While that may have been true at the time it listed, once some time has passed the “other” (rust for example) compilers will eventually stop working and lead to many unhappy users taking their frustration on other forum users only trying to help. Besides, if they merge their resources to only NodeJS it will be much cheaper to run their services overall due to less support time on unsupported languages and smaller containers overall. If you need even more of a reason imagine if someone pays for a year worth of glitch plus only to find out go/java/python/rust etc. is unsupported and as a result they cannot host their site here…
Hi, @wh0 and @MealsPOS, while it is true that Glitch mentions Node.JS in most places as the supported framework, it is not the only framework supported on Glitch. Here is a list of supported languages and framework. There are many other supported languages and frameworks like PHP, Java, Vue.JS, Ruby, Ruby on Rails, C, Python etc. and the Glitch support team will help you out if you face any problem with them. They helped me with my Ruby on Rails app, too.
While other languages/platforms may work on Glitch, we only support javascript/Node.js
If you would like tips and workarounds for using rust/cargo with Glitch, check out community forum. There, you might find some folks who have had success working with it. Here are some existing forum threads about Rust. Feel free to ask your questions in there, or create a new thread if you like!
Rust is not going to be supported outside of community workarounds, which at the moment only causes undue strain to the server.