1

我正在为我的项目llvm-fs更新工具,所以我安装了新版本的 mono 并尝试编译它。在OS X 或ubuntumono 3.10.0下使用编译失败并出现堆栈溢出:fsharpc 3.1mono 3.2.8fsharpc 3.0

Unhandled Exception:
System.StackOverflowException: The requested operation caused a stack overflow.
  at (wrapper managed-to-native) object:__icall_wrapper_mono_object_isinst (object,intptr)
  at (wrapper castclass) object:__castclass_with_cache (object,intptr,intptr)
  at Microsoft.FSharp.Compiler.Driver+DelayedDisposables.System-IDisposable-Dispose () [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.Driver.typecheckAndCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter, Microsoft.FSharp.Compiler.ErrorLoggerProvider errorLoggerProvider) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.Driver.mainCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.CommandLineMain.runMain (System.String[] argv) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.CommandLineMain.main (System.String[] argv) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.StackOverflowException: The requested operation caused a stack overflow.
  at (wrapper managed-to-native) object:__icall_wrapper_mono_object_isinst (object,intptr)
  at (wrapper castclass) object:__castclass_with_cache (object,intptr,intptr)
  at Microsoft.FSharp.Compiler.Driver+DelayedDisposables.System-IDisposable-Dispose () [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.Driver.typecheckAndCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter, Microsoft.FSharp.Compiler.ErrorLoggerProvider errorLoggerProvider) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.Driver.mainCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.CommandLineMain.runMain (System.String[] argv) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.CommandLineMain.main (System.String[] argv) [0x00000] in <filename unknown>:0 

您可以通过执行以下操作在 linux 或 OS X 上重现此错误:

git clone git@github.com:fsprojects/llvm-fs.git
cd llvm-fs/
FSC=fsharpc ./build.bash

在 windowsfsc 12.0.30815.0下编译完成,没有错误:

fsc --nologo --debug --sig:LLVMFSharp.fsi --target:library --out:LLVMFSharp.dll src/LLVM/FFIUtil.fs src/LLVM/Generated.fs src/LLVM/Core.fs src/LLVM/BitReader.fs src/LLVM/ExecutionEngine.fs src/LLVM/Extra.fs src/LLVM/Target.fs src/LLVM/Quote.fs

这是一个已知问题吗?有什么办法可以解决吗?我尝试将不同的选项传递给单声道运行时,但没有一个导致编译器正常退出。我确实记得过去 mono 在尾调用指令方面遇到了一些问题,但我认为这些问题大部分都已解决。谢谢!

4

1 回答 1

1

这对于评论来说太长了,但是该错误是由 generate.fs 中的这段代码触发的(因为将其注释掉会阻止堆栈溢出 - 一旦被注释掉,稍后就会出现错误)(从第 6496-6506 行开始):

 [<DllImport(
            llvmAssemblyName,
            EntryPoint="LLVMRunFunction",
            CallingConvention=CallingConvention.Cdecl,
            CharSet=CharSet.Ansi)>]
        extern void* (* LLVMGenericValueRef *) runFunctionNative(
            void* (* LLVMExecutionEngineRef *) EE,
            void* (* LLVMValueRef *) F,
            uint32 NumArgs,
            void* (* LLVMGenericValueRef* *) Args)
        // I don't know how to generate an "F# friendly" version of LLVMRunFunction

崩溃发生在输出签名文件的代码中。

禁用签名文件可以解决问题(但某处仍然存在潜在错误)。

于 2014-11-21T04:48:01.693 回答