So ... you want to try out the coreclr version of the compiler on windows
See original GitHub issue[ Edit: latest getting started docs now at https://docs.microsoft.com/en-us/dotnet/articles/fsharp/getting-started-netcore ]
This is probably the easiest way to go about this:
- I’m going to assume you are set to sync and build the tree:
- https://github.com/Microsoft/visualfsharp/blob/master/DEVGUIDE.md
- https://github.com/Microsoft/visualfsharp/blob/master/TESTGUIDE.md
- checkout coreclr
- in a vs2014 command window execute appveyor-build.cmd
- This builds everything and runs the tests, etc… it’s good to know you are in a good place.
- Once appveyor-build has completed goto the directory containing the compiler and coreclr binaries
- There are a ton of files in this directory … we are still in early days no attempt has yet been made to prune them down to necessary files … eventually it will come.
- You can run from this directory or copy it some place warm and sunny … like c:\fs_coreclr
- ***** Super caveats ********* a. The desktop compiler is kind of helpful and will go searching around for mscorlib, fsharp.core.dll etc. This functionality is not yet implemented … on the desktop it was implemented using msbuild and some custom logic. In coreclr it will probably be done using a provider, with nuget being the default provider. There is no design except in my head. I mention this so you don’t all hate on me for how awful the command line will be for a while 😃 b. Existing TypeProviders all target the desktop … The inbox TP’s have not been … and will probably not be ported to coreclr. Also we have not identified a binding mechanism for allowing tp’s and the compiler to agree on type loading. Lots of that is going to be changed due to coreclr limitations. c. Environment.Exit() is not yet implemented on coreclr … although it is coming real soon now. Exit is important to error logging and I’ve impmeneted it as an exception so errors appear as uncaught exceptions for now … forgive the crappiness of it please, It will be back to normal shortly. d. Currently It requires the specification of default.manifest on the command line. e. There is no debugging symbols yet Okay lets compile something: I just used VS to make an F# console app and added hello, world to program.fs
// Learn more about F# at http://fsharp.org
// See the 'F# Tutorial' project for more help.
[<EntryPoint>]
let main argv =
printf "Hello, World! from F#"
0 // return an integer exit code
copied the program.fs file into a sunny place too: [C:\fs_smoketest] made this batch file, also in the sunny place:
This batch file builds program.fs to run on the coreclr
@echo off
C:\fs_coreclr\corerun.exe C:\fs_coreclr\fsc.exe --noframework --simpleresolution -r:"%ProgramFiles(x86)%\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.4.0.0\FSharp.Core.dll" -r::%Windir%\Microsoft.NET\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll -r::%Windir%\Microsoft.NET\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll -r:%Windir%\Microsoft.NET\assembly\GAC_MSIL\System.Net.Requests\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Requests.dll --win32manifest:C:\fs_coreclr\default.win32manifest --target:exe --out:program.exe program.fs
When it runs you should see this:
C:\fs_smoketest>C:\fs_coreclr\corerun.exe C:\fs_coreclr\fsc.exe --noframework --simpleresolution -r:
"C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.4.0.0\FSharp.Core
.dll" -r:C:\WINDOWS\Microsoft.NET\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.d
ll -r:C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\Syst
em.Numerics.dll -r:C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\System.Net.Requests\v4.0_4.0.0.0__b03f
5f7f11d50a3a\System.Net.Requests.dll --win32manifest:C:\fs_coreclr\default.win32manifest --target:ex
e --out:program.exe program.fs
Microsoft (R) F# Compiler version (private)
Copyright (c) Microsoft Corporation. All Rights Reserved.
C:\fs_smoketest>dir program.exe
Volume in drive C is Windows
Volume Serial Number is EC1E-3B88
Directory of C:\fs_smoketest
09/29/2015 11:29 AM 4,608 program.exe
1 File(s) 4,608 bytes
0 Dir(s) 220,500,692,992 bytes free
C:\fs_smoketest>program.exe
Hello, World! from F#
C:\fs_smoketest>
To build it to run against coreclr is very similar: I made a batch file c.bat which contained:
@echo off
C:\fs_coreclr\corerun C:\fs_coreclr\fsc.exe --targetprofile:netcore --noframework --simpleresolution -r:"C:\fs_coreclr\FSharp.Core.dll" -r:"%ProgramFiles(x86)%\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\system.runtime.dll" -r:"%ProgramFiles(x86)%\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.IO.dll" --win32manifest:C:\fs_coreclr\default.win32manifest --target:exe --out:program.exe program.fs
When it is run you can see this:
C:\fs_smoketest>c
Microsoft (R) F# Compiler version (private)
Copyright (c) Microsoft Corporation. All Rights Reserved.
C:\fs_smoketest>..\fs_coreclr\CoreRun.exe program.exe
Hello, World! from F#
C:\fs_smoketest>
Let me know how you find it, feel free to raid bugs, make suggestions etc …
For now my priority is to get it working on Linux … and I am not even close to being a Linux aficionado, and so that is going to be fun for me.
Thanks for your interest
Kevin
Issue Analytics
- State:
- Created 8 years ago
- Comments:17 (11 by maintainers)
Top GitHub Comments
Hey,
Thanks for the mail … I just completed support for portable pdbs, and I am currently in the process of checking in the coreclr changes into master both of which are kind of cool. Where we are currently very weak is cross-platform build, whilst the F# compiler runs on linux and mac, and has done so for a long time. We can’t yet build the product there, which still makes me sad. The other area we are hugely weak is cross platform testing, we have some tests that run using nunit on coreclr which is very excellent, it would be nice if we could expand that.
@enricosada has been driving forward our dotnet cli integration.
The bit that scares me most though is testing, I would really love if we could get a grip on our testing and make sure that as much as feasible can run on the coreclr.
We are open to pretty much whatever interests you, open an issue, have a discussion about what you wish to do, mainly to make sure it doesn’t overlap someone else’s interests. And then get to work.
Kevin
From: Dave Kerr [mailto:notifications@github.com] Sent: Wednesday, March 30, 2016 6:36 PM To: Microsoft/visualfsharp visualfsharp@noreply.github.com Cc: Kevin Ransom Kevin.Ransom@microsoft.com Subject: Re: [Microsoft/visualfsharp] So … you want to try out the coreclr version of the compiler on windows (#649)
@KevinRansomhttps://github.com/KevinRansom Hi Kevin I’d be really interested in getting involved in contributing to the F# project, particularly WRT the CoreCLR. I’ve noticed there’s a very good page here:
https://github.com/Microsoft/visualfsharp/wiki/F%23-for-CoreCLR---Status
What would be the best way for someone who is new to this community (but an experienced windows/unix developer) to get started contributing in a meaningful way?
Thanks, and sorry for hijacking this discussion a bit, if there’s a more appropriate place to talk (slack or whatever) please let me know!
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHubhttps://github.com/Microsoft/visualfsharp/issues/649#issuecomment-203709836
@pr-yemibedu Updated link here: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/tutorials/getting-started/getting-started-command-line