3

I am new to F# and am trying run my code on a mac. I am using Visual Studio(Xamarin) and used NuGet to install FSharp.Charting.Gtk. I also have Gtk3 installed using macports.

When I try to run this simple code:

open FSharp.Charting    

[<EntryPoint>]
let main argv = 
    Chart.Line([ for i in 1 .. 10 -> i, i * i ]).ShowChart()

It compiles but simply crashes on launch with this lengthy error: https://pastebin.com/4n8jBMi5

Does anyone know what I am doing wrong? Many thanks

vladb
  • 247
  • 1
  • 2
  • 10
  • Are you sure you need to include the GtkSharp package? I don't see that anywhere in the [FSharp.Charting documentation](https://fslab.org/FSharp.Charting/ReferencingTheLibrary.html). Have you tried *removing* the GtkSharp version 3 DLL, and/or the Gtk3 installation via MacPorts, so that the only thing left on your system is Gtk2? – rmunn Jul 26 '17 at 09:48
  • You are right. I didn't need GtkSharp package and it only introduced its own error. It seems to be a runtime error with finding my display, but I cannot figure out what. – vladb Jul 26 '17 at 22:14

1 Answers1

2

The README in the FSharp.Charting repo says that on Windows, you need to install Gtk# version 2.12.26. I notice that you said you have Gtk3 installed via MacPorts -- but do you have Gtk2 installed? As far as I know, the Gtk2 and Gtk3 APIs aren't 100% compatible, which is why there was a major version number bump. So if the FSharp.Charting code is using the Gtk2 API but you only have Gtk3 installed, that could be the reason. (I don't have a Mac so I can't easily check this for myself).

rmunn
  • 34,942
  • 10
  • 74
  • 105
  • Unfortunately, this hasn't worked for me. I have both gtk2 and 3 installed, but I get the same error. – vladb Jul 26 '17 at 07:54