Stream: contributing

Topic: tcp listener in basic-cli


view this post on Zulip Norbert Hajagos (Jun 06 2024 at 19:45):

Hi! As mentioned in prev conversation at least 2 people will need a way to listen to raw tcp connections in their roc code for the upcoming book. Me being one of them, and having time on my hand, I want to implement that feature into a fork of basic-cli. It isn't my goal to get it upstreamed and a blocking listener (max 1 connection) is just fine. Before discussing the api (I have no idea how it would look), I'm asking for general platform development help.

Got the basic-cli repo cloned next to the roc repo. I enter the dev shell defined in the nix flake. Running roc examples/echo.roc does the thing correctly. The very first thing I've tried was to run the glue.sh script. Thought it would re-generate the same files. Nope. Running the same example now crashes the compiler with An internal compiler expectation was broken. ... There are 6 errors like below, all shaped the same but at different assertions:

error[E0080]: evaluation of constant value failed
   --> /home/ez/code/basic-cli/crates/roc_app/src/x86_64.rs:326:39
    |
326 | const _SIZE_CHECK_union_ReadErr: () = assert!(core::mem::size_of::<union_ReadErr>() == 40);
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: core::mem::size_of::<union_ReadErr>() == 40', /home/ez/code/basic-cli/crates/roc_app/src/x86_64.rs:326:39

Also weird that there is a crates/roc_app/src/x86.rs generated. Tried renaming it to x86_64.rs, but same error. I'm on x86_64, linux (NixOs).

Is this even a good direction? Initially, I want to add a single effect to basic-cli that prints a constant message and thought this is where I needed to start.

view this post on Zulip Luke Boswell (Jun 06 2024 at 20:13):

I have a branch that will probably be much easier to start with. Hopefully we can merge it next week sometime. https://github.com/roc-lang/basic-cli/tree/refactor-host

view this post on Zulip Luke Boswell (Jun 06 2024 at 20:15):

You will need to run roc build.roc to get started. But it's much simpler without using RustGlue which is buggy

view this post on Zulip Norbert Hajagos (Jun 07 2024 at 08:45):

Good to hear things are moving! I'll wait for the merge then, since running roc build.roc on the branch produces an error from cargo when building the platform with error: linking with cc failed: exit status: 1


Last updated: Jul 06 2025 at 12:14 UTC