File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ mkdir -p "$OUT"
2525if [[ -f ffi/zig/build.zig ]]; then
2626 pushd ffi/zig > /dev/null
2727 mkdir -p zig-out/lib
28- zig build-lib -dynamic -O ReleaseSafe -fPIC --name proven \
29- -femit-bin=zig-out/lib/libproven.so src/main.zig -lc || {
28+ zig build-lib -static -O ReleaseSafe -fPIC --name proven \
29+ -femit-bin=zig-out/lib/libproven.a src/main.zig -lc || {
3030 echo " WARN: standalone Zig FFI build failed; fuzz targets will not link." >&2
3131 exit 1
3232 }
@@ -53,10 +53,9 @@ for fuzzer in safe_path_has_traversal; do
5353 fi
5454done
5555
56- # Bundle libproven.so so the runner can find it at exec time.
57- if [[ -f " $PROVEN_LIB_DIR /libproven.so" ]]; then
58- cp " $PROVEN_LIB_DIR /libproven.so" " $OUT /"
59- fi
56+ # Bundle libproven.a so the fuzzer build can find it (for static linking).
57+ # Note: ClusterFuzzLite binaries should be self-contained; static linking
58+ # is preferred to avoid runtime library loading issues.
6059popd > /dev/null
6160
6261echo " === Build complete. Staged to $OUT . ==="
Original file line number Diff line number Diff line change @@ -19,8 +19,14 @@ fn main() {
1919 println ! ( "cargo:rustc-link-search=native={}" , lib_dir) ;
2020 }
2121
22- // Link against libproven (the compiled Zig/Idris2 shared library)
23- println ! ( "cargo:rustc-link-lib=dylib=proven" ) ;
22+ // Link against libproven (the compiled Zig/Idris2 library).
23+ // Prefer static linking if libproven.a is found (required for ClusterFuzzLite).
24+ let is_static = std:: path:: Path :: new ( & lib_dir_path) . join ( "libproven.a" ) . exists ( ) ;
25+ if is_static {
26+ println ! ( "cargo:rustc-link-lib=static=proven" ) ;
27+ } else {
28+ println ! ( "cargo:rustc-link-lib=dylib=proven" ) ;
29+ }
2430
2531 // Add RPATH so binaries can find libproven.so relative to themselves (e.g. in ./lib/ or ./)
2632 // This is required for ClusterFuzzLite and standalone distributions.
You can’t perform that action at this time.
0 commit comments