Skip to content

FreeBSD compilation guide fails: unable to find library -lzstd #24506

@JanBeh

Description

@JanBeh

Using the instructions on the wiki page "Building Zig From Source", section "For FreeBSD" (revision at time of writing this issue) does not work as expected.

Used revision from master branch: 67e6df4

Commands:

mkdir build
cd build
cmake .. -DZIG_STATIC_LLVM=ON -DCMAKE_PREFIX_PATH="/usr/local/llvm20;/usr/local"
make

Output (snippet):

[ 94%] Linking CXX executable zig2
ld: error: unable to find library -lzstd
ld: error: unable to find library -lzstd
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.

Following the compilation guide, I would expect compilation to succeed.

It works (on my machine, with a FreeBSD that has been updated a few days ago) when using instead:

-cmake .. -DZIG_STATIC_LLVM=ON -DCMAKE_PREFIX_PATH="/usr/local/llvm20;/usr/local"
+cmake .. -DZIG_STATIC_ZSTD=ON -DCMAKE_PREFIX_PATH=/usr/local

(taken from this Ziggit forum post)

The compilation guide should be updated or marked as being outdated. Ideally, the problem would be fixed such that cmake .. without additional parameters works out of the box.

Related closed issue:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavioros-freebsd

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions