On Mon, Apr 03, 2023 at 03:39:37PM +0200, Arash Esbati wrote: > and grep'ing for bcrypt shows: > > --8<---------------cut here---------------start------------->8--- > | #define HAVE_BCRYPT_H 1 (many entries for this and the next line) > | #define HAVE_LIB_BCRYPT 1 > ac_cv_header_bcrypt_h=yes > gl_cv_lib_assume_bcrypt=yes > GETRANDOM_LIB='-lbcrypt' > LIB_GETRANDOM='-lbcrypt' > #define HAVE_BCRYPT_H 1 > #define HAVE_LIB_BCRYPT 1 > --8<---------------cut here---------------end--------------->8---
This may be the problem as in the code in gnulib/lib/getrandom.c, the symbol is used if HAVE_LIB_BCRYPT, on line 85: # define BCryptGenRandomFunc BCryptGenRandom which is then used on line 128 which gives the warning: if (BCryptGenRandomFunc != NULL && BCryptGenRandomFunc (NULL, buffer, length, BCRYPT_USE_SYSTEM_PREFERRED_RNG) The check in gnulib/m4/getrandom.m4 for HAVE_LIB_BCRYPT seems to be a simple Windows version check: AC_CACHE_CHECK([whether the bcrypt library is guaranteed to be present], [gl_cv_lib_assume_bcrypt], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <windows.h>]], [[#if !(_WIN32_WINNT >= _WIN32_WINNT_WIN7) cannot assume it #endif ]]) ], [gl_cv_lib_assume_bcrypt=yes], [gl_cv_lib_assume_bcrypt=no]) ]) One thing that I noticed from your original report was that the -lbcrypt flag wasn't on the command line: gcc -g -O2 -o ginstall-info.exe install-info.o ../gnulib/lib/libgnu.a /mingw64/lib/libintl.dll.a -L/mingw64/lib Running 'gnulib-tool --add-import getrandom' prints You may need to use the following Makefile variables when linking. Use them in <program>_LDADD when linking a program, or in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library. $(CLOCK_TIME_LIB) $(GETRANDOM_LIB) $(HARD_LOCALE_LIB) $(LIBTHREAD) $(LTLIBICONV) when linking with libtool, $(LIBICONV) otherwise $(LTLIBINTL) when linking with libtool, $(LIBINTL) otherwise $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise $(MBRTOWC_LIB) $(SETLOCALE_NULL_LIB) (I normally ignore these messages when running gnulib --add-import as we have usually already made these modifications to Makefile.am and/or configure.ac). Hence perhaps the following is the correct fix: diff --git a/install-info/Makefile.am b/install-info/Makefile.am index 9bcff71bde..b53cc3dcb9 100644 --- a/install-info/Makefile.am +++ b/install-info/Makefile.am @@ -33,4 +33,4 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib \ -I$(top_builddir)/gnulib/lib \ -DLOCALEDIR=\"$(localedir)\" -LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(LIBINTL) $(LIBTHREAD) +LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(LIBINTL) $(LIBTHREAD) $(GETRANDOM_LIB) I've made this change in a recent commit; could you try it again?