I recently updated my mac OS. Now when I try to run cargo build
on roc I get an error ld: library 'zstd' not found
and ld: warning: ignoring duplicate libraries: '-lm'
.
Has anyone else come across these issues?
I have zstd installed I think.
$ which zstd
/opt/homebrew/bin/zstd
I can build things using nix develop
so not a total blocker.. though I use to be able to build this way also
zstd is the executable I wonder if you need the shared lib separately
I have the library... not sure why ld can't find it
$ pwd
/opt/homebrew/Cellar/zstd/1.5.6/lib
$ ls -al
total 2784
drwxr-xr-x 8 luke admin 256 Jun 3 19:11 .
drwxr-xr-x 13 luke admin 416 Jun 7 19:02 ..
drwxr-xr-x 3 luke admin 96 Mar 22 09:05 cmake
-rw-r--r-- 1 luke admin 669440 Jun 3 19:11 libzstd.1.5.6.dylib
lrwxr-xr-x 1 luke admin 19 Mar 22 09:05 libzstd.1.dylib -> libzstd.1.5.6.dylib
-r--r--r-- 1 luke admin 753312 Mar 22 09:05 libzstd.a
lrwxr-xr-x 1 luke admin 15 Mar 22 09:05 libzstd.dylib -> libzstd.1.dylib
drwxr-xr-x 3 luke admin 96 Jun 3 19:11 pkgconfig
Maybe it's meant to be symlink'd somewhere without the version number
But I would have thought homebrew would manage all that
I'm seeing the same thing; any tips? Did you end up figuring it out?
Ahh, found this in the CI config:
env:
LIBRARY_PATH: /opt/homebrew/Cellar/zstd/1.5.6/lib
Setting that env var seems to make things work for me
why do we depend on zstd? :thinking:
is it LLVM?
│ │ │ │ ├── snafu v0.7.5
│ │ │ │ │ ├── backtrace v0.3.69
│ │ │ │ │ │ ├── addr2line v0.21.0
│ │ │ │ │ │ │ └── gimli v0.28.0
│ │ │ │ │ │ ├── cfg-if v1.0.0
│ │ │ │ │ │ ├── libc v0.2.149
│ │ │ │ │ │ ├── miniz_oxide v0.7.1
│ │ │ │ │ │ │ └── adler v1.0.2
│ │ │ │ │ │ ├── object v0.32.2
│ │ │ │ │ │ │ ├── crc32fast v1.3.2
│ │ │ │ │ │ │ │ └── cfg-if v1.0.0
│ │ │ │ │ │ │ ├── flate2 v1.0.28
│ │ │ │ │ │ │ │ ├── crc32fast v1.3.2 (*)
│ │ │ │ │ │ │ │ └── miniz_oxide v0.7.1 (*)
│ │ │ │ │ │ │ ├── hashbrown v0.14.3 (*)
│ │ │ │ │ │ │ ├── indexmap v2.1.0
│ │ │ │ │ │ │ │ ├── equivalent v1.0.1
│ │ │ │ │ │ │ │ └── hashbrown v0.14.3 (*)
│ │ │ │ │ │ │ ├── memchr v2.6.4
│ │ │ │ │ │ │ └── ruzstd v0.5.0
│ │ │ │ │ │ │ ├── byteorder v1.5.0
│ │ │ │ │ │ │ ├── derive_more v0.99.17 (proc-macro)
From cargo tree
, it seems that snafu
has a backtrace feature that when enabled, brings in backtrace
which uses it
rg -i zstd
only brings up that usage and then us installing zstd
:
❯ rg -i zstd
Cargo.lock
1707: "ruzstd",
3360:name = "ruzstd"
.github/workflows/nightly_macos_apple_silicon.yml
18: LIBRARY_PATH: /opt/homebrew/Cellar/zstd/1.5.6/lib
www/content/install/macos_x86_64.md
24: brew install z3 zstd
oh wow
so we could get rid of snafu and get rid of that dependency?
we barely even use snafu! :big_smile:
I believe so!
I'll make a PR
Actually, we just have to disable backtraces. Would you rather disable backtraces or remove it in favor of manually implementing std::error::Error for the...
2 enums we have
I'm leaning towards remove
https://github.com/roc-lang/roc/pull/7003
Seems like we were also "using" it in the object
crate, in that the crate has a compression
feature that brings in zstd. By disabling the feature, we removed the dependency.
If tests all run correctly (beyond it compiling for me locally), then we're good to go.
There's a chance, though, that there's an OSX-only code portion that uses the compression feature, in which case this PR is moot and can be closed
I think it's a good change regardless!
All the tests pass, so it looks like we don't need zstd
or z3
It's on auto-merge, just needs an approval
Richard Feldman said:
why do we depend on zstd? :thinking:
is it LLVM?
This is why these "basic" questions are useful!
Last updated: Jul 06 2025 at 12:14 UTC