代码之家  ›  专栏  ›  技术社区  ›  thr

在Mono 2.8上编译F代码

  •  3
  • thr  · 技术社区  · 14 年前

    我一直在尝试用OpenSUSE11.3中的Mono2.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吗?

    1 回复  |  直到 14 年前
        1
  •  3
  •   Tomas Petricek    14 年前

    我认为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文件和安装脚本肯定是可行的,但安装包可能是一个更简单的选项: