快速scala编译器:无法建立与编译守护程序的连接

时间:2013-03-19 20:34:42

标签: scala fsc

我在OpenVZ虚拟化下有一台ubuntu机器。当我运行fsc test.scala时,我得到:

Unable to establish connection to compilation daemon

然后ps aux向我展示了许多看起来像这样的过程

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

我已经没有想法如何让它发挥作用,版本为Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL。有什么想法吗?

修改

找到this,所以:

  • 未安装selinux
  • 导出| grep SCALA不会返回 什么,但scalac和scala编译/运行正常,所以我假设 这一步没问题
  • ping localhost - works
  • fsc -reset - 同样的错误
  • fsc -verbose>> logfile.log 2>& 1产生这个:
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 ...

编辑2:

好吧,像这样scala scala.tools.nsc.CompileServer -v启动编译服务器实际上有效!似乎fsc确实启动了所有这些服务器,但由于某种原因它决定它没有。 fsc -server localhost:port test.scala有效。现在哪个好了。

1 个答案:

答案 0 :(得分:3)

似乎fsc使用hostname连接到编译服务器。我的主机名没有响应ping。在/etc/hostname中将其更改为localhost修复了问题。