Skip to content

Building on FreeBSD fails to find -lzstd #19617

@iacore

Description

@iacore

Zig Version

3d16520

Steps to Reproduce and Observed Behavior

On FreeBSD 14.0, run:

git clone https://github.com/ziglang/zig
cd zig
cmake -B build -DCMAKE_BUILD_TYPE=Release -G 'Ninja'
cd build
ninja

Output:

> ninja
[1/2] Linking CXX executable zig2
FAILED: zig2 
: && /usr/bin/c++ -O3 -DNDEBUG -Wl,-z,stack-size=0x10000000 CMakeFiles/zig2.dir/zig2.c.o CMakeFiles/zig2.dir/compiler_rt.c.o -o zig2 -L/usr/local/llvm17/lib -Wl,-rpath,/usr/local/llvm17/lib  zigcpp/libzigcpp.a  /usr/local/llvm17/lib/libclang-cpp.so.17  /usr/local/llvm17/lib/liblldMinGW.a  /usr/local/llvm17/lib/liblldELF.a  /usr/local/llvm17/lib/liblldCOFF.a  /usr/local/llvm17/lib/liblldWasm.a  /usr/local/llvm17/lib/liblldMachO.a  /usr/local/llvm17/lib/liblldCommon.a  -lLLVM-17  -lrt  -lexecinfo  -lpthread  -lm  -lz  -lzstd  -lpthread  -lm  -lz  -lzstd && :
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)
ninja: build stopped: subcommand failed.

Expected Behavior

It should build without problem.

Additional Details

zstd is installed at /usr/local

> pkg list zstd
/usr/local/bin/unzstd
/usr/local/bin/zstd
/usr/local/bin/zstd-frugal
/usr/local/bin/zstdcat
/usr/local/bin/zstdgrep
/usr/local/bin/zstdless
/usr/local/bin/zstdmt
/usr/local/include/zdict.h
/usr/local/include/zstd.h
/usr/local/include/zstd_errors.h
/usr/local/lib/cmake/zstd/zstdConfig.cmake
/usr/local/lib/cmake/zstd/zstdConfigVersion.cmake
/usr/local/lib/cmake/zstd/zstdTargets-release.cmake
/usr/local/lib/cmake/zstd/zstdTargets.cmake
/usr/local/lib/libzstd.a
/usr/local/lib/libzstd.so
/usr/local/lib/libzstd.so.1
/usr/local/lib/libzstd.so.1.5.5
/usr/local/libdata/pkgconfig/libzstd.pc
/usr/local/man/man1/unzstd.1.gz
/usr/local/man/man1/zstd.1.gz
/usr/local/man/man1/zstdcat.1.gz
/usr/local/man/man1/zstdgrep.1.gz
/usr/local/man/man1/zstdless.1.gz
/usr/local/man/man1/zstdmt.1.gz
/usr/local/share/licenses/zstd-1.5.5/BSD3CLAUSE
/usr/local/share/licenses/zstd-1.5.5/GPLv2
/usr/local/share/licenses/zstd-1.5.5/LICENSE
/usr/local/share/licenses/zstd-1.5.5/catalog.mk

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviordownstreamAn issue with a third party project that uses Zig.os-freebsdFreeBSD

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions