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 杀死流氓进程。