From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 2DFD5385734B for ; Tue, 19 Apr 2022 22:36:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2DFD5385734B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from reform (deer0x09.wildebeest.org [172.31.17.139]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id EC65230003AA; Wed, 20 Apr 2022 00:36:22 +0200 (CEST) Received: by reform (Postfix, from userid 1000) id ABC472E806E4; Wed, 20 Apr 2022 00:36:22 +0200 (CEST) Date: Wed, 20 Apr 2022 00:36:22 +0200 From: Mark Wielaard To: Dmitry Tsarevich Cc: bzip2-devel@sourceware.org Subject: Re: Unable to build under Windows Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="yhh29AbpkJ/dD1gI" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: bzip2-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bzip2-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2022 22:36:25 -0000 --yhh29AbpkJ/dD1gI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Dmitry, On Sun, Feb 20, 2022 at 12:45:06AM +0300, Dmitry Tsarevich via Bzip2-devel wrote: > I'm trying to build bzip2 under Windows / MSVC > > Unfortunately, STDERR_FILENO is *nix specific and is not defined under MSVC. > > What I can suggest is to patch bzip2.c to define STDERR_FILENO under MSVC: > > diff --git a/bzip2.c b/bzip2.c > index d1f2fa8..d4550a9 100644 > --- a/bzip2.c > +++ b/bzip2.c > @@ -150,6 +150,8 @@ > ERROR_IF_MINUS_ONE ( retVal ); \ > } while ( 0 ) > > +#define STDERR_FILENO _fileno(stderr) > + > #endif /* BZ_LCCWIN32 */ I cannot test myself under Windows / MSVC, but that seems a reasonable suggestion. Especially since fileno is already used inside this BZ_LCCWIN32 block. I pushed the attached. Thanks, Mark --yhh29AbpkJ/dD1gI Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Define-STDERR_FILENO-for-BZ_LCCWIN32.patch" >From 28da6196a27de951d6143d4f2765d1f2976f0d39 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 20 Apr 2022 00:31:01 +0200 Subject: [PATCH] Define STDERR_FILENO for BZ_LCCWIN32 STDERR_FILENO is *nix specific and is not defined under MSVC. So define it using _fileno(stderr). Suggested-by: Dmitry Tsarevich --- bzip2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bzip2.c b/bzip2.c index d1f2fa8..1538faf 100644 --- a/bzip2.c +++ b/bzip2.c @@ -150,6 +150,8 @@ ERROR_IF_MINUS_ONE ( retVal ); \ } while ( 0 ) +# define STDERR_FILENO _fileno(stderr) + #endif /* BZ_LCCWIN32 */ -- 2.30.2 --yhh29AbpkJ/dD1gI--