Compiler error in happstack-server 0.1 on Windows

1 view
Skip to first unread message

Greg Fitzgerald

unread,
Feb 4, 2009, 3:19:56 PM2/4/09
to HA...@googlegroups.com
Hello happstackers,

> cabal update
> cabal install happstack-server

I'm on WindowsXP compiling with GHC 6.10.1, and getting the following
compiler error, because 'getNameInfo' and the 'NameInfoFlag' data type
is not available. Attached is the documentation for Network.Socket
that comes with GHC on Windows, which is different than the one here:
http://haskell.org/ghc/docs/latest/html/libraries/network/Network-Socket.html

[21 of 27] Compiling HAppS.Server.HTTP.Listen ( src\HAppS\Server\HTTP\Listen.hs,
dist\build\HAppS\Server\HTTP\Listen.o )

src\HAppS\Server\HTTP\Listen.hs:27:20: Not in scope: `getNameInfo'

src\HAppS\Server\HTTP\Listen.hs:27:33:
Not in scope: data constructor `NI_NUMERICHOST'
cabal: Error: some packages failed to install:
happstack-server-0.1 failed during the building phase. The exception was:
exit: ExitFailure 1


Is it possible to implement similar functionality without using
getNameInfo, or is Happstack only targeting *nix platforms?

Thanks,
Greg

Network-Socket.html

Matthew Elder

unread,
Feb 4, 2009, 3:41:31 PM2/4/09
to HA...@googlegroups.com
Hi, I must admit I have not had the windows platform in mind for
Happstack. If we can get it to build on windows, however, this would
be great.

getNameInfo is used basically to turn the address into a dotted-quad
form. is this the only function call which is preventing windows
support?
> network-2.2.0.1: Networking-related facilitiesSource codeContentsIndex
> Network.Socket
> Portabilityportable
> Stabilityprovisional
> Maintaine...@haskell.org
> Contents
> Types Address operations Socket Operations Predicates on sockets Socket options File descriptor transmission Special Constants Initialisation Very low level operations Internal
> Description
>
> The Network.Socket module is for when you want full control over sockets. Essentially the entire C socket API is exposed through this module; in general the operations follow the behaviour of the C functions of the same name (consult your favourite Unix networking book).
>
> A higher level interface to networking operations is provided through the module Network.
>
> Synopsis
> data Socket = MkSocket CInt Family SocketType ProtocolNumber (MVar SocketStatus)
> data Family
> = AF_UNSPEC
> | AF_UNIX
> | AF_INET
> | AF_INET6
> | AF_IMPLINK
> | AF_PUP
> | AF_CHAOS
> | AF_NS
> | AF_ECMA
> | AF_DATAKIT
> | AF_CCITT
> | AF_SNA
> | AF_DECnet
> | AF_DLI
> | AF_LAT
> | AF_HYLINK
> | AF_APPLETALK
> | AF_NETBIOS
> | AF_ISO
> | AF_OSI
> | AF_IPX
> data SocketType
> = NoSocketType
> | Stream
> | Datagram
> | Raw
> | RDM
> | SeqPacket
> data SockAddr = SockAddrInet PortNumber HostAddress
> data SocketStatus
> = NotConnected
> | Bound
> | Listening
> | Connected
> | ConvertedToHandle
> type HostAddress = Word32
> data ShutdownCmd
> = ShutdownReceive
> | ShutdownSend
> | ShutdownBoth
> type ProtocolNumber = CInt
> defaultProtocol :: ProtocolNumber
> newtype PortNumber = PortNum Word16
> type HostName = String
> type ServiceName = String
> socket :: Family -> SocketType -> ProtocolNumber -> IO Socket
> connect :: Socket -> SockAddr -> IO ()
> bindSocket :: Socket -> SockAddr -> IO ()
> listen :: Socket -> Int -> IO ()
> accept :: Socket -> IO (Socket, SockAddr)
> getPeerName :: Socket -> IO SockAddr
> getSocketName :: Socket -> IO SockAddr
> socketPort :: Socket -> IO PortNumber
> socketToHandle :: Socket -> IOMode -> IO Handle
> sendTo :: Socket -> String -> SockAddr -> IO Int
> sendBufTo :: Socket -> Ptr a -> Int -> SockAddr -> IO Int
> recvFrom :: Socket -> Int -> IO (String, Int, SockAddr)
> recvBufFrom :: Socket -> Ptr a -> Int -> IO (Int, SockAddr)
> send :: Socket -> String -> IO Int
> recv :: Socket -> Int -> IO String
> recvLen :: Socket -> Int -> IO (String, Int)
> inet_addr :: String -> IO HostAddress
> inet_ntoa :: HostAddress -> IO String
> shutdown :: Socket -> ShutdownCmd -> IO ()
> sClose :: Socket -> IO ()
> sIsConnected :: Socket -> IO Bool
> sIsBound :: Socket -> IO Bool
> sIsListening :: Socket -> IO Bool
> sIsReadable :: Socket -> IO Bool
> sIsWritable :: Socket -> IO Bool
> data SocketOption
> = DummySocketOption__
> | Debug
> | ReuseAddr
> | Type
> | SoError
> | DontRoute
> | Broadcast
> | SendBuffer
> | RecvBuffer
> | KeepAlive
> | OOBInline
> | NoDelay
> | Linger
> | RecvLowWater
> | SendLowWater
> | RecvTimeOut
> | SendTimeOut
> | UseLoopBack
> getSocketOption :: Socket -> SocketOption -> IO Int
> setSocketOption :: Socket -> SocketOption -> Int -> IO ()
> aNY_PORT :: PortNumber
> iNADDR_ANY :: HostAddress
> sOMAXCONN :: Int
> sOL_SOCKET :: Int
> maxListenQueue :: Int
> withSocketsDo :: IO a -> IO a
> fdSocket :: Socket -> CInt
> mkSocket :: CInt -> Family -> SocketType -> ProtocolNumber -> SocketStatus -> IO Socket
> packFamily :: Family -> CInt
> unpackFamily :: CInt -> Family
> packSocketType :: SocketType -> CInt
> throwSocketErrorIfMinus1_ :: Num a => String -> IO a -> IO ()
> Types
> data Socket Source
> Constructors
> MkSocket CInt Family SocketType ProtocolNumber (MVar SocketStatus)
> Instances
> Eq Socket
> Show Socket
> Typeable Socket
> data Family Source
>
> Address Families.
>
> This data type might have different constructors depending on what is supported by the operating system.
>
> Constructors
> AF_UNSPEC
> AF_UNIX
> AF_INET
> AF_INET6
> AF_IMPLINK
> AF_PUP
> AF_CHAOS
> AF_NS
> AF_ECMA
> AF_DATAKIT
> AF_CCITT
> AF_SNA
> AF_DECnet
> AF_DLI
> AF_LAT
> AF_HYLINK
> AF_APPLETALK
> AF_NETBIOS
> AF_ISO
> AF_OSI
> AF_IPX
> Instances
> Eq Family
> Ord Family
> Read Family
> Show Family
> data SocketType Source
>
> Socket Types.
>
> This data type might have different constructors depending on what is supported by the operating system.
>
> Constructors
> NoSocketType
> Stream
> Datagram
> Raw
> RDM
> SeqPacket
> Instances
> Eq SocketType
> Ord SocketType
> Read SocketType
> Show SocketType
> Typeable SocketType
> data SockAddr Source
> Constructors
> SockAddrInet PortNumber HostAddress
> Instances
> Eq SockAddr
> Show SockAddr
> Typeable SockAddr
> data SocketStatus Source
> Constructors
> NotConnected
> Bound
> Listening
> Connected
> ConvertedToHandle
> Instances
> Eq SocketStatus
> Show SocketStatus
> Typeable SocketStatus
> type HostAddress = Word32Source
> data ShutdownCmd Source
> Constructors
> ShutdownReceive
> ShutdownSend
> ShutdownBoth
> Instances
> Typeable ShutdownCmd
> type ProtocolNumber = CIntSource
> defaultProtocol :: ProtocolNumberSource
> This is the default protocol for a given service.
> newtype PortNumber Source
> Constructors
> PortNum Word16
> Instances
> Enum PortNumber
> Eq PortNumber
> Integral PortNumber
> Num PortNumber
> Ord PortNumber
> Real PortNumber
> Show PortNumber
> Typeable PortNumber
> Storable PortNumber
> Address operations
> type HostName = StringSource
> type ServiceName = StringSource
> Socket Operations
> socket :: Family -> SocketType -> ProtocolNumber -> IO SocketSource
> connect :: Socket -> SockAddr -> IO ()Source
> bindSocket :: Socket -> SockAddr -> IO ()Source
> listen :: Socket -> Int -> IO ()Source
> accept :: Socket -> IO (Socket, SockAddr)Source
> getPeerName :: Socket -> IO SockAddrSource
> getSocketName :: Socket -> IO SockAddrSource
> socketPort :: Socket -> IO PortNumberSource
> socketToHandle :: Socket -> IOMode -> IO HandleSource
>
> turns a Socket into an Handle. By default, the new handle is unbuffered. Use hSetBuffering to change the buffering.
>
> Note that since a Handle is automatically closed by a finalizer when it is no longer referenced, you should avoid doing any more operations on the Socket after calling socketToHandle. To close the Socket after socketToHandle, call hClose on the Handle.
>
> sendTo :: Socket -> String -> SockAddr -> IO IntSource
> NOTE: blocking on Windows unless you compile with -threaded (see GHC ticket #1129)
> sendBufTo :: Socket -> Ptr a -> Int -> SockAddr -> IO IntSource
> recvFrom :: Socket -> Int -> IO (String, Int, SockAddr)Source
> NOTE: blocking on Windows unless you compile with -threaded (see GHC ticket #1129)
> recvBufFrom :: Socket -> Ptr a -> Int -> IO (Int, SockAddr)Source
> send :: Socket -> String -> IO IntSource
> recv :: Socket -> Int -> IO StringSource
> recvLen :: Socket -> Int -> IO (String, Int)Source
> inet_addr :: String -> IO HostAddressSource
> inet_ntoa :: HostAddress -> IO StringSource
> shutdown :: Socket -> ShutdownCmd -> IO ()Source
> sClose :: Socket -> IO ()Source
> Closes a socket
> Predicates on sockets
> sIsConnected :: Socket -> IO BoolSource
> sIsBound :: Socket -> IO BoolSource
> sIsListening :: Socket -> IO BoolSource
> sIsReadable :: Socket -> IO BoolSource
> sIsWritable :: Socket -> IO BoolSource
> Socket options
> data SocketOption Source
> Constructors
> DummySocketOption__
> Debug
> ReuseAddr
> Type
> SoError
> DontRoute
> Broadcast
> SendBuffer
> RecvBuffer
> KeepAlive
> OOBInline
> NoDelay
> Linger
> RecvLowWater
> SendLowWater
> RecvTimeOut
> SendTimeOut
> UseLoopBack
> Instances
> Typeable SocketOption
> getSocketOption :: Socket -> SocketOption -> IO IntSource
> setSocketOption :: Socket -> SocketOption -> Int -> IO ()Source
> File descriptor transmission
> Special Constants
> aNY_PORT :: PortNumberSource
> iNADDR_ANY :: HostAddressSource
> The IPv4 wild card address.
> sOMAXCONN :: IntSource
> sOL_SOCKET :: IntSource
> maxListenQueue :: IntSource
> Initialisation
> withSocketsDo :: IO a -> IO aSource
>
> On Windows operating systems, the networking subsystem has to be initialised using withSocketsDo before any networking operations can be used. eg.
>
> main = withSocketsDo $ do {...}
>
> Although this is only strictly necessary on Windows platforms, it is harmless on other platforms, so for portability it is good practice to use it all the time.
>
> Very low level operations
> fdSocket :: Socket -> CIntSource
> mkSocket :: CInt -> Family -> SocketType -> ProtocolNumber -> SocketStatus -> IO SocketSource
> Internal
> The following are exported ONLY for use in the BSD module and should not be used anywhere else.
> packFamily :: Family -> CIntSource
> unpackFamily :: CInt -> FamilySource
> packSocketType :: SocketType -> CIntSource
> throwSocketErrorIfMinus1_ :: Num a => String -> IO a -> IO ()Source
> Produced by Haddock version 2.3.0
>



--
Need somewhere to put your code? http://patch-tag.com
Want to build a webapp? http://happstack.com

stepcut

unread,
Feb 4, 2009, 4:06:30 PM2/4/09
to HAppS
There is no technical reason why happstack should not support Windows.
Happstack is mostly self contained -- it only needs to write a few
files to disk, and listen on a network socket, and other basic things
that you would expect a modern OS to support. The current lack of
support for Windows is entirely because all the current core
developers use GNU/Linux or Mac OS X. I am not even sure if we
currently have an BSD developers (aside from OS X).

I have added a bug:

http://code.google.com/p/happstack/issues/detail?id=57

On Feb 4, 2:19 pm, Greg Fitzgerald <gari...@gmail.com> wrote:
> Hello happstackers,
>
> > cabal update
> > cabal install happstack-server
>
> I'm on WindowsXP compiling with GHC 6.10.1, and getting the following
> compiler error, because 'getNameInfo' and the 'NameInfoFlag' data type
> is not available.  Attached is the documentation for Network.Socket
> that comes with GHC on Windows, which is different than the one here:http://haskell.org/ghc/docs/latest/html/libraries/network/Network-Soc...
>
> [21 of 27] Compiling HAppS.Server.HTTP.Listen ( src\HAppS\Server\HTTP\Listen.hs,
>  dist\build\HAppS\Server\HTTP\Listen.o )
>
> src\HAppS\Server\HTTP\Listen.hs:27:20: Not in scope: `getNameInfo'
>
> src\HAppS\Server\HTTP\Listen.hs:27:33:
>     Not in scope: data constructor `NI_NUMERICHOST'
> cabal: Error: some packages failed to install:
> happstack-server-0.1 failed during the building phase. The exception was:
> exit: ExitFailure 1
>
> Is it possible to implement similar functionality without using
> getNameInfo, or is Happstack only targeting *nix platforms?
>
> Thanks,
> Greg
>
>  Network-Socket.html
> 90KViewDownload

Matthew Elder

unread,
Feb 4, 2009, 4:12:42 PM2/4/09
to HA...@googlegroups.com
yeah i think this is my fault as my "fix" for the name resolution
crash assumes ipv6 support. (getNameInfo).

Either way we don't have someone who can test the builds on windows
regularly, would you mind doing this Greg? If so then I would be glad
to try to address this in a bugfix release for happs-server.

Paulo Tanimoto

unread,
Feb 4, 2009, 4:16:41 PM2/4/09
to HA...@googlegroups.com
Hello,

On Wed, Feb 4, 2009 at 3:06 PM, stepcut <jer...@n-heptane.com> wrote:
>
> There is no technical reason why happstack should not support Windows.
> Happstack is mostly self contained -- it only needs to write a few
> files to disk, and listen on a network socket, and other basic things
> that you would expect a modern OS to support. The current lack of
> support for Windows is entirely because all the current core
> developers use GNU/Linux or Mac OS X. I am not even sure if we
> currently have an BSD developers (aside from OS X).
>
> I have added a bug:
>
> http://code.google.com/p/happstack/issues/detail?id=57
>

I'm on Linux, but have Windows in a virtual machine I use for testing.
Just as a feedback, I was able to install HAppS before via cabal, but
now it fails for happstack.

By the way, although this is probably not a good idea, I've generated
happs binaries for friends in the past using wine. It was pretty
easy, but mingw is probably the right way to do this.

Paulo

Greg Fitzgerald

unread,
Feb 4, 2009, 4:18:25 PM2/4/09
to Matthew Elder, HA...@googlegroups.com
> Either way we don't have someone who can test the builds on windows
> regularly, would you mind doing this Greg?

I'd be glad to.

-Greg

Matthew Elder

unread,
Feb 4, 2009, 4:18:55 PM2/4/09
to HA...@googlegroups.com
please print the failure message
Reply all
Reply to author
Forward
0 new messages