Hi! Are there any statically linked builds of roc, or plans to make that? I'm in the rare position of not wanting to install homebrew on my mac. This makes the installation step brew install llvm@16
more challenging (this step is curiously missing from the x86_64 build for macos).
Of course, I have myself to thank for being unusual in this regard, but wouldn't it be helpful everyone with one less step?
Side note, I don't see a dynamic library reference to llvm, but I do see one to libzstd.
$ otool -L roc
roc:
/usr/lib/libffi.dylib (compatibility version 1.0.0, current version 30.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
/opt/homebrew/opt/zstd/lib/libzstd.1.dylib (compatibility version 1.0.0, current version 1.5.6)
/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.23.0)
/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 1163.100.19)
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 60158.100.133)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1858.112.0)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
Hi @Johannes Hoff,
Are there any statically linked builds of roc, or plans to make that
yes, there are plans, see https://github.com/roc-lang/roc/pull/6921 and https://github.com/roc-lang/roc/issues/6083
Side note, I don't see a dynamic library reference to llvm, but I do see one to libzstd.
I think brew install llvm@16
installs several dependencies but you don't actually need most of them.
You can install libzstd through whatever means possible and move it to /opt/homebrew/opt/zstd/lib/
If you try to run roc (like roc helloWorld.roc
) it'll tell you which specific dependencies you miss and you can install those one by one so you don't need to install llvm
Oh, great that you're working on it! I'll follow that issue.
I'll see how far I get with manual installation.
The only dynamic library needed was zstd, so that was pretty easy. But I seems I really should have llvm, since ld
is failing (in surprising ways, at least to me). Other fun things is that the repl runs, but crashes on any command. So, I'm guessing even a static build will have problems for me, unless it bundles ld and doesn't invoke it as an external command.
Anyway, I don't expect any help or sympathy here, and fully realize that there's a simpler way.
For the curious, here's the output from building:
% DYLD_LIBRARY_PATH=/Users/j/zstd/lib ./roc examples/helloWorld.roc
ld: library not found for -lSystem
examples/helloWorld: No such file or directory
thread 'main' panicked at crates/compiler/build/src/program.rs:1037:17:
not yet implemented: gracefully handle `ld` (or `zig` in the case of wasm with --optimize) returning exit code Some(1)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Your Mac can't find the system library?
Looks like it :man_shrugging: I have the latest xcode installed, which I assumed should be enough, so I blamed my llvm-version. Perhaps wrongly. I also have the latest macos version (15.0.1), but that might be a reason for it to fail, rather than work.
Building from source will probably work (if you want to install nix). Then you can do:
$ cd roc
$ nix develop
$ cargo build --release --bin roc
$ ./target/release/roc ./examples/helloWorld.roc
Last updated: Jul 06 2025 at 12:14 UTC