Error while trying to compile libgcrypt on macOS

Todd Zullinger tmz at
Sun May 7 05:58:12 CEST 2023


Pedro Andres Aranda Gutierrez via Gnupg-devel wrote:
> I was just trying to compile libgcrypt 1.10.2 on my Mac
> /bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I../src -I../src -I/usr/local/include -I/usr/local/include -arch x86_64 -Os -fno-delete-null-pointer-checks -Wall -MT rndgetentropy.lo -MD -MP -MF .deps/rndgetentropy.Tpo -c -o rndgetentropy.lo rndgetentropy.c
> libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../src -I../src -I/usr/local/include -I/usr/local/include -arch x86_64 -Os -fno-delete-null-pointer-checks -Wall -MT rndgetentropy.lo -MD -MP -MF .deps/rndgetentropy.Tpo -c rndgetentropy.c  -fno-common -DPIC -o .libs/rndgetentropy.o
> rndgetentropy.c:98:21: error: implicit declaration of function 'getrandom' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
>               ret = getrandom (buffer, nbytes, GRND_RANDOM);
>                     ^
> rndgetentropy.c:98:48: error: use of undeclared identifier 'GRND_RANDOM'
>               ret = getrandom (buffer, nbytes, GRND_RANDOM);
>                                                ^
> 2 errors generated.

This came up on the gnupg-users list the other day as well.
Werner replied to say¹:

    There is a glitch in 1.10 which affects macOS.  Please see

    which has a patch.  It should also be possible to use

      ./configure --enable-random=linux

      which uses the old /dev/random entrop gatherer.


Hope that helps,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <>

More information about the Gnupg-devel mailing list