Coder Social home page Coder Social logo

entropy's Introduction

Introduction

This package allows Haskell users to easily acquire entropy for use in critical security applications by calling out to either windows crypto api, unix/linux's getrandom and /dev/urandom. Hardware RNGs (currently RDRAND, patches welcome) are supported via the hardwareRNG function.

Quick Start

To simply get random bytes use getEntropy:

#!/usr/bin/env cabal
{- cabal:
    build-depends: base, entropy, bytestring
-}
import qualified Data.ByteString as BS
import           System.Entropy

main :: IO ()
main = print . BS.unpack =<< getEntropy 16
-- Example output: [241,191,215,193,225,27,121,244,16,155,252,41,131,38,6,100]

Faster Randoms from Hardware

Most x86 systems include a hardware random number generator. These can be faster but require more trust in the platform:

import qualified Data.ByteString as B
import           System.Entropy

eitherRNG :: Int -> IO B.ByteString
eitherRNG sz = maybe (getEntropy sz) pure =<< getHardwareEntropy sz

main :: IO ()
main = print . B.unpack =<< eitherRNG 32

This package supports Windows, {li,u}nix, QNX, and has preliminary support for HaLVM.

Typically tested on Linux and OSX - testers are as welcome as patches.

Build Status

entropy's People

Contributors

alexanderkjeldaas avatar ali-abrar avatar angerman avatar athas avatar cblp avatar daleiz avatar eskimor avatar felixonmars avatar finleymcilwaine avatar hamishmack avatar hasufell avatar hvr avatar iphydf avatar l29ah avatar ldr709 avatar mightybyte avatar mitchellwrosen avatar mwu-tow avatar newhoggy avatar noschinl avatar qrilka avatar redneb avatar ryanglscott avatar singpolyma avatar tommd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

entropy's Issues

when HAVE_RDRAND, closeHandle UseRdRand failed

ifdef HAVE_RDRAND

openHandle = return UseRdRand
closeHandle (CH h) = ...

closeHandle UseRdRand:
System\EntropyWindows.hs:117:1-38: Non-exhaustive patterns in function closeHandle

possible fix:

closeHandle :: CryptHandle -> IO ()
closeHandle (CH h) = cryptReleaseCtx h
+++ closeHandle UseRdRand = return ()

unknown symbol cpu_has_rdrand

Ran into this building yesod on a Debian i386 system (on a 64 bit capable host fwiw).

Loading package entropy-0.3 ... linking ... ghc: /home/builder/.cabal/lib/entropy-0.3/ghc-7.4.1/HSentropy-0.3.o: unknown symbol cpu_has_rdrand' ghc: unable to load packageentropy-0.3'
cabal: Error: some packages failed to install:
yesod-1.2.6 depends on yesod-core-1.2.16.1 which failed to install.

At build time, entropy says:

Result of RDRAND Test: True

unconditional import of System.Posix breaks entropy 0.2.2.3 on windows.

Installing via cabal on windows fails with Could not find module `System.Posix'.
Seems that the bug was introduced in 0.2.2.3, as 0.2.2.2 installs just fine.

Installation output:

[1 of 1] Compiling Main             ( C:\Users\josh\AppData\Local\Temp\entropy-0.2.2.3-4076\entropy-0.2.2.3\Setup.hs, C:\Users\josh\AppData\Local\Temp\entropy-0.2.2.3-4076\entropy-0.2.2.3\dist\setup\Main.o )
Linking C:\Users\josh\AppData\Local\Temp\entropy-0.2.2.3-4076\entropy-0.2.2.3\dist\setup\setup.exe ...
Configuring entropy-0.2.2.3...
Building entropy-0.2.2.3...
Preprocessing library entropy-0.2.2.3...

System\Entropy.hs:22:8:
    Could not find module `System.Posix'
    Use -v to see a list of the files searched for.
Failed to install entropy-0.2.2.3
cabal.exe: Error: some packages failed to install:
entropy-0.2.2.3 failed during the building phase. The exception was:
ExitFailure 1

Setup.hs foils cross-compilation

entropy currently uses a custom Setup.hs to decide whether it can use RDRAND. This means that it cannot be cross-compiled.

From the comments in the cabal file I conclude that it's not possible to make the build-type depend on a flag, is that correct? Having a flag to override this behaviour would help.

Currently the workaround is to locally modify this package (to have build-type: Simple), but that's rather inconvenient.

Linking error "In function `get_rand_bytes': undefined reference to `_rdrand64_step'"

Hi,

I'm trying to compile clientsession and on linking stage I get three errors

Linking dist/dist-sandbox-2803e1ed/build/clientsession-generate/clientsession-generate ...
.../.stackage/sandboxes/ghc-7.8.4/lts-2.14/lib/x86_64-linux-ghc-7.8.4/entropy-0.3.6/libHSentropy-0.3.6.a(rdrand.o): In function `get_rand_bytes':
(.text+0x6c): undefined reference to `_rdrand64_step'
.../.stackage/sandboxes/ghc-7.8.4/lts-2.14/lib/x86_64-linux-ghc-7.8.4/entropy-0.3.6/libHSentropy-0.3.6.a(rdrand.o): In function `get_rand_bytes':
(.text+0xba): undefined reference to `_rdrand64_step'
.../.stackage/sandboxes/ghc-7.8.4/lts-2.14/lib/x86_64-linux-ghc-7.8.4/entropy-0.3.6/libHSentropy-0.3.6.a(rdrand.o): In function `get_rand_bytes':
(.text+0xee): undefined reference to `_rdrand64_step'

I'm on Arch and using LTS 2.14 config, GHC 7.8.4.

Am I missing a library?

Best regards,

vlatko

Fails to compile with GHC 7.0.4 and GHC 7.2.2

This is quite a problem since entropy by being so popular is contained in quite a few build-dependencies, and running into a compile failure breaks the cabal solver by not allowing it to backtrack to other versions.

If support for GHC 7.0/7.2 is effectively terminated, please add a base >= 4.5 constraint to future releases, so the cabal solver at least knows it should try something else.

Entropy doesn't build on Mac OS

Entropy fails to build on Mac OS with the following error messages:

cbits/rdrand.c:18:0: no such instruction: `rdrand %rdx'

cbits/rdrand.c:18:0: no such instruction: `rdrand %rdx'

cbits/rdrand.c:18:0: no such instruction: `rdrand %r8'

cbits/rdrand.c:18:0: no such instruction: `rdrand %rdx'

Probably due to old binutils maybe the same fix mentioned here can be employed.

vincenthz/hs-crypto-random#1 (reference)

Fails to install on CentOS 6.4

I'm having trouble installing entropy on my system.
CentOS 6.4
GHC 7.0.4
Cabal 1.10.2.0

$ cabal install entropy
Resolving dependencies...
[1 of 1] Compiling Main             ( /tmp/entropy-0.2.2.13544/entropy-0.2.2.1/Setup.hs, /tmp/entropy-0.2.2.13544/entropy-0.2.2.1/dist/setup/Main.o )

/tmp/entropy-0.2.2.13544/entropy-0.2.2.1/Setup.hs:52:15:
    Not in scope: `rawSystemExitCode'
cabal: Error: some packages failed to install:
entropy-0.2.2.1 failed during the configure step. The exception was:
ExitFailure 1

Any ideas?

Entropy source on *BSDs

As far as I understand the situation on unix platforms are

  1. On Linux it uses GetRandom
  2. On any other UNix it uses /dev/random

On atleast two BSD's (openbsd and netbsd) the ar4random is considered better. Would you be willing to take pull request for these sources based on the os matching

System.Posix.IO vs System.IO

I noticed that in System/EntropyNix.hs you are using the I/O functions from System.Posix.IO instead of the ones from System.IO. Is there a reason for that? The disadvantage of this approach is that e.g. fdReadBuf is implemented using a safe foreign import which has significant overhead compared to hGetBuf from System.IO which should be faster.

An additional small benefit is that by using System.IO you can get rid of the unix dependency.

RFC: a backend-only version

Hi, while I appreciate the need for a truly platform-independent source of cryptographic entropy, the JS dependencies are very heavy.

Would you be open to a smaller, upstream package called say entropy-backend that provides the Unix and Windows stuff, imported by this one which then will provide the JS interface and reexport the other ones too?

RDRAND

Hi Tom,

Are you sure that xoring with RDRAND is a good idea? As far as I know, the system entropy sources use it anyway (in a safe manner) if it's available. Also, there are concerns about its security as it's impossible to audit - and it's has been shown that a backdoor could compromise an rng if it's mixed in incorrectly. So, it seems that just XORing it is ineffective at best and dangerous at worst. As an added benefit, if it's left out the library can be pure Haskell with no need for cbits, which is definitely good for a library with crypto applications.

What do you think?

Fails to build with GHC 9.6.2 and the latest hackage index

The package builds if unix package is fixed to 2.8.1.1, but fails with the latest 2.8.2.0.

The error:

Configuring entropy-0.4.1.10...
/var/folders/cb/q9yg95_s3fq47zqp76x254940000gn/T/75294-0.c: checkForInteriorNuls: invalid argument (POSIX filepaths must not contain internal NUL octets.)
Error: cabal: Failed to build entropy-0.4.1.10

build error

Error Info

cbits/random_initialized.c:9:9: error:
     error: macro names must be identifiers
        9 | #ifndef !DO_NOT_USE_GET_ENTROPY
          |         ^
  |
9 | #ifndef !DO_NOT_USE_GET_ENTROPY
  |         ^
cbits/random_initialized.c: In function ‘ensure_pool_initialized’:

cbits/random_initialized.c:51:9: error:
     error: macro names must be identifiers
       51 | #ifndef !DO_NOT_USE_GET_ENTROPY
          |         ^
   |
51 | #ifndef !DO_NOT_USE_GET_ENTROPY
   |         ^
`gcc' failed in phase `C Compiler'. (Exit code: 1)

Env

  • ghc: 8.10.7
  • os: ubuntu 20.04
  • gcc: 10.3.0

Fails to install with Cabal 1.17

hi,

In Cabal 1.17, withTempDirectory got an extra Bool argument, specifying whether to keep the temp files. This makes Setup.hs fail to compile.

I think it can be solved with MIN_VERSION_Cabal(1,17,0) ifdefs, though i'm not 100% sure it works for setup scripts.

Building entropy-0.2.1 fails on GHC 9.6.1 on Windows

Found this issue while building another library that depends on entropy - it happened on Github Actions CI. Since the build log will eventually expire, I am attaching the log as a file here.

2023-04-04T23:39:02.4359048Z Failed to build entropy-0.2.1.
2023-04-04T23:39:02.4359376Z Build log (
2023-04-04T23:39:02.4359996Z C:\cabal\logs\ghc-9.6.1\entropy-0.2.1-b24970d9aa06391a645531c8a396570de86a0664.log
2023-04-04T23:39:02.4360341Z ):
2023-04-04T23:39:02.4361311Z Preprocessing library for entropy-0.2.1..
2023-04-04T23:39:02.4361967Z Building library for entropy-0.2.1..
2023-04-04T23:39:02.4362188Z 
2023-04-04T23:39:02.4371024Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4371827Z 
2023-04-04T23:39:02.4372400Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:9:0: error:
2023-04-04T23:39:02.4372701Z     
2023-04-04T23:39:02.4372809Z 
2023-04-04T23:39:02.4373253Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\_mingw.h:276:2: error:
2023-04-04T23:39:02.4373721Z      error: Only Win32 target is supported!
2023-04-04T23:39:02.4374060Z     |
2023-04-04T23:39:02.4374400Z 276 | #error Only Win32 target is supported!
2023-04-04T23:39:02.4374716Z     |  ^
2023-04-04T23:39:02.4375042Z #error Only Win32 target is supported!
2023-04-04T23:39:02.4375328Z  ^
2023-04-04T23:39:02.4375532Z 
2023-04-04T23:39:02.4376734Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4377013Z 
2023-04-04T23:39:02.4377510Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:9:0: error:
2023-04-04T23:39:02.4377859Z     
2023-04-04T23:39:02.4378028Z 
2023-04-04T23:39:02.4378419Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\_mingw.h:287:0: error:
2023-04-04T23:39:02.4378751Z     
2023-04-04T23:39:02.4378903Z 
2023-04-04T23:39:02.4379255Z In file included f
[build.log](https://github.com/haskell/entropy/files/11154139/build.log)
rom C:\tools\ghc-9.6.1\mingw\lib\clang\14.0.6\include\vadefs.h:12:0: error:
2023-04-04T23:39:02.4379580Z     
2023-04-04T23:39:02.4379731Z 
2023-04-04T23:39:02.4380056Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\vadefs.h:35:2: error:
2023-04-04T23:39:02.4380444Z      error: VARARGS not implemented for this compiler
2023-04-04T23:39:02.4380718Z    |
2023-04-04T23:39:02.4381077Z 35 | #error VARARGS not implemented for this compiler
2023-04-04T23:39:02.4381471Z    |  ^
2023-04-04T23:39:02.4381757Z #error VARARGS not implemented for this compiler
2023-04-04T23:39:02.4381984Z  ^
2023-04-04T23:39:02.4382089Z 
2023-04-04T23:39:02.4382367Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4382638Z 
2023-04-04T23:39:02.4383098Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:10:0: error:
2023-04-04T23:39:02.4383389Z     
2023-04-04T23:39:02.4383601Z 
2023-04-04T23:39:02.4384004Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:213:13: error:
2023-04-04T23:39:02.4384520Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4384886Z     |
2023-04-04T23:39:02.4385205Z 213 | #if ((OSVER(NTDDI_VERSION) == NTDDI_WIN2K) && (_WIN32_WINNT != _WIN32_WINNT_WIN2K)) || \
2023-04-04T23:39:02.4385561Z     |             ^
2023-04-04T23:39:02.4386212Z #if ((OSVER(NTDDI_VERSION) == NTDDI_WIN2K) && (_WIN32_WINNT != _WIN32_WINNT_WIN2K)) || \
2023-04-04T23:39:02.4386591Z             ^~~~~~~~~~~~~
2023-04-04T23:39:02.4386807Z 
2023-04-04T23:39:02.4387231Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4387650Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4387882Z     |
2023-04-04T23:39:02.4388256Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4388657Z     |                       ^
2023-04-04T23:39:02.4389015Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4389410Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4389650Z 
2023-04-04T23:39:02.4390042Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4390583Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4390924Z     |
2023-04-04T23:39:02.4391251Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4391564Z     |                                                 ^
2023-04-04T23:39:02.4391984Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4393294Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4393692Z 
2023-04-04T23:39:02.4394083Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4394536Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4394784Z     |
2023-04-04T23:39:02.4395065Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4395366Z     |                                                         ^
2023-04-04T23:39:02.4395667Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4395965Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4396101Z 
2023-04-04T23:39:02.4396383Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:156:26: error:
2023-04-04T23:39:02.4396745Z      note: expanded from macro 'OSVER'
2023-04-04T23:39:02.4396963Z     |
2023-04-04T23:39:02.4397209Z 156 | #define OSVER(Version) ((Version) & OSVERSION_MASK)
2023-04-04T23:39:02.4397467Z     |                          ^
2023-04-04T23:39:02.4397952Z #define OSVER(Version) ((Version) & OSVERSION_MASK)
2023-04-04T23:39:02.4398304Z                          ^~~~~~~
2023-04-04T23:39:02.4398523Z 
2023-04-04T23:39:02.4398849Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4399024Z 
2023-04-04T23:39:02.4399474Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:69:0: error:
2023-04-04T23:39:02.4399869Z     
2023-04-04T23:39:02.4400072Z 
2023-04-04T23:39:02.4400485Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\windef.h:9:0: error:
2023-04-04T23:39:02.4400877Z     
2023-04-04T23:39:02.4401083Z 
2023-04-04T23:39:02.4401516Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\minwindef.h:163:0: error:
2023-04-04T23:39:02.4401812Z     
2023-04-04T23:39:02.4402018Z 
2023-04-04T23:39:02.4402379Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winnt.h:137:2: error:
2023-04-04T23:39:02.4402720Z      error: No supported target architecture.
2023-04-04T23:39:02.4403040Z     |
2023-04-04T23:39:02.4403376Z 137 | #error No supported target architecture.
2023-04-04T23:39:02.4403695Z     |  ^
2023-04-04T23:39:02.4404021Z #error No supported target architecture.
2023-04-04T23:39:02.4404335Z  ^
2023-04-04T23:39:02.4404529Z 
2023-04-04T23:39:02.4404886Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winnt.h:4059:5: error:
2023-04-04T23:39:02.4405390Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4406502Z      |
2023-04-04T23:39:02.4406879Z 4059 | #if NTDDI_VERSION >= 0x06000000
2023-04-04T23:39:02.4407177Z      |     ^
2023-04-04T23:39:02.4407491Z #if NTDDI_VERSION >= 0x06000000
2023-04-04T23:39:02.4407801Z     ^~~~~~~~~~~~~
2023-04-04T23:39:02.4408013Z 
2023-04-04T23:39:02.4408428Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4408949Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4409271Z     |
2023-04-04T23:39:02.4409645Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4410007Z     |                       ^
2023-04-04T23:39:02.4410382Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4411166Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4411415Z 
2023-04-04T23:39:02.4411873Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4412438Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4412817Z     |
2023-04-04T23:39:02.4413311Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4413743Z     |                                                 ^
2023-04-04T23:39:02.4414394Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4414847Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4415067Z 
2023-04-04T23:39:02.4415443Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4416104Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4416508Z     |
2023-04-04T23:39:02.4416919Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4417374Z     |                                                         ^
2023-04-04T23:39:02.4417780Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4418212Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4418465Z 
2023-04-04T23:39:02.4418988Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4419204Z 
2023-04-04T23:39:02.4419570Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:69:0: error:
2023-04-04T23:39:02.4419906Z     
2023-04-04T23:39:02.4419994Z 
2023-04-04T23:39:02.4420341Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\windef.h:9:0: error:
2023-04-04T23:39:02.4420672Z     
2023-04-04T23:39:02.4420807Z 
2023-04-04T23:39:02.4421164Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\minwindef.h:163:0: error:
2023-04-04T23:39:02.4421505Z     
2023-04-04T23:39:02.4421631Z 
2023-04-04T23:39:02.4421929Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winnt.h:4085:5: error:
2023-04-04T23:39:02.4422377Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4422708Z      |
2023-04-04T23:39:02.4422969Z 4085 | #if NTDDI_VERSION >= 0x06000000
2023-04-04T23:39:02.4423224Z      |     ^
2023-04-04T23:39:02.4423477Z #if NTDDI_VERSION >= 0x06000000
2023-04-04T23:39:02.4423693Z     ^~~~~~~~~~~~~
2023-04-04T23:39:02.4423865Z 
2023-04-04T23:39:02.4424166Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4424611Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4424871Z     |
2023-04-04T23:39:02.4425191Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4425586Z     |                       ^
2023-04-04T23:39:02.4425878Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4426217Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4426556Z 
2023-04-04T23:39:02.4426881Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4427367Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4427651Z     |
2023-04-04T23:39:02.4428220Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4428700Z     |                                                 ^
2023-04-04T23:39:02.4429197Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4429692Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4430071Z 
2023-04-04T23:39:02.4430511Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4430998Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4431410Z     |
2023-04-04T23:39:02.4431835Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4432274Z     |                                                         ^
2023-04-04T23:39:02.4432717Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4433178Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4433586Z 
2023-04-04T23:39:02.4433909Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4434138Z 
2023-04-04T23:39:02.4434618Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:69:0: error:
2023-04-04T23:39:02.4435074Z     
2023-04-04T23:39:02.4435316Z 
2023-04-04T23:39:02.4435774Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\windef.h:9:0: error:
2023-04-04T23:39:02.4436114Z     
2023-04-04T23:39:02.4436345Z 
2023-04-04T23:39:02.4436815Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\minwindef.h:163:0: error:
2023-04-04T23:39:02.4437164Z     
2023-04-04T23:39:02.4437407Z 
2023-04-04T23:39:02.4437830Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winnt.h:5189:6: error:
2023-04-04T23:39:02.4438281Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4438694Z      |
2023-04-04T23:39:02.4439064Z 5189 | #if (NTDDI_VERSION >= NTDDI_WIN7)
2023-04-04T23:39:02.4439395Z      |      ^
2023-04-04T23:39:02.4439759Z #if (NTDDI_VERSION >= NTDDI_WIN7)
2023-04-04T23:39:02.4440114Z      ^~~~~~~~~~~~~
2023-04-04T23:39:02.4440345Z 
2023-04-04T23:39:02.4440777Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4441370Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4441740Z     |
2023-04-04T23:39:02.4442178Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4442596Z     |                       ^
2023-04-04T23:39:02.4443047Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4443484Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4443771Z 
2023-04-04T23:39:02.4445115Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4445714Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4598591Z     |
2023-04-04T23:39:02.4599318Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4599703Z     |                                                 ^
2023-04-04T23:39:02.4600057Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4600437Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4600633Z 
2023-04-04T23:39:02.4601157Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4603935Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4604265Z     |
2023-04-04T23:39:02.4604614Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4604983Z     |                                                         ^
2023-04-04T23:39:02.4605360Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4605713Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4605908Z 
2023-04-04T23:39:02.4606194Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4606431Z 
2023-04-04T23:39:02.4606849Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:70:0: error:
2023-04-04T23:39:02.4608423Z     
2023-04-04T23:39:02.4608607Z 
2023-04-04T23:39:02.4609636Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winbase.h:13:0: error:
2023-04-04T23:39:02.4610045Z     
2023-04-04T23:39:02.4610231Z 
2023-04-04T23:39:02.4610600Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\minwinbase.h:110:5: error:
2023-04-04T23:39:02.4611080Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4611422Z     |
2023-04-04T23:39:02.4611679Z 110 | #if NTDDI_VERSION >= 0x0A000005
2023-04-04T23:39:02.4612208Z     |     ^
2023-04-04T23:39:02.4612493Z #if NTDDI_VERSION >= 0x0A000005
2023-04-04T23:39:02.4612917Z     ^~~~~~~~~~~~~
2023-04-04T23:39:02.4613145Z 
2023-04-04T23:39:02.4613568Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4614101Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4614447Z     |
2023-04-04T23:39:02.4614839Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4615228Z     |                       ^
2023-04-04T23:39:02.4615621Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4616036Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4616278Z 
2023-04-04T23:39:02.4616659Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4617221Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4617566Z     |
2023-04-04T23:39:02.4617868Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4618211Z     |                                                 ^
2023-04-04T23:39:02.4618511Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4618926Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4619163Z 
2023-04-04T23:39:02.4619558Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4620070Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4620383Z     |
2023-04-04T23:39:02.4620729Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4621084Z     |                                                         ^
2023-04-04T23:39:02.4621444Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4621845Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4622056Z 
2023-04-04T23:39:02.4622325Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4622480Z 
2023-04-04T23:39:02.4622908Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:70:0: error:
2023-04-04T23:39:02.4623283Z     
2023-04-04T23:39:02.4623394Z 
2023-04-04T23:39:02.4623705Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winbase.h:13:0: error:
2023-04-04T23:39:02.4623965Z     
2023-04-04T23:39:02.4624151Z 
2023-04-04T23:39:02.4624665Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\minwinbase.h:123:5: error:
2023-04-04T23:39:02.4625170Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4625504Z     |
2023-04-04T23:39:02.4625795Z 123 | #if NTDDI_VERSION >= 0x0A000004
2023-04-04T23:39:02.4626088Z     |     ^
2023-04-04T23:39:02.4626367Z #if NTDDI_VERSION >= 0x0A000004
2023-04-04T23:39:02.4626648Z     ^~~~~~~~~~~~~
2023-04-04T23:39:02.4626844Z 
2023-04-04T23:39:02.4627205Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4627574Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4627871Z     |
2023-04-04T23:39:02.4628211Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4628548Z     |                       ^
2023-04-04T23:39:02.4628897Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4629268Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4629484Z 
2023-04-04T23:39:02.4629846Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4630348Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4630657Z     |
2023-04-04T23:39:02.4632266Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4632682Z     |                                                 ^
2023-04-04T23:39:02.4633084Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4634117Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4634358Z 
2023-04-04T23:39:02.4634835Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4635330Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4635623Z     |
2023-04-04T23:39:02.4635924Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4636247Z     |                                                         ^
2023-04-04T23:39:02.4636564Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4636884Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4637052Z 
2023-04-04T23:39:02.4637277Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4637483Z 
2023-04-04T23:39:02.4637852Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:70:0: error:
2023-04-04T23:39:02.4638175Z     
2023-04-04T23:39:02.4638316Z 
2023-04-04T23:39:02.4638655Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winbase.h:22:0: error:
2023-04-04T23:39:02.4638965Z     
2023-04-04T23:39:02.4639069Z 
2023-04-04T23:39:02.4639385Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\interlockedapi.h:24:5: error:
2023-04-04T23:39:02.4639936Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4640299Z    |
2023-04-04T23:39:02.4640519Z 24 | #if NTDDI_VERSION >= 0x06020000
2023-04-04T23:39:02.4640804Z    |     ^
2023-04-04T23:39:02.4641018Z #if NTDDI_VERSION >= 0x06020000
2023-04-04T23:39:02.4641307Z     ^~~~~~~~~~~~~
2023-04-04T23:39:02.4641428Z 
2023-04-04T23:39:02.4641717Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4642201Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4642493Z     |
2023-04-04T23:39:02.4642770Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4643019Z     |                       ^
2023-04-04T23:39:02.4643283Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4643654Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4644076Z 
2023-04-04T23:39:02.4644467Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4645001Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4645310Z     |
2023-04-04T23:39:02.4645628Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4645935Z     |                                                 ^
2023-04-04T23:39:02.4646342Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4646754Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4646987Z 
2023-04-04T23:39:02.4647402Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4647806Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4648023Z     |
2023-04-04T23:39:02.4648373Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4648748Z     |                                                         ^
2023-04-04T23:39:02.4649122Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4649488Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4650424Z 
2023-04-04T23:39:02.4650701Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4650878Z 
2023-04-04T23:39:02.4651331Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:70:0: error:
2023-04-04T23:39:02.4651715Z     
2023-04-04T23:39:02.4651836Z 
2023-04-04T23:39:02.4652156Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winbase.h:24:0: error:
2023-04-04T23:39:02.4652434Z     
2023-04-04T23:39:02.4652536Z 
2023-04-04T23:39:02.4652934Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\libloaderapi.h:72:6: error:
2023-04-04T23:39:02.4653443Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4653793Z    |
2023-04-04T23:39:02.4654027Z 72 | #if (NTDDI_VERSION >= NTDDI_WIN10_RS1)
2023-04-04T23:39:02.4654234Z    |      ^
2023-04-04T23:39:02.4654452Z #if (NTDDI_VERSION >= NTDDI_WIN10_RS1)
2023-04-04T23:39:02.4654764Z      ^~~~~~~~~~~~~
2023-04-04T23:39:02.4654889Z 
2023-04-04T23:39:02.4655189Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4655680Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4655989Z     |
2023-04-04T23:39:02.4656267Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4656528Z     |                       ^
2023-04-04T23:39:02.4656890Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4657269Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4657496Z 
2023-04-04T23:39:02.4657895Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4658318Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4658651Z     |
2023-04-04T23:39:02.4658963Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4659312Z     |                                                 ^
2023-04-04T23:39:02.4659732Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4660167Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4660401Z 
2023-04-04T23:39:02.4660813Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4661237Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4661574Z     |
2023-04-04T23:39:02.4661985Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4662380Z     |                                                         ^
2023-04-04T23:39:02.4663323Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4663684Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4663887Z 
2023-04-04T23:39:02.4664115Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4664331Z 
2023-04-04T23:39:02.4664804Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:70:0: error:
2023-04-04T23:39:02.4665141Z     
2023-04-04T23:39:02.4665290Z 
2023-04-04T23:39:02.4665644Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winbase.h:24:0: error:
2023-04-04T23:39:02.4665965Z     
2023-04-04T23:39:02.4666117Z 
2023-04-04T23:39:02.4666495Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\libloaderapi.h:79:6: error:
2023-04-04T23:39:02.4666978Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4667285Z    |
2023-04-04T23:39:02.4667537Z 79 | #if (NTDDI_VERSION >= NTDDI_WIN10_RS2)
2023-04-04T23:39:02.4667791Z    |      ^
2023-04-04T23:39:02.4668050Z #if (NTDDI_VERSION >= NTDDI_WIN10_RS2)
2023-04-04T23:39:02.4668303Z      ^~~~~~~~~~~~~
2023-04-04T23:39:02.4669226Z 
2023-04-04T23:39:02.4669659Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4670053Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4670379Z     |
2023-04-04T23:39:02.4670743Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4671101Z     |                       ^
2023-04-04T23:39:02.4671468Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4671847Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4672073Z 
2023-04-04T23:39:02.4672465Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4672898Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4673132Z     |
2023-04-04T23:39:02.4673419Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4673835Z     |                                                 ^
2023-04-04T23:39:02.4674246Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4674660Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4674892Z 
2023-04-04T23:39:02.4675252Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4675778Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4676102Z     |
2023-04-04T23:39:02.4676454Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4676822Z     |                                                         ^
2023-04-04T23:39:02.4677195Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4677559Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4677810Z 
2023-04-04T23:39:02.4678069Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4678223Z 
2023-04-04T23:39:02.4678691Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:70:0: error:
2023-04-04T23:39:02.4679073Z     
2023-04-04T23:39:02.4679264Z 
2023-04-04T23:39:02.4679639Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winbase.h:25:0: error:
2023-04-04T23:39:02.4679902Z     
2023-04-04T23:39:02.4680101Z 
2023-04-04T23:39:02.4680460Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\memoryapi.h:61:5: error:
2023-04-04T23:39:02.4680989Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4681251Z    |
2023-04-04T23:39:02.4681461Z 61 | #if NTDDI_VERSION >= NTDDI_WIN10_RS4
2023-04-04T23:39:02.4681665Z    |     ^
2023-04-04T23:39:02.4681879Z #if NTDDI_VERSION >= NTDDI_WIN10_RS4
2023-04-04T23:39:02.4682208Z     ^~~~~~~~~~~~~
2023-04-04T23:39:02.4682328Z 
2023-04-04T23:39:02.4682742Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4683236Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4683552Z     |
2023-04-04T23:39:02.4683906Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4684259Z     |                       ^
2023-04-04T23:39:02.4684618Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4684990Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4685213Z 
2023-04-04T23:39:02.4685565Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4686092Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4686405Z     |
2023-04-04T23:39:02.4686793Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4687208Z     |                                                 ^
2023-04-04T23:39:02.4688313Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4688734Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4688973Z 
2023-04-04T23:39:02.4689357Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4689891Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4690221Z     |
2023-04-04T23:39:02.4690583Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4690975Z     |                                                         ^
2023-04-04T23:39:02.4691353Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4691717Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4691944Z 
2023-04-04T23:39:02.4692196Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4692374Z 
2023-04-04T23:39:02.4692810Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:70:0: error:
2023-04-04T23:39:02.4693187Z     
2023-04-04T23:39:02.4693375Z 
2023-04-04T23:39:02.4694604Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winbase.h:25:0: error:
2023-04-04T23:39:02.4694976Z     
2023-04-04T23:39:02.4695128Z 
2023-04-04T23:39:02.4695483Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\memoryapi.h:128:5: error:
2023-04-04T23:39:02.4695977Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4696297Z     |
2023-04-04T23:39:02.4696561Z 128 | #if NTDDI_VERSION >= NTDDI_WIN10_RS1
2023-04-04T23:39:02.4696812Z     |     ^
2023-04-04T23:39:02.4697071Z #if NTDDI_VERSION >= NTDDI_WIN10_RS1
2023-04-04T23:39:02.4697317Z     ^~~~~~~~~~~~~
2023-04-04T23:39:02.4697471Z 
2023-04-04T23:39:02.4697796Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4698246Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4698504Z     |
2023-04-04T23:39:02.4698811Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4699214Z     |                       ^
2023-04-04T23:39:02.4699568Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4699958Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4700224Z 
2023-04-04T23:39:02.4700617Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4701297Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4701644Z     |
2023-04-04T23:39:02.4701947Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4702346Z     |                                                 ^
2023-04-04T23:39:02.4702760Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4703174Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4703401Z 
2023-04-04T23:39:02.4703801Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4704329Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4705577Z     |
2023-04-04T23:39:02.4705996Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4706325Z     |                                                         ^
2023-04-04T23:39:02.4706651Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4706936Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4707070Z 
2023-04-04T23:39:02.4707257Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4707555Z 
2023-04-04T23:39:02.4707922Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:70:0: error:
2023-04-04T23:39:02.4708217Z     
2023-04-04T23:39:02.4708330Z 
2023-04-04T23:39:02.4708638Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winbase.h:25:0: error:
2023-04-04T23:39:02.4708931Z     
2023-04-04T23:39:02.4709036Z 
2023-04-04T23:39:02.4709319Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\memoryapi.h:156:5: error:
2023-04-04T23:39:02.4709738Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4709990Z     |
2023-04-04T23:39:02.4710215Z 156 | #if NTDDI_VERSION >= NTDDI_WIN10_RS2
2023-04-04T23:39:02.4710429Z     |     ^
2023-04-04T23:39:02.4710647Z #if NTDDI_VERSION >= NTDDI_WIN10_RS2
2023-04-04T23:39:02.4710859Z     ^~~~~~~~~~~~~
2023-04-04T23:39:02.4710975Z 
2023-04-04T23:39:02.4711747Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4712226Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4712436Z     |
2023-04-04T23:39:02.4712700Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4712961Z     |                       ^
2023-04-04T23:39:02.4713214Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4713505Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4713641Z 
2023-04-04T23:39:02.4713922Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4714349Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4714581Z     |
2023-04-04T23:39:02.4714869Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4715166Z     |                                                 ^
2023-04-04T23:39:02.4715482Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4715799Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4715941Z 
2023-04-04T23:39:02.4716215Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4716625Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4716854Z     |
2023-04-04T23:39:02.4717094Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4717372Z     |                                                         ^
2023-04-04T23:39:02.4718352Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4718640Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4718771Z 
2023-04-04T23:39:02.4718952Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4719120Z 
2023-04-04T23:39:02.4719615Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:70:0: error:
2023-04-04T23:39:02.4719904Z     
2023-04-04T23:39:02.4720006Z 
2023-04-04T23:39:02.4720307Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winbase.h:25:0: error:
2023-04-04T23:39:02.4720585Z     
2023-04-04T23:39:02.4720690Z 
2023-04-04T23:39:02.4720964Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\memoryapi.h:161:5: error:
2023-04-04T23:39:02.4721354Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4721607Z     |
2023-04-04T23:39:02.4721823Z 161 | #if NTDDI_VERSION >= NTDDI_WIN10_RS4
2023-04-04T23:39:02.4722014Z     |     ^
2023-04-04T23:39:02.4722224Z #if NTDDI_VERSION >= NTDDI_WIN10_RS4
2023-04-04T23:39:02.4722429Z     ^~~~~~~~~~~~~
2023-04-04T23:39:02.4722540Z 
2023-04-04T23:39:02.4722936Z Error: cabal.exe: Failed to build entropy-0.2.1 (which is required by
2023-04-04T23:39:02.4723524Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4724139Z wreq-0.5.3.3). See the build log above for details.
2023-04-04T23:39:02.4724471Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4724714Z 
2023-04-04T23:39:02.4724779Z     |
2023-04-04T23:39:02.4725123Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4725430Z     |                       ^
2023-04-04T23:39:02.4725749Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4726080Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4726266Z 
2023-04-04T23:39:02.4726593Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4727070Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4727345Z     |
2023-04-04T23:39:02.4727682Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4728039Z     |                                                 ^
2023-04-04T23:39:02.4728397Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4728760Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4728953Z 
2023-04-04T23:39:02.4729272Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4729731Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4730007Z     |
2023-04-04T23:39:02.4730304Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4730714Z     |                                                         ^
2023-04-04T23:39:02.4731049Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4731374Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4736302Z 
2023-04-04T23:39:02.4736856Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4737112Z 
2023-04-04T23:39:02.4737604Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:70:0: error:
2023-04-04T23:39:02.4738574Z     
2023-04-04T23:39:02.4739070Z 
2023-04-04T23:39:02.4739572Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winbase.h:25:0: error:
2023-04-04T23:39:02.4739928Z     
2023-04-04T23:39:02.4740077Z 
2023-04-04T23:39:02.4740421Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\memoryapi.h:166:5: error:
2023-04-04T23:39:02.4741056Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4741371Z     |
2023-04-04T23:39:02.4741647Z 166 | #if NTDDI_VERSION >= NTDDI_WIN10_RS5
2023-04-04T23:39:02.4741904Z     |     ^
2023-04-04T23:39:02.4742176Z #if NTDDI_VERSION >= NTDDI_WIN10_RS5
2023-04-04T23:39:02.4742443Z     ^~~~~~~~~~~~~
2023-04-04T23:39:02.4742599Z 
2023-04-04T23:39:02.4742933Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4743378Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4743635Z     |
2023-04-04T23:39:02.4743943Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4744244Z     |                       ^
2023-04-04T23:39:02.4744563Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4744895Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4745073Z 
2023-04-04T23:39:02.4745398Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4746070Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4746390Z     |
2023-04-04T23:39:02.4746724Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4747213Z     |                                                 ^
2023-04-04T23:39:02.4747576Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4747954Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4748142Z 
2023-04-04T23:39:02.4748819Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4749469Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4750961Z     |
2023-04-04T23:39:02.4751299Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4751679Z     |                                                         ^
2023-04-04T23:39:02.4752008Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4752328Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4752510Z 
2023-04-04T23:39:02.4752737Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4752951Z 
2023-04-04T23:39:02.4753346Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:70:0: error:
2023-04-04T23:39:02.4753685Z     
2023-04-04T23:39:02.4753833Z 
2023-04-04T23:39:02.4754181Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winbase.h:29:0: error:
2023-04-04T23:39:02.4754505Z     
2023-04-04T23:39:02.4754673Z 
2023-04-04T23:39:02.4755022Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\processthreadsapi.h:297:5: error:
2023-04-04T23:39:02.4755490Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4755791Z     |
2023-04-04T23:39:02.4756046Z 297 | #if NTDDI_VERSION >= NTDDI_WIN10_VB
2023-04-04T23:39:02.4756294Z     |     ^
2023-04-04T23:39:02.4756551Z #if NTDDI_VERSION >= NTDDI_WIN10_VB
2023-04-04T23:39:02.4756800Z     ^~~~~~~~~~~~~
2023-04-04T23:39:02.4756962Z 
2023-04-04T23:39:02.4757296Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4757729Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4757987Z     |
2023-04-04T23:39:02.4758297Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4758587Z     |                       ^
2023-04-04T23:39:02.4758903Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4759553Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4759734Z 
2023-04-04T23:39:02.4760197Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4760682Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4760960Z     |
2023-04-04T23:39:02.4761301Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4761656Z     |                                                 ^
2023-04-04T23:39:02.4762015Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4762383Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4762569Z 
2023-04-04T23:39:02.4762888Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4763351Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4763631Z     |
2023-04-04T23:39:02.4763934Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4764268Z     |                                                         ^
2023-04-04T23:39:02.4764596Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4764912Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4765092Z 
2023-04-04T23:39:02.4765442Z In file included from .\System\Entropy.hs:26:0: error: 
2023-04-04T23:39:02.4765660Z 
2023-04-04T23:39:02.4766038Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\Windows.h:70:0: error:
2023-04-04T23:39:02.4766413Z     
2023-04-04T23:39:02.4766569Z 
2023-04-04T23:39:02.4766919Z In file included from C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\winbase.h:29:0: error:
2023-04-04T23:39:02.4767241Z     
2023-04-04T23:39:02.4767390Z 
2023-04-04T23:39:02.4767740Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\processthreadsapi.h:300:5: error:
2023-04-04T23:39:02.4768223Z      error: token is not a valid binary operator in a preprocessor subexpression
2023-04-04T23:39:02.4768527Z     |
2023-04-04T23:39:02.4768785Z 300 | #if NTDDI_VERSION >= NTDDI_WIN10_MN
2023-04-04T23:39:02.4769032Z     |     ^
2023-04-04T23:39:02.4769286Z #if NTDDI_VERSION >= NTDDI_WIN10_MN
2023-04-04T23:39:02.4769522Z     ^~~~~~~~~~~~~
2023-04-04T23:39:02.4769700Z 
2023-04-04T23:39:02.4770022Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:172:23: error:
2023-04-04T23:39:02.4770452Z      note: expanded from macro 'NTDDI_VERSION'
2023-04-04T23:39:02.4770711Z     |
2023-04-04T23:39:02.4771012Z 172 | #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4771312Z     |                       ^
2023-04-04T23:39:02.4771628Z #define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
2023-04-04T23:39:02.4771956Z                       ^                              ~~~~~~~~~~~~
2023-04-04T23:39:02.4772135Z 
2023-04-04T23:39:02.4772457Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:162:49: error:
2023-04-04T23:39:02.4772926Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT'
2023-04-04T23:39:02.4773202Z     |
2023-04-04T23:39:02.4773543Z 162 | #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4773892Z     |                                                 ^
2023-04-04T23:39:02.4774254Z #define NTDDI_VERSION_FROM_WIN32_WINNT(Version) NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
2023-04-04T23:39:02.4774623Z                                                 ^                               ~~~~~~~
2023-04-04T23:39:02.4774811Z 
2023-04-04T23:39:02.4775132Z C:\tools\ghc-9.6.1\lib\..\mingw\x86_64-w64-mingw32\include\sdkddkver.h:161:57: error:
2023-04-04T23:39:02.4775597Z      note: expanded from macro 'NTDDI_VERSION_FROM_WIN32_WINNT2'
2023-04-04T23:39:02.4775877Z     |
2023-04-04T23:39:02.4776179Z 161 | #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4776590Z     |                                                         ^
2023-04-04T23:39:02.4776928Z #define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
2023-04-04T23:39:02.4777235Z                                                  ~~~~~~~^
2023-04-04T23:39:02.4777643Z fatal error: too many errors emitted, stopping now [-ferror-limit=]
2023-04-04T23:39:02.4777969Z 20 errors generated.
2023-04-04T23:39:02.4778137Z 
2023-04-04T23:39:02.4778309Z System\Entropy.hs:1:1: error:
2023-04-04T23:39:02.4798480Z ##[error]    `clang.exe' failed in phase `C pre-processor'. (Exit code: 1)
2023-04-04T23:39:02.4807187Z   |
2023-04-04T23:39:02.4807790Z 1 | {-# LANGUAGE CPP, ForeignFunctionInterface, BangPatterns, ScopedTypeVariables #-}
2023-04-04T23:39:02.4808502Z   | ^
2023-04-04T23:39:02.6506960Z ##[error]Process completed with exit code 1.

getEntropy occasionally producing too few bytes

Sometimes getEntropy produces fewer bytes than requested - the documentation seems to suggest that it should always produces the requested number. (I am using entropy-0.3.3 on Linux (Ubuntu 14.04) and ghc 7.8.3.) The following program:

import Control.Monad (forever, when)
import System.Entropy (getEntropy)
import qualified Data.ByteString as B (length)

main = forever $ do
    bs <- getEntropy 96
    when (B.length bs /= 96) $
        print $ B.length bs

running for about 10 minutes produced the following output for incorrect cases:

10
70
30
70
60
40
20
70
30
60
60

It is interesting that these are all multiples of ten ...

BTW I was doing other things on the machine, though not a high load.

Support GHC 7.4 and 7.6

It seems that entropy no longer builds with GHC 7.4 and 7.6 as seen by this build failure.

https://travis-ci.org/mightybyte/snaplet-postgresql-simple/builds/40128164

The build report says entropy is failing with this error.

entropy-0.3.4 failed during the configure step. The exception was:
user error (The package 'entropy' requires Cabal library version -any &&
>=1.17 but no suitable version is installed.)

Is it possible to get it building with those GHC versions again?

Failed to install entropy-0.3.8 | ArchLinux

Hi Tom, I'm a very newbie user of Haskell and Arch but when I run cabal install entropy-0.3.8 I'm getting this error:

entropy-0.3.8 failed during the configure step. The exception was:
user error ('/usr/bin/ghc' exited with an error:
/usr/bin/ld: cannot find -lHSCabal-1.24.2.0
/usr/bin/ld: cannot find -lHSprocess-1.4.3.0
/usr/bin/ld: cannot find -lHSpretty-1.1.3.3
/usr/bin/ld: cannot find -lHSdirectory-1.3.0.0
/usr/bin/ld: cannot find -lHSunix-2.7.2.1
/usr/bin/ld: cannot find -lHStime-1.6.0.1
/usr/bin/ld: cannot find -lHSfilepath-1.4.1.1
/usr/bin/ld: cannot find -lHSbinary-0.8.3.0
/usr/bin/ld: cannot find -lHScontainers-0.5.7.1
/usr/bin/ld: cannot find -lHSbytestring-0.10.8.1
/usr/bin/ld: cannot find -lHSdeepseq-1.4.2.0
/usr/bin/ld: cannot find -lHSarray-0.5.1.1
/usr/bin/ld: cannot find -lHSbase-4.9.1.0
/usr/bin/ld: cannot find -lHSinteger-gmp-1.0.0.1
/usr/bin/ld: cannot find -lHSghc-prim-0.5.0.0
/usr/bin/ld: cannot find -lHSrts_thr
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
)

I put all the output here https://gist.github.com/rapofran/4348799a64570e9fc047a0e738ecef9c

cabal --version
cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library

gcc --version => gcc (GCC) 7.1.1 20170516
ghc --version => The Glorious Glasgow Haskell Compilation System, version 8.0.2

uname -a
Linux arch-dell 4.9.33-1-MANJARO #1 SMP PREEMPT Sat Jun 17 14:07:44 UTC 2017 x86_64 GNU/Linux

What am I doing wrong? I'm sure there is something missing on my setup

Thanks a lot,
Frank

Build fails with setup segfaults on Mac with M1 processor

I am trying to build the entropy package from source using cabal using ghc-9.2.4

cabal build -v                                                                                                                                        main
this build was affected by the following (project) config files:
Build profile: -w ghc-9.2.4 -O1
In order, the following will be built:
 - entropy-0.4.1.10 (lib:entropy) (first run)
creating …/entropy/dist-newstyle/build
creating …/entropy/dist-newstyle/tmp
creating .../entropy/dist-newstyle/build/aarch64-osx/ghc-9.2.4/entropy-0.4.1.10
creating .../entropy/dist-newstyle/build/aarch64-osx/ghc-9.2.4/entropy-0.4.1.10/cache
creating .../entropy/dist-newstyle/build/aarch64-osx/ghc-9.2.4/entropy-0.4.1.10/setup
~/.ghcup/bin/ghc --make -fbuilding-cabal-package -odir .../entropy/dist-newstyle/build/aarch64-osx/ghc-9.2.4/entropy-0.4.1.10/setup -hidir .../entropy/dist-newstyle/build/aarch64-osx/ghc-9.2.4/entropy-0.4.1.10/setup -i -i.../entropy/. -optP-include -optP.../entropy/dist-newstyle/build/aarch64-osx/ghc-9.2.4/entropy-0.4.1.10/setup/setup_macros.h -hide-all-packages -no-user-package-db -package-db ~/.cabal/store/ghc-9.2.4/package.db -package-db .../entropy/dist-newstyle/packagedb/ghc-9.2.4 -package-id Cabal-3.6.3.0 -package-id base-4.16.3.0 -package-id directory-1.3.6.2 -package-id filepath-1.4.2.2 -package-id process-1.6.13.2 .../entropy/dist-newstyle/build/aarch64-osx/ghc-9.2.4/entropy-0.4.1.10/setup/setup.hs -o .../entropy/dist-newstyle/build/aarch64-osx/ghc-9.2.4/entropy-0.4.1.10/setup/setup -threaded
…/entropy/dist-newstyle/build/aarch64-osx/ghc-9.2.4/entropy-0.4.1.10/setup/setup
configure --verbose=2
--builddir=.../entropy/dist-newstyle/build/aarch64-osx/ghc-9.2.4/entropy-0.4.1.10
--ghc --prefix=~/.cabal --bindir=/Users/andrew/.cabal/bin
--libdir=~/.cabal/lib/aarch64-osx-ghc-9.2.4/entropy-0.4.1.10-inplace
--libsubdir= --dynlibdir=~/.cabal/lib/aarch64-osx-ghc-9.2.4
--libexecdir=~/.cabal/libexec/aarch64-osx-ghc-9.2.4/entropy-0.4.1.10
--libexecsubdir=
--datadir=~/.cabal/share/aarch64-osx-ghc-9.2.4/entropy-0.4.1.10
--datasubdir=
--docdir=~/.cabal/share/doc/aarch64-osx-ghc-9.2.4/entropy-0.4.1.10
--htmldir=~/.cabal/share/doc/aarch64-osx-ghc-9.2.4/entropy-0.4.1.10/html
--haddockdir=~/.cabal/share/doc/aarch64-osx-ghc-9.2.4/entropy-0.4.1.10/html
--sysconfdir=~/.cabal/etc --enable-library-vanilla
--disable-library-profiling --enable-shared --disable-static
--disable-executable-dynamic --disable-executable-static --disable-profiling
--profiling-detail=default --library-profiling-detail=default
--enable-optimization --disable-debug-info --disable-library-for-ghci
--disable-split-sections --disable-split-objs --disable-executable-stripping
--disable-library-stripping --package-db=clear --package-db=global
--package-db=~/.cabal/store/ghc-9.2.4/package.db
--package-db=.../entropy/dist-newstyle/packagedb/ghc-9.2.4
--flags=-donotgetentropy --ipid=entropy-0.4.1.10-inplace
--extra-prog-path=/Users/andrew/.cabal/bin --dependency=base=base-4.16.3.0
--dependency=bytestring=bytestring-0.11.3.1 --dependency=unix=unix-2.7.2.2
--disable-tests --disable-coverage --exact-configuration --disable-benchmarks
--with-ghc=/Users/andrew/.ghcup/bin/ghc
--with-ghc-pkg=~/.ghcup/ghc/9.2.4/bin/ghc-pkg-9.2.4
--ghc-option=-hide-all-packages

N.B. (I shortended the path in the log for clarity)
The actual problem is the setup binary, that segfaults:

.../entropy/dist-newstyle/build/aarch64-osx/ghc-9.2.4/entropy-0.4.1.10/setup/setup configure --verbose=2                      main
[1]    93317 segmentation fault   configure --verbose=2

Anything I can do to debug this?

Thanks

Support GHC-9.2.1

This needs changes:

diff --git a/Setup.hs b/Setup.hs
index 8bdde6a..15bdf62 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -27,10 +27,10 @@ main = defaultMainWithHooks hk
 compileCheck :: FilePath -> String -> String -> String -> IO Bool
 compileCheck cc testName message sourceCode = do
         withTempDirectory normal "" testName $ \tmpDir -> do
-        writeFile (tmpDir ++ "/" ++ testName ++ ".c") sourceCode
-        ec <- myRawSystemExitCode normal cc [tmpDir </> testName ++ ".c", "-o", tmpDir ++ "/a","-no-hs-main"]
-        notice normal $ message ++ show (ec == ExitSuccess)
-        return (ec == ExitSuccess)
+            writeFile (tmpDir ++ "/" ++ testName ++ ".c") sourceCode
+            ec <- myRawSystemExitCode normal cc [tmpDir </> testName ++ ".c", "-o", tmpDir ++ "/a","-no-hs-main"]
+            notice normal $ message ++ show (ec == ExitSuccess)
+            return (ec == ExitSuccess)
 
 addOptions :: [String] -> [String] -> LocalBuildInfo -> LocalBuildInfo
 addOptions cArgs hsArgs lbi = lbi {withPrograms = newWithPrograms }
@@ -67,26 +67,26 @@ checkGetrandom cc lbi = do
                                 ])
         if libcGetrandom then return $ addOptions cArgsLibc cArgsLibc lbi
         else do
-        syscallGetrandom <- compileCheck cc "testSyscallGetrandom" "Result of syscall getrandom() Test: "
-                (unlines        [ "#define _GNU_SOURCE"
-                                , "#include <errno.h>"
-                                , "#include <unistd.h>"
-                                , "#include <sys/syscall.h>"
-                                , "#include <sys/types.h>"
-                                , "#include <linux/random.h>"
+            syscallGetrandom <- compileCheck cc "testSyscallGetrandom" "Result of syscall getrandom() Test: "
+                    (unlines        [ "#define _GNU_SOURCE"
+                                    , "#include <errno.h>"
+                                    , "#include <unistd.h>"
+                                    , "#include <sys/syscall.h>"
+                                    , "#include <sys/types.h>"
+                                    , "#include <linux/random.h>"
 
-                                , "static ssize_t getrandom(void* buf, size_t buflen, unsigned int flags)"
-                                , "{"
-                                , "    return syscall(SYS_getrandom, buf, buflen, flags);"
-                                , "}"
+                                    , "static ssize_t getrandom(void* buf, size_t buflen, unsigned int flags)"
+                                    , "{"
+                                    , "    return syscall(SYS_getrandom, buf, buflen, flags);"
+                                    , "}"
 
-                                , "int main()"
-                                , "{"
-                                , "    char tmp;"
-                                , "    return getrandom(&tmp, sizeof(tmp), GRND_NONBLOCK) != -1;"
-                                , "}"
-                                ])
-        return $ if syscallGetrandom then addOptions cArgs cArgs lbi else lbi
+                                    , "int main()"
+                                    , "{"
+                                    , "    char tmp;"
+                                    , "    return getrandom(&tmp, sizeof(tmp), GRND_NONBLOCK) != -1;"
+                                    , "}"
+                                    ])
+            return $ if syscallGetrandom then addOptions cArgs cArgs lbi else lbi
   where cArgs = ["-DHAVE_GETRANDOM"]
         cArgsLibc = cArgs ++ ["-DHAVE_LIBC_GETRANDOM"]
 
diff --git a/entropy.cabal b/entropy.cabal
index 2219788..bb0f9b5 100644
--- a/entropy.cabal
+++ b/entropy.cabal
@@ -35,7 +35,7 @@ flag halvm
 
 
 custom-setup
-  setup-depends: Cabal >= 1.10 && < 3.5
+  setup-depends: Cabal >= 1.10 && < 3.7^M
                , base < 5
                , filepath < 1.5
                , directory < 1.4

The indentation is because otherwise GHC-9.2 complains:

% ghc-9.2.1 Setup.hs                
[1 of 1] Compiling Main             ( Setup.hs, Setup.o )

Setup.hs:29:59: error: Empty 'do' block
   |
29 |         withTempDirectory normal "" testName $ \tmpDir -> do
   |                                                           ^^

Setup.hs:69:14: error: Empty 'do' block
   |
69 |         else do
   |              ^^

This is due Setup.hs compiled with "default" language of a compiler. FWIW, previous GHCs weren't Haskell98 nor Haskell2010:

% ghc-9.0.1 -fforce-recomp Setup.hs
[1 of 1] Compiling Main             ( Setup.hs, Setup.o )
Linking Setup ...

% ghc-9.0.1 -fforce-recomp -XHaskell98 Setup.hs
[1 of 1] Compiling Main             ( Setup.hs, Setup.o )

Setup.hs:68:12: error:
    Unexpected semi-colons in conditional:
        if libcGetrandom then return
                                $ addOptions
                                    cArgsLibc cArgsLibc
                                    lbi; else do syscallGetrandom <- compileCheck
                                                                       cc "testSyscallGetrandom"
                                                                       "Result of syscall getrandom() Test: "
                                                                       (unlines
                                                                          ["#define _GNU_SOURCE",
                                                                           "#include <errno.h>",
                                                                           ....])
                                                 return
                                                   $ if syscallGetrandom then
                                                         addOptions cArgs cArgs lbi
                                                     else
                                                         lbi
    Perhaps you meant to use DoAndIfThenElse?
   |
68 |         if libcGetrandom then return $ addOptions cArgsLibc cArgsLibc lbi
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

% ghc-9.0.1 -fforce-recomp -XHaskell2010 Setup.hs
[1 of 1] Compiling Main             ( Setup.hs, Setup.o )

Setup.hs:29:59: error: Empty 'do' block
   |
29 |         withTempDirectory normal "" testName $ \tmpDir -> do
   |                                                           ^^

Setup.hs:69:14: error: Empty 'do' block
   |
69 |         else do
   |              ^^

build failure with unix-2.8

Building library for entropy-0.4.1.7..
[1 of 2] Compiling System.EntropyNix ( System/EntropyNix.hs, /codetmp/e/entropy-0.4.1.7/.dist-newstyle-trustee/10be456790bc3b632af51d83d48f6261b1582f7afda9738a904fcdaae19022f73d8cecfb92dc8424569399c5837879f7b2e904384214c4b271bebb1b81838fcb/build/x86_64-linux/ghc-9.2.2/entropy-0.4.1.7/noopt/build/System/EntropyNix.o, /codetmp/e/entropy-0.4.1.7/.dist-newstyle-trustee/10be456790bc3b632af51d83d48f6261b1582f7afda9738a904fcdaae19022f73d8cecfb92dc8424569399c5837879f7b2e904384214c4b271bebb1b81838fcb/build/x86_64-linux/ghc-9.2.2/entropy-0.4.1.7/noopt/build/System/EntropyNix.dyn_o )


System/EntropyNix.hs:78:3: error:
    • Couldn't match expected type: unix-2.8.0.0:System.Posix.IO.Common.OpenFileFlags
                                    -> IO Fd
                  with actual type: IO Fd
    • The function ‘openFd’ is applied to four value arguments,
        but its type ‘FilePath
                      -> OpenMode
                      -> unix-2.8.0.0:System.Posix.IO.Common.OpenFileFlags
                      -> IO Fd’
        has only three
      In a stmt of a 'do' block:
        openFd source ReadOnly Nothing defaultFileFlags
      In the expression:
        do evaluate ensurePoolInitialized
           openFd source ReadOnly Nothing defaultFileFlags
   |
78 |   openFd source ReadOnly Nothing defaultFileFlags
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

System/EntropyNix.hs:78:26: error:
    • Couldn't match expected type ‘unix-2.8.0.0:System.Posix.IO.Common.OpenFileFlags’
                  with actual type ‘Maybe a0’
    • In the third argument of ‘openFd’, namely ‘Nothing’
      In a stmt of a 'do' block:
        openFd source ReadOnly Nothing defaultFileFlags
      In the expression:
        do evaluate ensurePoolInitialized
           openFd source ReadOnly Nothing defaultFileFlags
   |
78 |   openFd source ReadOnly Nothing defaultFileFlags
   |                          ^^^^^^^

I'll make corresponding revisions to affected versions (0.4 series, some of 0.3 too)

Build errors with GHC 8.10.4 on macOS 10.15

The Haskell part builds, but I'm seeing a bunch of errors in building the C bits. It could be a difference between Linux and macOS versions of gcc. My gcc --version outputs:

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.3 (clang-1103.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

The error log is in this file:

entropy_build_errors.txt

Fails on windows with GHC 8.0 and 7.10

System\EntropyWindows.hs:20:28:
    Module `System.Win32.Types' does not export `ULONG_PTR'
cabal.exe: Failed to build entropy-0.4.1.4 (which is required by test:test from HTTP-4000.3.13).

Having some trouble install entropy by stack

Greetings !

  • OS : Windows 10 ( not WSL )
  • GHCup : 0.1.17.8
  • stack : 2.7.5
  • GHC : 8.10.7
  • GCC : 11.3.0 based on MSYS2

I got some trouble while building entropy on windows :

PS D:\study\Haskell\CodeArena\animate> stack install entropy
entropy> configure
entropy> [1 of 2] Compiling Main             ( C:\\Users\Ziyan Chen\AppData\Local\Temp\stack-90f2c3a41cbee11a\entropy-0.4.1.7\Setup.hs, C:\\Users\Ziyan Chen\AppData\Local\Temp\stack-90f2c3a41cbee11a\entropy-0.4.1.7\.stack-work\dist\274b403a\setup\Main.o )
entropy> [2 of 2] Compiling StackSetupShim   ( C:\\Users\Ziyan Chen\AppData\Roaming\stack\setup-exe-src\setup-shim-Z6RU0evB.hs, C:\\Users\Ziyan Chen\AppData\Local\Temp\stack-90f2c3a41cbee11a\entropy-0.4.1.7\.stack-work\dist\274b403a\setup\StackSetupShim.o )
entropy> Linking C:\\Users\\Ziyan Chen\\AppData\\Local\\Temp\\stack-90f2c3a41cbee11a\\entropy-0.4.1.7\\.stack-work\\dist\\274b403a\\setup\\setup.exe ...
entropy> Configuring entropy-0.4.1.7...
entropy> build
entropy> Result of RDRAND Test: True
entropy>
entropy> C:\Users\Ziyan Chen\AppData\Local\Temp\stack-90f2c3a41cbee11a\entropy-0.4.1.7\testLibcGetrandom-14500\testLibcGetrandom.c:3:10: error:
entropy>      fatal error: sys/random.h: No such file or directory
entropy>         3 | #include <sys/random.h>
entropy>           |          ^~~~~~~~~~~~~~
entropy>   |
entropy> 3 | #include <sys/random.h>
entropy>   |          ^
entropy> compilation terminated.
entropy> `gcc.exe' failed in phase `C Compiler'. (Exit code: 1)
entropy> Result of libc getrandom() Test: False
entropy>
entropy> C:\Users\Ziyan Chen\AppData\Local\Temp\stack-90f2c3a41cbee11a\entropy-0.4.1.7\testSyscallGetrandom-14500\testSyscallGetrandom.c:4:10: error:
entropy>      fatal error: sys/syscall.h: No such file or directory
entropy>         4 | #include <sys/syscall.h>
entropy>           |          ^~~~~~~~~~~~~~~
entropy>   |
entropy> 4 | #include <sys/syscall.h>
entropy>   |          ^
entropy> compilation terminated.
entropy> `gcc.exe' failed in phase `C Compiler'. (Exit code: 1)
entropy> Result of syscall getrandom() Test: False
entropy> testGetentropy-14500\testGetentropy.c: In function 'main':
entropy>
entropy> C:\Users\Ziyan Chen\AppData\Local\Temp\stack-90f2c3a41cbee11a\entropy-0.4.1.7\testGetentropy-14500\testGetentropy.c:6:12: error:
entropy>      warning: implicit declaration of function 'getentropy' [-Wimplicit-function-declaration]
entropy>         6 |     return getentropy(&tmp, sizeof(tmp));
entropy>           |            ^~~~~~~~~~
entropy>   |
entropy> 6 |     return getentropy(&tmp, sizeof(tmp));
entropy>   |            ^
entropy> C://Users//Ziyan Chen//AppData//Local//Programs//stack//x86_64-windows//ghc-8.10.7//mingw//bin/ld.exe: testGetentropy-14500\testGetentropy.o:testGetentropy.c:(.text+0x1a): undefined reference to `getentropy'
entropy> collect2.exe: error: ld returned 1 exit status
entropy> `gcc.exe' failed in phase `Linker'. (Exit code: 1)
entropy> Result of getentropy() Test: False
entropy> Preprocessing library for entropy-0.4.1.7..
entropy> Building library for entropy-0.4.1.7..
entropy> [1 of 2] Compiling System.EntropyWindows
entropy>
entropy> System\EntropyWindows.hs:100:1: warning: [-Wunsupported-calling-conventions]
entropy>     <stderr>: commitAndReleaseBuffer: invalid argument (invalid character)

It says " sys/random.h : no such file or directory "
and " sys/syscall.h : no such file or directory " . So :

I tried to find some libraries on MSYS2 package website and I found nothing .......... therefore
I downloaded these 2 files from the internet and move them to .....\msys64\usr\include\sys\ ,
but it doesn't work . Would you mind giving me some suggestions ? Thanks .

please don't use RDRAND when /dev/urandom is available

The documentation says that on unix systems, /dev/urandom is used, but since 0.3, this does not seem to be the case -- if RDRAND is probed to be available, it will always be used.

My understanding is that some in the security community don't consider RDRAND to be as secure as the OS's entropy source, because there's no transparency in the chip design. Personally, I'd rather let the developers of linux worry about this issue, and have applications that use whatever sources of entropy they decide is best.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.