Closed mantkiew closed 9 years ago
Please confirm the fix? I don't have a Windows machine.
Just pulled and built. Unfortunately, I am still getting the same error. I tried GHCi like this:
Prelude> :m + Network.Socket
Prelude Network.Socket> :i SockAddr
data SockAddr
= SockAddrInet PortNumber HostAddress
| SockAddrInet6 PortNumber FlowInfo HostAddress6 ScopeID
-- Defined in `network-2.6.0.2:Network.Socket.Types'
instance Eq SockAddr
-- Defined in `network-2.6.0.2:Network.Socket.Types'
instance Ord SockAddr
-- Defined in `network-2.6.0.2:Network.Socket.Types'
instance Show SockAddr -- Defined in `Network.Socket'
As you can see, the SockAddrUnix
is simply undefined on Windows!!! Weird that Haddocks do not mention anything about it.
I tried building using both MSYS and PowerShell.
I think the answer to this SO question will help.
So, I added the following to the library section:
library
if os(windows)
cpp-options: -DWINDOWS
hs-source-dirs: src
...
and the previous error does not appear anymore (the ifndef WINDOWS
worked). However, now I am getting another error:
cbits\byteorder.c:5:23:
fatal error: arpa/inet.h: No such file or directory
compilation terminated.
See another SO answer - on Windows, one must use winsock2.h
instead of inet.h
.
See network's HsNet.h for inspiration.
Just send a pull request? I'd need you to verify any fix anyways.
Sent pull request #6.
GHC 7.8.3, Cabal 1.20, Haskell Platform 2014.2.0.0, Windows
Error: