Trying to get F# working on the Raspberry Pi


The Raspberry Pi uses an older ARMv6 core which is not well supported by modern software. In particular, Mono's JIT apparently doesn't support the hardware-accelerated floating point instructions used by that version of the ARM instruction set. The solution is apparently to use the soft-float version of Raspian that emulates floating point instructions in software (which will be extremely slow). However, trying to compile the current version of the F# sources on Github using the stock Mono (2.10.8) fails with the following null reference exception from within the F# compiler:

error FS0193: internal error: Object reference not set to an instance of an object

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Collections.FSharpList`1[System.String],System.String].InvokeFast[CcuThunk] (Microsoft.FSharp.Core.FSharpFunc`2 func, Microsoft.FSharp.Collections.FSharpList`1 arg1, System.String arg2) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Env.mkTcGlobals (Boolean compilingFslib, Microsoft.FSharp.Compiler.CcuThunk sysCcu, Microsoft.FSharp.Compiler.AbstractIL.ILGlobals ilg, Microsoft.FSharp.Compiler.CcuThunk fslibCcu, System.String directoryToResolveRelativePaths, Boolean mlCompatibility, Boolean using40environment, Boolean indirectCallArrayMethods, Boolean isInteractive, Microsoft.FSharp.Core.FSharpFunc`2 getTypeCcu) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Build+TcImports.BuildFrameworkTcImports (Microsoft.FSharp.Compiler.TcConfigProvider tcConfigP, Microsoft.FSharp.Collections.FSharpList`1 frameworkDLLs, Microsoft.FSharp.Collections.FSharpList`1 nonFrameworkDLLs) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Driver.getTcImportsFromCommandLine$cont@322 (Exiter exiter, Microsoft.FSharp.Core.FSharpOption`1 displayPSTypeProviderSecurityDialogBlockingUI, Microsoft.FSharp.Compiler.LexResourceManager lexResourceManager, Microsoft.FSharp.Collections.FSharpList`1 sourceFiles, System.String assemblyName, Microsoft.FSharp.Compiler.TcConfig tcConfig, Microsoft.FSharp.Compiler.ErrorLogger errorLogger, Microsoft.FSharp.Core.Unit unitVar) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Driver.getTcImportsFromCommandLine (Microsoft.FSharp.Core.FSharpOption`1 displayPSTypeProviderSecurityDialogBlockingUI, System.String[] argv, System.String defaultFSharpBinariesDir, System.String directoryBuildingFrom, Microsoft.FSharp.Core.FSharpOption`1 lcidFromCodePage, Microsoft.FSharp.Core.FSharpFunc`2 setProcessThreadLocals, Microsoft.FSharp.Core.FSharpFunc`2 displayBannerIfNeeded, Boolean optimizeForMemory, Exiter exiter, Microsoft.FSharp.Core.FSharpFunc`2 createErrorLogger) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Driver.main1 (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter, Microsoft.FSharp.Core.FSharpFunc`2 createErrorLogger) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Driver.mainCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter, Microsoft.FSharp.Core.FSharpFunc`2 createErrorLogger) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.CommandLineMain+Driver.main (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.NullReferenceException: Object reference not set to an instance of an object
  at Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Collections.FSharpList`1[System.String],System.String].InvokeFast[CcuThunk] (Microsoft.FSharp.Core.FSharpFunc`2 func, Microsoft.FSharp.Collections.FSharpList`1 arg1, System.String arg2) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Env.mkTcGlobals (Boolean compilingFslib, Microsoft.FSharp.Compiler.CcuThunk sysCcu, Microsoft.FSharp.Compiler.AbstractIL.ILGlobals ilg, Microsoft.FSharp.Compiler.CcuThunk fslibCcu, System.String directoryToResolveRelativePaths, Boolean mlCompatibility, Boolean using40environment, Boolean indirectCallArrayMethods, Boolean isInteractive, Microsoft.FSharp.Core.FSharpFunc`2 getTypeCcu) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Build+TcImports.BuildFrameworkTcImports (Microsoft.FSharp.Compiler.TcConfigProvider tcConfigP, Microsoft.FSharp.Collections.FSharpList`1 frameworkDLLs, Microsoft.FSharp.Collections.FSharpList`1 nonFrameworkDLLs) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Driver.getTcImportsFromCommandLine$cont@322 (Exiter exiter, Microsoft.FSharp.Core.FSharpOption`1 displayPSTypeProviderSecurityDialogBlockingUI, Microsoft.FSharp.Compiler.LexResourceManager lexResourceManager, Microsoft.FSharp.Collections.FSharpList`1 sourceFiles, System.String assemblyName, Microsoft.FSharp.Compiler.TcConfig tcConfig, Microsoft.FSharp.Compiler.ErrorLogger errorLogger, Microsoft.FSharp.Core.Unit unitVar) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Driver.getTcImportsFromCommandLine (Microsoft.FSharp.Core.FSharpOption`1 displayPSTypeProviderSecurityDialogBlockingUI, System.String[] argv, System.String defaultFSharpBinariesDir, System.String directoryBuildingFrom, Microsoft.FSharp.Core.FSharpOption`1 lcidFromCodePage, Microsoft.FSharp.Core.FSharpFunc`2 setProcessThreadLocals, Microsoft.FSharp.Core.FSharpFunc`2 displayBannerIfNeeded, Boolean optimizeForMemory, Exiter exiter, Microsoft.FSharp.Core.FSharpFunc`2 createErrorLogger) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Driver.main1 (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter, Microsoft.FSharp.Core.FSharpFunc`2 createErrorLogger) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Driver.mainCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter, Microsoft.FSharp.Core.FSharpFunc`2 createErrorLogger) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.CommandLineMain+Driver.main (System.String[] argv) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.CommandLineMain.main (System.String[] argv) [0x00000] in <filename unknown>:0

We'll keep trying...

Comments

Popular posts from this blog

Benchmarking in the web age

Does reference counting really use less memory than tracing garbage collection? Swift vs OCaml

Does reference counting really use less memory than tracing garbage collection? Mathematica vs Swift vs OCaml vs F# on .NET and Mono