Hi,
I build roc
from source and I would like to be able to call the binary from outside the repo.
I tried with ln -s
but other libs are missing:
➜ my-folder$ ls -l
total 8
-rw-r--r-- 1 ghigt staff 1,7K 25 sep 18:17 main.roc
lrwxr-xr-x 1 ghigt staff 19B 25 sep 18:21 source -> ../source
➜ my-folder$ ./source/roc main.roc
🔨 Rebuilding platform...
thread 'main' panicked at 'Failed to find the lib directory. Did you copy the roc binary without also copying the lib directory?
If you built roc from source, the lib dir should be in target/release.
If not, the lib dir should be included in the release tar.gz file.', crates/compiler/builtins/src/bitcode.rs:9:45
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Though, it work the other way if I'm in the source
folder and I call ./roc ../my-folder/main.roc
.
What's the best way to do it properly?
you need roc
and the lib
folder that lives next to it in target/release/
for myself, I just alias roc=/.../roc/target/release/roc
and alias roc-debug=/.../roc/target/debug/roc
. Instead you could just copy roc/target/release/roc
and roc/target/release/lib
to /usr/local/bin
for example. Or somewhere else and add it to the path.
this is a temporary state of affairs - the goal is to make the binaries roc
produces not need any external dependencies like this, but right now they do because there are some features we haven't finished yet to make that work
Brendan Hansknecht said:
for myself, I just
alias roc=/.../roc/target/release/roc
andalias roc-debug=/.../roc/target/debug/roc
. Instead you could just copyroc/target/release/roc
androc/target/release/lib
to/usr/local/bin
for example. Or somewhere else and add it to the path.
my problem with this solution is to include the platform from the source directory, do you link it (with ln -s
) or put the full path in your .roc
file (or something else)?
Ah, for platforms, it depends. A lot of the time I just copy them over because they are small and I might change my local copy.
Otherwise, it should be fine to link the platform directory and use a relative path.
So I worry about platforms separately from dealing with the lib
folder.
Sometimes I just use a relative path overall cause I tend to keep roc related repos in a folder adjacent to the roc repo folder
Ghislain has marked this topic as resolved.
Ghislain has marked this topic as unresolved.
Sorry for the bot, don't know if I need to check it or not, it looks not usually used.
Thank you for your answers.
I think the "resolved" feature is useful for specific question threads like this one!
Also FWIW for my apps I use a git submodule of the Roc repo to use example platform source - not necessarily the best way, but it's worked for me
Cool, I saw one of your repo and didn't know how you did your "git thing" :sweat_smile:
:sparkles:magic:sparkles:
It's basically a subclone
I would do git submodules, but i don't want like 20 copies of the roc repo on my machine
Last updated: Jul 06 2025 at 12:14 UTC