Stream: beginners

Topic: Installation instructions missing cargo?


view this post on Zulip Michael (Dec 25 2022 at 09:44):

Installed the nightly on MacOs. (I'm a first time downloader).
roc version and roc repl run fine. Then ran:
roc run helloWorld.roc
:hammer: Rebuilding platform...
thread '<unnamed>' panicked at 'I could not find the cargo command.
Visit https://rustup.rs/ to install cargo.', crates/utils/src/lib.rs:179:9
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
thread 'main' panicked at 'Failed to (re)build platform.: Any { .. }', crates/cli/src/build.rs:344:46

Are the installation instructions missing a step? Referring to https://github.com/roc-lang/roc/blob/main/getting_started/macos_apple_silicon.md

view this post on Zulip Brian Carroll (Dec 25 2022 at 10:56):

Those instructions do include rustup, which should install cargo. Did that step give you any errors?

view this post on Zulip Richard Feldman (Dec 25 2022 at 11:02):

oh we need to change hello world to use a URL for its package

view this post on Zulip Michael (Dec 25 2022 at 11:50):

@Brian Carroll I purposely stopped after step 6, as the instructions state that this should be sufficient. I'm still confused: should the installation instructions be changed to include cargo as a mandatory step? Or will a change to helloWorld fix the problem?

also tried main.roc from https://www.roc-lang.org/tutorial#building-an-application

roc run main.roc
thread 'main' panicked at 'not yet implemented: unhandled parse error PackageEntry(IndentPackage(@30), @27)', crates/reporting/src/error/parse.rs:4015:14
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

view this post on Zulip Brian Carroll (Dec 25 2022 at 13:43):

It sounds like the hello world example requires you to actually compile the Rust code. But we have a way to download it pre-compiled from a URL. Then you wouldn't need cargo and it would be consistent with the tutorial. That's what Richard is referring to.
So yes a change to the example seems to be what's needed. Given that a lot of people are on holidays it might take a few days for someone to get time for it.

view this post on Zulip Anton (Dec 26 2022 at 10:22):

also tried main.roc from https://www.roc-lang.org/tutorial#building-an-application

roc run main.roc
thread 'main' panicked at 'not yet implemented: unhandled parse error PackageEntry(IndentPackage(@30), @27)', crates/reporting/src/error/parse.rs:4015:14
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Is this on macos x86_64?

view this post on Zulip Michael (Dec 27 2022 at 15:02):

This is on an M1 (ARM) running Ventura

view this post on Zulip Anton (Dec 27 2022 at 16:33):

I've noticed some weird issue when I copy the example from building-an-application on macOS (safari) extra newlines are introduced. Can you confirm your code looks exactly like this @Michael?

app "hello"
    packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.1.3/5SXwdW7rH8QAOnD71IkHcFxCmBEPtFSLAIkclPEgjHQ.tar.br" }
    imports [pf.Stdout]
    provides [main] to pf

main =
    Stdout.line "I'm a Roc application!"

And run with roc dev main.roc

I tried this on an m1 mac with macos 12.

view this post on Zulip Michael (Dec 28 2022 at 19:08):

Well caught @Anton ! This was indeed the problem. The code above produces the expected result. For reference, this is the code that did not run:

app "hello"
    packages { pf:
"https://github.com/roc-lang/basic-cli/releases/download/0.1.3/5SXwdW7rH8QAOnD71IkHcFxCmBEPtFSLAIkclPEgjHQ.tar.br"
}
    imports [pf.Stdout]
    provides [main] to pf

main =
    Stdout.line "I'm a Roc application!"

view this post on Zulip Brian Carroll (Dec 28 2022 at 20:55):

Maybe we should make the parser a bit more robust to these newlines! Seems like we should be able to tolerate them.

view this post on Zulip Joshua Warner (Dec 28 2022 at 23:57):

Huh I'm actually kinda surprised that didn't just work. I thought I fixed that a while ago :thinking:

view this post on Zulip Michael (Dec 29 2022 at 06:35):

So copy/pasting code from the tutorial does not give the expected result. This got me curious and I looked up the source of this snippet in tutorial.md:

<pre><samp><span class="kw">app</span> <span class="str">"hello"</span>
    <span class="kw">packages</span> <span class="brace">{</span> pf: <span class="str">"https://github.com/roc-lang/basic-cli/releases/download/0.1.3/5SXwdW7rH8QAOnD71IkHcFxCmBEPtFSLAIkclPEgjHQ.tar.br"</span> <span class="brace">}</span>
    <span class="kw">imports</span> <span class="brace">[</span>pf.Stdout<span class="brace">]</span>
    <span class="kw">provides</span> <span class="brace">[</span>main<span class="brace">]</span> <span class="kw">to</span> pf

main <span class="kw">=</span>
    Stdout.line <span class="str">"I'm a Roc application!"</span>
</samp></pre>

This does not look nice at all to me, having all this HTML markup in the documentation source. May I make the suggestion to convert to Asciidoc for documentation? I'd be willing to contribute here. Asciidoc sources render nicely in github, and it's much more powerful than Markdown. An additional benefit: this would also enable the path to Antora in due course.

view this post on Zulip Anton (Dec 29 2022 at 12:54):

Joshua Warner said:

Huh I'm actually kinda surprised that didn't just work. I thought I fixed that a while ago :thinking:

I believe it is actually fixed @Joshua Warner, but I think Michael is not on the most recent nightly.

view this post on Zulip Anton (Dec 29 2022 at 13:05):

This does not look nice at all to me

I agree :)
I looked into this a bit before and we can use regular markdown code blocks where the syntax highlighting is done cleanly behind the scenes as described here. We currently use pulldown_cmark in examples/static-site-gen/platform.

Setting up regular markdown code blocks seems like the fastest and easiest solution.
Lots of people are familiar with github flavored markdown. I also don't believe we need the more powerful features of Asciidoc. Less features often result in more simplicity. Feel free to oppose my arguments though :)

view this post on Zulip Michael (Dec 29 2022 at 13:41):

I was using roc_nightly-macos_apple_silicon-2022-12-24-25aeab9.tar.gz . Just now I downloaded roc_nightly-macos_apple_silicon-2022-12-29-db86b87.tar.gz and the issue still exists, i.e.:

thread 'main' panicked at 'not yet implemented: unhandled parse error PackageEntry(IndentPackage(@30), @27)', crates/reporting/src/error/parse.rs:4015:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

view this post on Zulip Joshua Warner (Dec 29 2022 at 16:10):

My pr that should have fixed this landed a couple months ago I think

view this post on Zulip Luke Boswell (Dec 30 2022 at 09:04):

Re the syntax highlighting, that was the best I was able to manage converting to markdown. It's definitely a short term solution and a bit handraulic. I think ideally if we can get the roc parser to support syntax highlighting then we can add that into the static-site platform to render all of the Roc code blocks nicely. :grinning_face_with_smiling_eyes:

view this post on Zulip Joshua Warner (Jan 01 2023 at 18:21):

The indentation pickiness should be improved here: https://github.com/roc-lang/roc/pull/4844


Last updated: Jul 06 2025 at 12:14 UTC