From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 7C2DF38618E2 for ; Mon, 28 Sep 2020 14:43:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7C2DF38618E2 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44735) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMuNg-0006QU-8Q; Mon, 28 Sep 2020 10:43:56 -0400 Received: from [176.228.60.248] (port=3117 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kMuNf-000065-KP; Mon, 28 Sep 2020 10:43:56 -0400 Date: Mon, 28 Sep 2020 17:43:43 +0300 Message-Id: <83zh5aklls.fsf@gnu.org> From: Eli Zaretskii To: simon.cook@embecosm.com CC: gdb@sourceware.org In-Reply-To: <833632m10q.fsf@gnu.org> (message from Eli Zaretskii via Gdb on Mon, 28 Sep 2020 17:25:25 +0300) Subject: Re: Unable to build GDB on Windows References: <833632m10q.fsf@gnu.org> X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2020 14:43:58 -0000 > Date: Mon, 28 Sep 2020 17:25:25 +0300 > From: Eli Zaretskii via Gdb > Cc: gdb@sourceware.org > > > From: Simon Cook > > Date: Mon, 28 Sep 2020 14:47:25 +0100 > > > > I've been trying to build top of tree GDB on Windows (natively under > > the MSYS2 environment), and haven't been able to link successfully due > > to undefined symbols after linking against gnulib: > > > > CXXLD gdb.exe > > ../gnulib/import/libgnu.a(getrandom.o): In function `getrandom': > > C:\msys64s\home\simon\work\b\gnulib\import/../../../binutils-gdb/gnulib/import/getrandom.c:129: > > undefined reference to `BCryptGenRandom' > > collect2.exe: error: ld returned 1 exit status > > > > Reading through the source file and gnulib/import/m4/getrandom.m4, it > > suggests that in my case if bcrypt can be guaranteed to be present > > then I should add -lbcrypt to my linker flags to resolve these > > references, and indeed if I execute the failing gdb link command and > > add -lbcrypt at the end then my link succeeds. Btw, looking at Gnulib's getrandom.c, my conclusion is that a GDB built on Windows 7 and later will be unable to run on older versions of Windows, because it will have a static dependency on bcrypt.dll and the BCryptGenRandom function from that DLL. IOW, such a GDB will refuse to run on older Windows systems. OTOH, if you build on Windows before 7, the produced binary will be able to run on newer versions of Windows by dynamically loading bcrypt.dll (when available) at run time, and using a fallback otherwise. Perhaps no one cares about Windows 7 and older anymore, but I just wanted to say this FTR, in case someone bumps into such a problem.