Stream: beginners

Topic: How to enable dbg?


view this post on Zulip Jared Cone (Sep 29 2024 at 05:28):

I'm not able to get dbg to print anything in the basic-cli example. I tried modifying examples/args.roc:

main =
    dbg "dbg print"
    Stdout.line! "std print"
    args = Arg.list! {}
    ....

but only Stdout is printing:

jared@jared-laptop:~/External/basic-cli$ ./examples/args
std print

I thought maybe my terminal wasn't printing stderr for some reason, but I tried changing roc_dbg to use println instead of eprintln but it's still not showing

view this post on Zulip Jared Cone (Sep 29 2024 at 05:36):

As far as I can tell roc_dbg isn't being called at all. Does it need a compiler flag?

view this post on Zulip Luke Boswell (Sep 29 2024 at 05:38):

You need to use roc dev main.roc or I think roc main.roc also

view this post on Zulip Luke Boswell (Sep 29 2024 at 05:42):

If you build the app it is currently stripped out... but we have plans to change this

view this post on Zulip Jared Cone (Sep 29 2024 at 05:42):

ty

view this post on Zulip Jared Cone (Sep 29 2024 at 05:45):

I don't think I'm currently able to do that. I'm currently having to build with --linker=legacy

jared@jared-laptop:~/External/basic-cli$ roc examples/args.roc
🔨 Rebuilding platform...
An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: <https://github.com/roc-lang/roc/issues/new/choose>
failed to open file "examples/../platform/dynhost": No such file or directory (os error 2)
Location: crates/linker/src/lib.rs:552:29

If I use roc instead of roc build, I think it's quietly failing? At least the args example doesn't seem to be running:

jared@jared-laptop:~/External/basic-cli$ roc --linker=legacy ./examples/args.roc
🔨 Rebuilding platform...
jared@jared-laptop:~/External/basic-cli$

view this post on Zulip Luke Boswell (Sep 29 2024 at 05:46):

You can pass the args by using an -- and then pass the args after

view this post on Zulip Luke Boswell (Sep 29 2024 at 05:47):

$ roc --linker=legacy ./examples/args.roc -- firstArg secondArg

view this post on Zulip Jared Cone (Sep 29 2024 at 05:47):

I'm not really trying to use the Args program, I was just using it to try to figure out if dbg not working was an issue with my platform or in general

view this post on Zulip Jared Cone (Sep 29 2024 at 05:48):

what I was saying above is for some reason if I just do roc the args example doesn't seem to run at all

view this post on Zulip Luke Boswell (Sep 29 2024 at 05:48):

Ahk, there is a rust specific bug that I know of where args aren't passed on linux

view this post on Zulip Luke Boswell (Sep 29 2024 at 05:49):

It's not related to roc specifically

view this post on Zulip Luke Boswell (Sep 29 2024 at 05:49):

https://github.com/roc-lang/basic-cli/issues/82

view this post on Zulip Luke Boswell (Sep 29 2024 at 05:50):

We upgraded to 1.79 but I think the bug is still there for some reason

view this post on Zulip Luke Boswell (Sep 29 2024 at 05:50):

What version of rust are you using?

view this post on Zulip Jared Cone (Sep 29 2024 at 05:51):

This isn't an issue with the commandline arguments. Lemme clarify:

when I use roc build and run the app manually:

jared@jared-laptop:~/External/basic-cli$ roc build --linker=legacy examples/args.roc
🔨 Rebuilding platform...
0 errors and 0 warnings found in 1271 ms
 while successfully building:

    examples/args
jared@jared-laptop:~/External/basic-cli$ ./examples/args
std print??
Error: A subcommand must be called.

Usage:
  args-example [options]
  args-example <COMMAND>

when I use just roc:

jared@jared-laptop:~/External/basic-cli$ roc --linker=legacy ./examples/args.roc
🔨 Rebuilding platform...
jared@jared-laptop:~/External/basic-cli$

view this post on Zulip Jared Cone (Sep 29 2024 at 05:52):

rustc 1.79.0 (129f3b996 2024-06-10)

view this post on Zulip Jared Cone (Sep 29 2024 at 05:55):

meh nm I just forced platform to rebuild and now roc on its own is working

view this post on Zulip Brendan Hansknecht (Sep 29 2024 at 14:52):

Note, we want dbg to be usable with roc build. It is just currently tangled to expect. expect has not been updated yet. So it can only be used when the compiler executes a binary (like with roc some-app.roc). Until expect is updated or decoupled from dbg, neither can work with roc build ....

view this post on Zulip Brendan Hansknecht (Sep 29 2024 at 14:53):

#6930 if anyone is interested in taking a crack at this.


Last updated: Jul 06 2025 at 12:14 UTC