Unable to build under Windows

Mark Wielaard mark@klomp.org
Tue Apr 19 22:36:22 GMT 2022


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Define-STDERR_FILENO-for-BZ_LCCWIN32.patch
Type: text/x-diff
Size: 684 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/bzip2-devel/attachments/20220420/3e4e7ade/attachment.bin>


More information about the Bzip2-devel mailing list