Mailing List Archive

Error while trying to compile libgcrypt on macOS
Hi

I was just trying to compile libgcrypt 1.10.2 on my Mac

libgcrypt ? uname -a
Darwin paag-MacBookAir 21.6.0 Darwin Kernel Version 21.6.0: Thu Mar 9 20:08:59 PST 2023; root:xnu-8020.240.18.700.8~1/RELEASE_X86_64 x86_64

And I got the following error:

/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 all in my effort to get gnupg 2.4.1 running from the tarballs in gnupg.org <http://gnupg.org/>

Thanks for any help, /PA
Re: Error while trying to compile libgcrypt on macOS [ In reply to ]
On 2023-05-06 at 07:51 +0200, Pedro Andres Aranda Gutierrez wrote:
> Hi
>
> I was just trying to compile libgcrypt 1.10.2 on my Mac
>
> libgcrypt ? uname -a
> Darwin paag-MacBookAir 21.6.0 Darwin Kernel Version 21.6.0: Thu Mar
> 9 20:08:59 PST 2023; root:xnu-8020.240.18.700.8~1/RELEASE_X86_64
> x86_64
>
> And I got the following error:
>
> /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 all in my effort to get gnupg 2.4.1 running from the tarballs in
> gnupg.org
>
> Thanks for any help, /PA

It is trying to compile for using a Linux syscall (getrandom) which is
not available in Mac OS.

How did you run configure? What did it output about getrandom?




_______________________________________________
Gnupg-devel mailing list
Gnupg-devel@gnupg.org
https://lists.gnupg.org/mailman/listinfo/gnupg-devel
Re: Error while trying to compile libgcrypt on macOS [ In reply to ]
Hi,

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

https://dev.gnupg.org/T6442

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

./configure --enable-random=linux

which uses the old /dev/random entrop gatherer.

? https://lists.gnupg.org/pipermail/gnupg-users/2023-May/066545.html

Hope that helps,

--
Todd