From 6f796134acbe4a201093b693fc14f0dba0c89f1b Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Fri, 17 Oct 2025 15:10:05 +0800 Subject: [PATCH] rng: fix for Apple --- rng/unix/dune | 5 +++-- rng/unix/mc_getrandom_stubs.c | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rng/unix/dune b/rng/unix/dune index caaa33ed..a3d93816 100644 --- rng/unix/dune +++ rng/unix/dune @@ -21,8 +21,9 @@ (foreign_stubs (language c) (include_dirs ../../src/native) - (names mc_getrandom_stubs)) - (c_library_flags + (names mc_getrandom_stubs) + (flags (-isystem @PREFIX@/include/LegacySupport))) + (c_library_flags -lMacportsLegacySupport (:include rng_c_flags.sexp))) (env diff --git a/rng/unix/mc_getrandom_stubs.c b/rng/unix/mc_getrandom_stubs.c index da7032ce..08ff4e4d 100644 --- rng/unix/mc_getrandom_stubs.c +++ rng/unix/mc_getrandom_stubs.c @@ -43,6 +43,7 @@ void raw_getrandom (uint8_t *data, size_t len) { #elif (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__APPLE__)) || defined(__NetBSD__) // on BSD and macOS, loop (in pieces of 256) getentropy #if defined(__APPLE__) +#include /* u_int */ // on macOS, getentropy is defined in sys/random.h (on BSD in unistd.h) #include #endif