Stream: beginners

Topic: use roc on a headlesss server


view this post on Zulip dank (Feb 20 2023 at 19:39):

so a friend tried to grab roc from nightly and run it
problem being

  1. he runs (and can only run) in a headless server
  2. he cannot install any software
  3. he gets error while loading shared libraries: libasound.so.2 No such file or directory

now (I think) I get why, guess the editor depends on alsa for audio
and ofc he does not have a DE so it is not installed by default, and again he can't (and perhaps shouldn't need to ideally) install it himself for roc to operate

so then what would people who can only to run/ program in a tty environment do?

view this post on Zulip dank (Feb 20 2023 at 19:41):

I think there should be an option to ignore it with the warning that only partial functionality will be enabled, no?

view this post on Zulip Brendan Hansknecht (Feb 20 2023 at 20:29):

There is a feature flag when compiling from source to disable it.

view this post on Zulip Brendan Hansknecht (Feb 20 2023 at 20:30):

Not a direct solution, but does enable a workaround

view this post on Zulip Richard Feldman (Feb 21 2023 at 02:30):

I think ideally we could also gracefully degrade regarding audio

view this post on Zulip Richard Feldman (Feb 21 2023 at 02:30):

we use a Rust crate for audio, and I'm not sure what their options are regarding that

view this post on Zulip Richard Feldman (Feb 21 2023 at 02:36):

honestly I wouldn't mind if we removed rodio as a dependency for now

view this post on Zulip Richard Feldman (Feb 21 2023 at 02:37):

we aren't using it for anything, and I'd really like to avoid having roc depend on shared libraries like this which aren't always available

view this post on Zulip Richard Feldman (Feb 21 2023 at 02:37):

because in general I want to avoid support requests of the form "I don't have lib_____ and roc won't work without it, how do I fix this?" - they are really terrible UX

view this post on Zulip Richard Feldman (Feb 21 2023 at 02:38):

what do others think about removing rodio as a dependency for now (we aren't actually using it for anything real yet anyway, it just makes it so that pressing F12 plays a bell sound - basically "hello world")

view this post on Zulip Joshua Warner (Feb 21 2023 at 03:02):

Silly question - what does the editor need audio for?

view this post on Zulip Joshua Warner (Feb 21 2023 at 03:02):

(I say this as someone who takes pains to turn off the terminal bell)

view this post on Zulip Richard Feldman (Feb 21 2023 at 03:10):

short answer is accessibility

view this post on Zulip Richard Feldman (Feb 21 2023 at 03:11):

text-to-speech

view this post on Zulip Richard Feldman (Feb 21 2023 at 03:11):

so we definitely need it in the future, but I don't know that solving the shared library problem right now is worth the trouble until we actually have something to use that library with :big_smile:

view this post on Zulip Joshua Warner (Feb 21 2023 at 03:11):

Ahhh interesting

view this post on Zulip Joshua Warner (Feb 21 2023 at 03:12):

I would have thought that text-to-speech is something you'd generally depend on OS functionality for, rather than having that built-in

view this post on Zulip Joshua Warner (Feb 21 2023 at 03:12):

Both mac & windows have accessibility APIs to expose text to screen readers

view this post on Zulip Joshua Warner (Feb 21 2023 at 03:13):

Would need to do some research on linux

view this post on Zulip Richard Feldman (Feb 21 2023 at 03:16):

yeah we talked about those options - short version is that it seems like for our use case we'll have an easier time getting to a good outcome if we go the direct audio route for the actual text, and just use OS APIs to detect user settings

view this post on Zulip Joshua Warner (Feb 21 2023 at 03:30):

Have you talked to people who actually use screen readers (for coding or otherwise)?

view this post on Zulip Joshua Warner (Feb 21 2023 at 03:30):

(I ask, not having done so myself - but I'm assuming such people would have important opinions on the matter)

view this post on Zulip Joshua Warner (Feb 21 2023 at 03:32):

Also, good TTS is hard.

view this post on Zulip Joshua Warner (Feb 21 2023 at 03:33):

I guess on the other hand if the Roc editor could really nail a good experience for visually-impaired people, that could be a good selling point for that niche market.

view this post on Zulip Joshua Warner (Feb 21 2023 at 03:33):

... but seems like a serious case of scope creep ;)

view this post on Zulip Joshua Warner (Feb 21 2023 at 03:35):

... and if you already talked to a visually impaired person to come to the current plan - definitely just ignore everything I said!

view this post on Zulip Richard Feldman (Feb 21 2023 at 03:41):

Joshua Warner said:

Have you talked to people who actually use screen readers (for coding or otherwise)?

yeah, @Jose Quesada - that's who I was referring to with the "we" who concluded we should do our own audio :big_smile:

view this post on Zulip Richard Feldman (Feb 21 2023 at 03:42):

I think actually the difference between doing a really good job and doing a functionally adequate job at all will be mostly a matter of design effort

view this post on Zulip Richard Feldman (Feb 21 2023 at 03:43):

I suspect the implementation effort will be pretty comparable either way, but I could be wrong!

view this post on Zulip Joshua Warner (Feb 21 2023 at 03:47):

I wonder how hard it would be to link to the underlying audio library dynamically - only when available on the system?

view this post on Zulip Richard Feldman (Feb 21 2023 at 03:52):

yeah I think that's ideally what we'd do - I assume the rodio crate would have to support that, which I don't know if it does!

view this post on Zulip Brendan Hansknecht (Feb 21 2023 at 04:43):

I think there is a second dependency on x/Wayland for visuals, correct? So that would have to go too for working in cli? Or does that work on Linux with no GUI.

view this post on Zulip Joshua Warner (Feb 21 2023 at 04:45):

Tangentially, I've kinda wanted to experiment with a terminal-only version of the editor ;)

view this post on Zulip Luke Boswell (Feb 21 2023 at 04:55):

^^ I would love to get roc-tui mature enough to do something like this.

view this post on Zulip Luke Boswell (Feb 21 2023 at 04:56):

I don't really have any long term ambitions for it at the moment other then just experimenting with ideas like this.

view this post on Zulip Anton (Feb 21 2023 at 08:46):

I'll take out rodio for now, I'll also set up a headless VM to check if no other issues pop up.

view this post on Zulip Anton (Feb 21 2023 at 19:05):

I've set up a PR here with rodio removed and I've confirmed it works on a headless ubuntu 22.04 server. It may not yet make it in tomorrow's nightly but the branch can be used to build a release with:

RUSTFLAGS="-C target-cpu=x86-64" cargo build --release
./ci/package_release.sh roc_release_no_alsa

view this post on Zulip dank (Mar 05 2023 at 14:09):

image.png

view this post on Zulip dank (Mar 05 2023 at 19:05):

uknow @Anton the more i think about it, why is it not possible to just dynamically load these stuff on demand, at runtime, when a user tries to open the editor?

view this post on Zulip Brendan Hansknecht (Mar 05 2023 at 19:27):

Looks maybe possible, but also potentially a bit a fight with rust

view this post on Zulip Brendan Hansknecht (Mar 05 2023 at 19:27):

Best discussion i have found on it so far: https://users.rust-lang.org/t/linux-executable-lazy-loading/65621

view this post on Zulip Anton (Mar 06 2023 at 08:40):

Dynamic loading on demand has an obvious benefit but also a significant downside, like that the editor suddenly breaks when you try to copy something because you don't have the correct dyn lib available. It's not a nice user experience and gives a very bad impression.

I think the way to go would be to start on a headless/CI/server nightly release.

In crates/cli/Cargo.toml we can take out editor from default = ["target-aarch64", "target-x86_64", "target-wasm32", "editor"].
I think I'll be able to set up the full headless release this week.

view this post on Zulip dank (Mar 06 2023 at 10:19):

Anton said:

Dynamic loading on demand has an obvious benefit but also a significant downside, like that the editor suddenly breaks when you try to copy something because you don't have the correct dyn lib available. It's not a nice user experience and gives a very bad impression.

I think the way to go would be to start on a headless/CI/server nightly release.

In crates/cli/Cargo.toml we can take out editor from default = ["target-aarch64", "target-x86_64", "target-wasm32", "editor"].
I think I'll be able to set up the full headless release this week.

yes that sounds bad, but what i had in mind is couldn't we just validate those dynamic libs when _opening_ the editor (not when trying to use the feature)?

view this post on Zulip dank (Mar 06 2023 at 10:20):

having a headless release is a good idea too tho

view this post on Zulip Anton (Mar 06 2023 at 10:34):

couldn't we just validate those dynamic libs when _opening_ the editor

Yeah, that sounds good. It does seem like something that could potentially take a lot of time to figure out so I can't prioritize it right now but feel free to go ahead yourself if you like.

view this post on Zulip dank (Mar 06 2023 at 12:42):

yea thanks. i will when i get the time. meanwhile the headless release is a good solution

view this post on Zulip Anton (Mar 10 2023 at 16:38):

@dank I've built a headless release, available here. The number of dynamic dependencies has dropped a lot but it's still possible that your friend will not be able to run it depending on how minimal their debian install is.

view this post on Zulip dank (Mar 10 2023 at 16:39):

tnx anton we'll try it out

view this post on Zulip Anton (Mar 12 2023 at 09:58):

@dank I've slightly changed the name of the file, this is the new link. The old name caused issues with ci scripts.

view this post on Zulip dank (Mar 12 2023 at 10:00):

no problem, thanks
was useful yesterday btw, only thing missing was glibc but that's ok for now

view this post on Zulip Anton (Mar 12 2023 at 10:01):

Happy to hear it :)


Last updated: Jul 06 2025 at 12:14 UTC