我一直在尝试用OpenSuSe 11.3中的Mono 2.8编译一些F#代码。而且我一直遇到麻烦,我现在正在向我发出这个错误:
parameter error FS0219: The referenced or default base CLI library 'mscorlib' is
binary-incompatible with the referenced F# core library '/home/fredrik/Documents/
FSharp-2.0.0.0/FSharp-2.0.0.0/bin/FSharp.Core.dll'. Consider recompiling the
library or making an explicit reference to a version of this library that matches
the CLI version you are using.
将这些选项用于fsharp编译器:
mono fsc.exe -o:FSKit.dll -g --debug:full --noframework --define:DEBUG
--define:TRACE --optimize- --tailcalls- --platform:x86 -r:"FSharp.Core.dll"
-r:"/usr/lib/mono/4.0/mscorlib.dll" -r:"/usr/lib/mono/4.0/System.Core.dll"
-r:"/usr/lib/mono/4.0/System.dll" --target:library --warn:3 --warnaserror:76
--vserrors --LCID:1033 --utf8output --fullpaths --flaterrors Src/Version.fs
Src/Bit.fs Src/Reflection.fs Src/Perf.fs Src/Stream.fs Src/AssemblyInfo.fs
从此处找到的fsharp.zip文件安装FSharp并运行./install-mono.sh后:http://www.microsoft.com/downloads/en/details.aspx?FamilyID=f8c623ae-aef6-4a06-a185-05f59be47d67&displaylang=en
我是否还需要使用mono编译FSharp.Core.dll?
答案 0 :(得分:3)
我认为F#的CTP版本仅适用于基于.NET 2.0的运行时(即从.NET 2.0到.NET 3.5),因此没有针对.NET 4.0的独立安装。由于汇编格式略有不同,您可能需要使用2.0版本的Mono库。
我认为引用/usr/lib/mono/2.0
中的库可以解决问题。
顺便说一下,有一个项目可以为F#创建Linux和Mac软件包。使用ZIP文件和安装脚本肯定有效,但安装包可能是一个更容易的选择: