scalafsc

fast scala compiler: Unable to establish connection to compilation daemon


I have a ubuntu machine under OpenVZ virtualization. When I run fsc test.scala I get:

Unable to establish connection to compilation daemon

Then ps aux shows me lots of processes that look like this

ren      17482  0.0  0.0   4908  1400 pts/0    S    00:29   0:00 /bin/bash --posix /usr/bin/scala -Djava.net.preferIPv4Stack=true scala.tools
ren      17490  0.2  0.5 1246676 24268 pts/0   Sl   00:29   0:00 java -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Stack=true -Xbootc

I have run out of ideas how to make it work, version is Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL. Any ideas?

Edit:

Found this, so:

Fast Scala compiler version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL
[Given arguments: -verbose]
[Transformed arguments: -verbose -current-dir /home/ren]
[VM arguments: ]
[Temp directory: /tmp/scala-devel/ren]
[Port number: 36737]
java.net.SocketException: Invalid argument or cannot assign requested address
[Connecting to compilation daemon at port 36737 failed; re-trying...]
No compile server running: starting one with args ''
[Executing command: scala scala.tools.nsc.CompileServer -v]
Starting CompileServer on port 34962
Redirect dir is /tmp/scala-devel/ren/output-redirects
[Port number: 34962]
java.net.SocketException: Invalid argument or cannot assign requested address
[Connecting to compilation daemon at port 34962 failed; re-trying...]
[Port number: 34962]
java.net.SocketException: Invalid argument or cannot assign requested address
[Connecting to compilation daemon at port 34962 failed; re-trying...]
No compile server running: starting one with args '' and so on ...

Edit 2:

Well, starting compilation server like this scala scala.tools.nsc.CompileServer -v actually works! And it seems fsc did start all those servers, but for some reason it decided it didn't. fsc -server localhost:port test.scala works. Which is good enough for now.


Solution

  • It seems fsc uses hostname to connect to compilation server. My hostname didn't response to ping. Changing it to localhost in /etc/hostname fixed the problem.