Re: Cygwin targetting mingw 32-bit

Vibhu Mohindra <[email protected]> Sun, 2 Oct 2022 04:42:22 +0200
Newsgroups gmane.lisp.clisp.devel
Message-ID <VI1PR06MB4320D723E72B8F4EA8053AADCA589@VI1PR06MB4320.eurprd06.prod.outlook.com>
To link the object files into an executable, -lbcrypt is needed but missing.

Processor: Intel Xeon X5647, x64-based processor
System: Windows 10 64-bit, 6 GB RAM
Cygwin (32-bit (and also likely 64-bit)) targetting mingw 32-bit

"make base" complains with:

i686-w64-mingw32-gcc -g -O2 -W -Wswitch -Wcomment -Wpointer-arith 
-Wreturn-type -Wmissing-declarations -Wimplicit -Wno-sign-compare 
-Wno-format-nonliteral -Wno-shift-negative-value -O2 
-fexpensive-optimizations -fwrapv -D_WIN32 -fno-strict-aliasing -DNO_ASM 
-DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DNO_FAST_FLOAT 
-DNO_FAST_DOUBLE -DNO_ALLOCA -DNO_ADDRESS_SPACE_ASSUMPTIONS 
-DNO_GENERATIONAL_GC -DNO_SYMBOLFLAGS -DENABLE_UNICODE 
-DNO_TERMCAP_NCURSES -DNO_GETTEXT -L/usr/local/mingw32/lib modules.o 
regexi.o calls.o -luser32 -lole32 -loleaut32 -luuid -lversion gettext.o 
lisp.a libgnu.a -luser32 -lole32 -loleaut32 -luuid -lws2_32 -o lisp.exe
/usr/lib/gcc/i686-w64-mingw32/11/../../../../i686-w64-mingw32/bin/ld: 
libgnu.a(getrandom.o): in function `getrandom':
/cygdrive/c/Users/vibhu/clisp_202209b/buildc32m6432a/gllib/../../src/gllib/getrandom.c:129: 
undefined reference to `BCryptGenRandom@16'
collect2: error: ld returned 1 exit status
./clisp-link: failed in 
/cygdrive/c/Users/vibhu/clisp_202209b/buildc32m6432a/base
make: *** [Makefile:2360: base] Error 1

I don't see -lbcrypt in there, which is the problem. The libs listed 
above with -l are all found as .a archives in mingw's sys-root area. As 
is libbcrypt.a . So adding -lbcrypt to the gcc command above fixes the 
problem so that "make base" succeeds.

I manually appended -lbcrypt to LIBS in my build directory's Makefile.
But the true fix is presumably upstream of that. I see that,
src/makemake.in
has a line adding -luser32 to LIBS. This should also add -lbcrypt.

Maybe it should also go into build/syscalls/link.sh's NEW_LIBS var.

-- 
Vibhu


_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel