【问题标题】:FSI.exe does not work under Ubuntu 10.10FSI.exe 在 Ubuntu 10.10 下不起作用
【发布时间】:2010-11-23 14:23:47
【问题描述】:

更新: 尝试了 11 月的 CTP 版本。相同的错误信息。 忘了说这台服务器安装了 Ubuntu 服务器版。我在运行 Desktop 10.10 的 Ubuntu 桌面上没有这个问题。 所以我怀疑可能是缺少一些与命令行相关的库。安装 libreadline-dev 和 libreadline5 后,错误消息消失了。但是fsi卡住的问题还是存在的。

更新 2: 尝试了新的 Mono 2.8.1。同样的 FSI 卡住问题。

更新3: 由于这个问题非常容易重现,因此我将其作为 fsi.exe 中的错误报告给了 Microsoft。让我们看看情况如何。

更新4: 得到了 Don Syme 的快速回复。他建议的解决方案解决了这个问题。我自己创造了答案。

你好,

我在运行 Ubuntu 10.10 和 Mono 2.8 的服务器上安装了 F# 2.0。 fsc.exe 运行完美,我在编译 fs 文件时没有问题。但是,当我按如下方式运行 fsi.exe 时: 单声道/usr/local/FSharp/bin/fsi.exe

我收到了 FSI 提示,但错误消息不断重复

“未能安装 ctrl-c 处理程序 - Ctrl-C 处理将不可用。错误是: 调用目标抛出异常”

我这里有什么遗漏吗?

Mono 2.8 是从源代码编译和安装的。

【问题讨论】:

  • 您是否使用了最新的 11 月 CTP 版本的 F#?这会杀死 FSI 还是您可以继续使用它(即使 Ctrl+C 无法中断 F# 代码执行)
  • 我使用了 2010 年 8 月的 CTP 版本。不知道新版本。会试一试。症状是在显示该错误消息后,FSI 只是卡在那里 -- 它仍然存在但从未响应我的输入

标签: f# ubuntu mono f#-interactive


【解决方案1】:

回答我自己的问题真的很尴尬。无论如何,我会回答它,以便其他人可以从中受益。

首先,安装 libreadline-dev 和 libreadline5 这样就可以摆脱下面的错误信息了

安装 ctrl-c 处理程序失败 - Ctrl-C 处理将不可用。错误是:调用目标抛出异常

如果您遇到 fsi.exe 卡住的问题,请尝试

 fsi --gui-

它在我的情况下完美运行。

这是我对为什么会发生这种问题的理解。如果您查看代码,您会发现 fsi.exe 实际上引用了 System.Windows.Forms,它进一步链接到 Window 系统。就我而言,我在没有安装 X 系统的服务器上运行 fsi。因此,fsi 卡在那里试图与不存在的 X 对话。这就解释了为什么我的桌面没有这个问题。

【讨论】:

    【解决方案2】:

    F# 在 Linux 下从来没有为我工作过。今天使用 Mono 2.8 和 2010 年 11 月发布的 F#(令人困惑的是,它的版本号与之前的版本完全相同?!)我得到:

    $ sudo ./install-mono.sh
    In order to add FSharp.Core.dll to the Mono GAC the DLL needs to be
    re-signed with the mono.snk key. The mono.snk key is available from
    the 'Mono Sources'.
    
      http://www.mono-project.com/
      http://github.com/mono/mono/raw/master/mcs/class/mono.snk
    
    For example, run:
      wget -O mono.snk http://github.com/mono/mono/raw/master/mcs/class/mono.snk
    
    Then re-run this script.
    
    An alternative to installing the DLLs in the Mono GAC is to add the
    FSharp bin directory to the MONO_PATH variable. For more information
    on 'How Mono Finds Assemblies' see http://www.mono-project.com/Gacutil
    

    如果我运行它建议的 wget 命令,那么它就会死掉:

    $ wget -O mono.snk http://github.com/mono/mono/raw/master/mcs/class/mono.snk
    --2010-11-23 17:02:43--  http://github.com/mono/mono/raw/master/mcs/class/mono.snk
    Resolving github.com... 207.97.227.239
    Connecting to github.com|207.97.227.239|:80... connected.
    HTTP request sent, awaiting response... 301 Moved Permanently
    Location: https://github.com/mono/mono/raw/master/mcs/class/mono.snk [following]
    --2010-11-23 17:02:44--  https://github.com/mono/mono/raw/master/mcs/class/mono.snk
    Connecting to github.com|207.97.227.239|:443... connected.
    ERROR: certificate common name `*.github.com' doesn't match requested host name `github.com'.
    To connect to github.com insecurely, use `--no-check-certificate'.
    Unable to establish SSL connection.
    

    现在如果我重新运行 F# 安装程序,我会得到一个不同的错误:

    $ sudo ./install-mono.sh
    -- Resigning FSharp.Core.dll with mono.snk
    ERROR: Invalid number of parameters.
    
    Usage: sn [-q | -quiet] options [parameters]
    
     -q | -quiet            Quiet mode (minimal display)
    
    Help options
     -? | -h                Show this help screen about the tool
     -? | -h config         Configuration options
     -? | -h csp            Crypto Service Provider (CSP) related options
     -? | -h convert        Format convertion options
     -? | -h sn             StrongName signing options
    -- Installing FSharp DLLS into the GAC
    Failure adding assembly bin/FSharp.Core.dll to the cache: Strong name cannot be verified for delay-signed assembly
    

    如果我手动将 Mono 2.8 目录中的 mono.snk 文件复制到 F# 目录中,那么安装程序似乎可以工作:

    $ sudo ./install-mono.sh
    -- Resigning FSharp.Core.dll with mono.snk
    Assembly bin/FSharp.Core.dll signed.
    -- Installing FSharp DLLS into the GAC
    Installed bin/FSharp.Core.dll into the gac (/usr/local/lib/mono/gac)
    

    但 F# 本身仍然无法以与之前完全相同的方式工作(每当输入输入时似乎挂起):

    $ mono bin/fsi.exe
    
    Microsoft (R) F# 2.0 Interactive build 2.0.0.0
    Copyright (c) Microsoft Corporation. All Rights Reserved.
    
    For help type #help;;
    
    > 1+2*3;;
    

    我必须使用 CTRL+Z 重新获得控制权,然后使用kill %1 杀死流氓进程。

    【讨论】:

    • 嗨,乔恩,我经历了和你一样的步骤。现在错误消息消失了,而 fsi 仍然卡住了。我猜它一定缺少其他一些库。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-10
    • 1970-01-01
    • 2015-12-17
    • 1970-01-01
    • 2011-06-06
    • 1970-01-01
    相关资源
    最近更新 更多