how to build
hoyeunglee opened this issue · 2 comments
cabal install distributed-process-simplelocalnet-0.2.3.0
cabal install distributed-process-0.5.5
cabal install distributed-static-0.3.2.0
cabal install network-transport-tcp-0.4.2
cabal install network-transport-0.4.0.2 -- can not install
cabal install rank1dynamic-0.3.1.0
cabal install cloud-haskell-0.2.2.0
i use the Main.hs code in
http://haskell-distributed.github.io/tutorials/1ch.html#creating-a-node
import Control.Concurrent (threadDelay)
import Control.Monad (forever)
import Control.Distributed.Process
import Control.Distributed.Process.Node
import Network.Transport.TCP (createTransport, defaultTCPParameters)
replyBack :: (ProcessId, String) -> Process ()
replyBack (sender, msg) = send sender msg
logMessage :: String -> Process ()
logMessage msg = say $ "handling " ++ msg
main :: IO ()
main = do
Right t <- createTransport "127.0.0.1" "10501" defaultTCPParameters
node <- newLocalNode t initRemoteTable
runProcess node $ do
-- Spawn another worker on the local node
echoPid <- spawnLocal $ forever $ do
-- Test our matches in order against each message in the queue
receiveWait [match logMessage, match replyBack]
-- The `say` function sends a message to a process registered as "logger".
-- By default, this process simply loops through its mailbox and sends
-- any received log message strings it finds to stderr.
say "send some messages!"
send echoPid "hello"
self <- getSelfPid
send echoPid (self, "hello")
-- `expectTimeout` waits for a message or times out after "delay"
m <- expectTimeout 1000000
case m of
-- Die immediately - throws a ProcessExitException with the given reason.
Nothing -> die "nothing came back!"
Just s -> say $ "got " ++ s ++ " back!"
root@ubuntu:/cluster# ls/cluster# stack build
app cluster.cabal LICENSE Setup.hs src stack.yaml test
root@ubuntu:
[1 of 1] Compiling Main ( /tmp/stack21101/Setup.hs, /tmp/stack21101/Setup.o )
Linking /root/.stack/setup-exe-cache/x86_64-linux/tmp-setup-Simple-Cabal-1.22.5.0-ghc-7.10.3 ...
cluster-0.1.0.0: configure
Configuring cluster-0.1.0.0...
cluster-0.1.0.0: build
Preprocessing library cluster-0.1.0.0...
[1 of 1] Compiling Lib ( src/Lib.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Lib.o )
In-place registering cluster-0.1.0.0...
Preprocessing executable 'cluster-exe' for cluster-0.1.0.0...
/root/cluster/app/Main.hs:3:8:
Could not find module ‘Control.Distributed.Process’
Use -v to see a list of the files searched for.
/root/cluster/app/Main.hs:4:8:
Could not find module ‘Control.Distributed.Process.Node’
Use -v to see a list of the files searched for.
/root/cluster/app/Main.hs:5:8:
Could not find module ‘Network.Transport.TCP’
Use -v to see a list of the files searched for.
-- While building package cluster-0.1.0.0 using:
/root/.stack/setup-exe-cache/x86_64-linux/setup-Simple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 build lib:cluster exe:cluster-exe --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
@hoyeunglee, note that stack cannot see the packages that you have installed with cabal. I don't have the contents of the file cluster.cabal. Adding distributed-process and network-transport-tcp to the dependencies may fix it.
Please, reopen if there are still build problems.