public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug build/27657] New: GDB fails to link on MSYS2 and mingw64 looking for BCryptGenRandom
@ 2021-03-28  6:06 chrisj at rtems dot org
  2021-03-29  4:29 ` [Bug build/27657] " chrisj at rtems dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: chrisj at rtems dot org @ 2021-03-28  6:06 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27657

            Bug ID: 27657
           Summary: GDB fails to link on MSYS2 and mingw64 looking for
                    BCryptGenRandom
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: chrisj at rtems dot org
  Target Milestone: ---

I am building the RTEMS tool chain which includes GDB on Windows using MSYS2.
We build GDB with Python. I am getting an unresolved symbol error for
BCryptGenRandom. 

The build log is ..

https://ftp.rtems.org/pub/rtems/people/chrisj/gdb/rsb-log-20210328-155802.txt

The repo we clone is a mirror of yours on github ...

https://github.com/RTEMS/sourceware-mirror-binutils-gdb

The version we are using is sourceware-mirror-binutils-gdb-fc9b4c8.

GDB configure is in mixed minds about bcrypt.h ...

checking bcrypt.h presence... yes
configure: WARNING: bcrypt.h: present but cannot be compiled
configure: WARNING: bcrypt.h:     check for missing prerequisite headers?
configure: WARNING: bcrypt.h: see the Autoconf documentation
configure: WARNING: bcrypt.h:     section "Present But Cannot Be Compiled"
configure: WARNING: bcrypt.h: proceeding with the compiler's result
checking for bcrypt.h... no
checking whether the bcrypt library is guaranteed to be present... checking if
x86_64-w64-mingw32-gcc -O2 -g -pipe
-I/d/opt/rtems/rsb.git/rtems/build/tmp/sb-197609/6s/d/opt/rtems/6/include
supports -fno-rtti -fno-exceptions... checking if x86_64-w64-mingw32-gcc -O2 -g
-pipe -I/d/opt/rtems/rsb.git/rtems/build/tmp/sb-197609/6s/d/opt/rtems/6/include
supports -fno-rtti -fno-exceptions... no

The source builds without error which is nice but the link fails ...

  CXXLD  gdb.exe
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
../gnulib/import/libgnu.a(getrandom.o): in function `getrandom':
D:\opt\rtems\rsb.git\rtems\build\srgfxwm1\build\gnulib\import/../../../sourceware-mirror-binutils-gdb-fc9b4c8/gnulib/import/getrandom.c:129:
undefined reference to `BCryptGenRandom'
collect2.exe: error: ld returned 1 exit status

>From my simplified outside view it seems like the library libbcrypt.a is
missing ...

$ grep -r BCryptGenRandom /mingw64
/mingw64/x86_64-w64-mingw32/include/bcrypt.h:  NTSTATUS WINAPI BCryptGenRandom
(BCRYPT_ALG_HANDLE hAlgorithm, PUCHAR pbBuffer, ULONG cbBuffer, ULONG dwFlags);
Binary file /mingw64/x86_64-w64-mingw32/lib/libbcrypt.a matches

The library is part of the MSYS2 package ...

$ pacman -Qo /mingw64/x86_64-w64-mingw32/lib/libbcrypt.a
/mingw64/x86_64-w64-mingw32/lib/libbcrypt.a is owned by
mingw-w64-x86_64-crt-git 9.0.0.6128.07922837-1

This looks like an archive wrapper for the standard Windows DLL.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-02-27 23:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-28  6:06 [Bug build/27657] New: GDB fails to link on MSYS2 and mingw64 looking for BCryptGenRandom chrisj at rtems dot org
2021-03-29  4:29 ` [Bug build/27657] " chrisj at rtems dot org
2021-03-29 15:53 ` tromey at sourceware dot org
2021-03-29 20:10 ` cbiesinger at google dot com
2021-03-29 20:41 ` chrisj at rtems dot org
2021-03-29 20:46 ` chrisj at rtems dot org
2021-03-29 23:29 ` cbiesinger at google dot com
2021-03-30 15:58 ` ssbssa at sourceware dot org
2021-08-26 10:38 ` ilg at livius dot net
2021-09-03 15:04 ` ovilewade9 at gmail dot com
2022-02-27 23:31 ` tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).