Derek Thurn
Derek Thurn

Reputation: 15375

How can I get Mono 3's fsharpc to create an OSX-compatible binary?

Decided to try out F# for the first time on my Mac (OSX 10.8, XCode 4.4). I downloaded Mono 3.0.3 and attempted to compile a simple "Hello World" program. It didn't go well:

$ cat Hello.fs 
printfn "Hello, World!"
$ /Library/Frameworks/Mono.framework/Versions/3.0.3/bin/fsharpc Hello.fs 
F# Compiler for F# 3.0 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source License
$ ./Hello.exe 
zsh: exec format error: ./Hello.exe
$ file Hello.exe 
Hello.exe: PE32 executable for MS Windows (console) Intel 80386 32-bit Mono/.Net assembly

I looked through the output of fsharpc --help to see if there was an obvious flag for producing the correct type of binary, but nothing seemed particularly helpful. I'm assuming that there's something really obvious I need to do to enable this, but I can't seem to figure it out.

Upvotes: 2

Views: 737

Answers (1)

Derek Thurn
Derek Thurn

Reputation: 15375

I just realized that I was supposed to do mono Hello.exe. I'll leave this around in case somebody else doesn't read the Mono documentation before trying to compile some code ;)

Upvotes: 12

Related Questions