fsharp / fsharp Goto Github PK
View Code? Open in Web Editor NEWPlease file issues or pull requests here: https://github.com/dotnet/fsharp
Home Page: https://fsharp.org
License: MIT License
Please file issues or pull requests here: https://github.com/dotnet/fsharp
Home Page: https://fsharp.org
License: MIT License
I'd totally use F# to write cross-compatible apps, but there's very little in the form of free, open source support for developing apps on multiple platforms. Most of the current solutions involve either paid development environments or F#-to-JavaScript compilation. A more direct build process would help immensely.
We can build FSharp.Core 2.1 for MonoAndroid by default if we checkin copies of the MonoAndroid mscorlib dlls it depends upon
When fsc.exe /resident creates the terminate-and-stay-resident process, this means xbuild never terminates since it waits for the service process. It seems xbuild monitors process creations by sub-processes in some way.
Asking @knocte about this.
Does the F# compiler treat shebangs as comments? I can ./
my scripts with multiline shebang:
#light (*
exec fsharpi --exec $0 --quiet
*)
System.Console.WriteLine "Hello World"
It should be built against Microsoft.FSharp.Tasks.v4.0.dll
This gives an exception when using xbuild with the Fsc tasks from MonoDevelop (but strangely, not from xbuild)
This is a Mono bug, see https://bugzilla.xamarin.com/show_bug.cgi?id=7815
Seems like I can no longer build the repo on Ubuntu 12.04:
$ autoconf -f -i
$ ./configure
checking whether make sets $(MAKE)... yes
checking for pkg-config... /usr/bin/pkg-config
./configure: line 1740: syntax error near unexpected token `MONO,'
./configure: line 1740: `PKG_CHECK_MODULES(MONO, mono >= 2.9)'
Some info:
$ autoconf --version
autoconf (GNU Autoconf) 2.68
$ automake --version
automake (GNU automake) 1.11.3
$ pkg-config --version
0.26
$ uname -a
Linux zor 3.2.0-30-generic #48-Ubuntu SMP Fri Aug 24 16:52:48 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
we only building FSharp.Build.dll for .NET 4.0.
This dll doesn't load when compiling .NET 2.0/3.5 projects using the .NET 2.0/3.5 tools (ToolsVersion=3.5)
This wouldn't matter much except that MonoDevelop seems to default to creating .NET 2.0/3.5 projects even when TargetFrameworkVersion=4.0 is set in the template (a separate bug)
Continuing this discussion: fsprojects/FAKE#61 (comment)
The FAKE project has continuous build, integration, test and deployment, we should consider how to do that for this project too, it would be a big step forward if we were dropping regular builds (including linux packages) of the F# compiler open source edition.
@forki suggests teamcity.codebetter.com, but that uses windows. I'd prefer to see linux builds since the open source edition needs to support linux/mac more than windows.
We'd probably use FAKE itself.
F# 3.0 is open source. We should start to bring the compiler over to this repo.
Who is doing this?
See @dsyme's comment here:
https://github.com/fsharp/fsharp/issues/26#issuecomment-9309356
We only have to build the proto compiler once.
People would like to host F# code in their applications and websites but need a hosting API for that.
The FSharp.Compiler.dll provides hosting in the SimpleSourceCodeServices API but it doesn't have everything you need (it only handles scripts?)
Perhaps we could build this out.
Consider this code:
let inline getAt (x : ^a) i =
(^a : (member get_Item : int -> _) (x,i))
System.Console.WriteLine (getAt "test" 2)
ignore(System.Console.ReadLine ())
Sure it gives the warning FS0077: Member constraints with the name 'get_Item' are given special status by the F# compiler as certain .NET types are implicitly augmented with this member. This may result in runtime failures if you attempt to invoke the member constraint from your own code.
Now I would admit that I haven't studied the inner workings of the compiler, but it seems like a cop out to me. Why should the compiler pretend that the method get_Item exists when typechecking, but generate code that just throws an InvalidOperationException on runtime? System.String doesn't have neither an Item property nor a get_Item method - the default property is called Chars.
Another thing is that the compiler generates not completely sensible code in this case:
.method public static
void main@ () cil managed
{
// Method begins at RVA 0x2068
// Code size 35 (0x23)
.maxstack 4
.entrypoint
.locals init (
[0] string
)
IL_0000: nop
IL_0001: ldc.i4.0
IL_0002: brfalse.s IL_000c
IL_0004: ldnull
IL_0005: unbox.any [mscorlib]System.Char
IL_000a: br.s IL_0017
IL_000c: ldstr "Dynamic invocation of get_Item is not supported"
IL_0011: newobj instance void [mscorlib]System.NotSupportedException::.ctor()
IL_0016: throw
IL_0017: call void [mscorlib]System.Console::WriteLine(char)
IL_001c: call string [mscorlib]System.Console::ReadLine()
IL_0021: stloc.0
IL_0022: ret
} // end of method $Program::main@
Note that the string "Dynamic invocation of get_Item is not supported" is loaded, but then the zero argument constructor of NotSupportedException is called.
I installed mono using Nathan Bridgewater's script. I then attempted to install F# using the configure option --prefix=/opt
. The output was the following:
ryan@ryan-laptop:/src/fsharp$ which mono/src/fsharp$ ./configure --prefix=/opt
/opt/mono-2.8.1/bin/mono
ryan@ryan-laptop:
checking whether make sets $(MAKE)... yes
configure: creating ./config.status
config.status: creating launcher
config.status: creating Makefile
config.status: creating config.make
config.status: creating src/fsharp/Makefile
config.status: creating src/fsharp/FSharp.Build-proto/Makefile
config.status: creating src/fsharp/FSharp.Compiler-proto/Makefile
config.status: creating src/fsharp/Fsc-proto/Makefile
config.status: creating src/fsharp/FSharp.Core/Makefile
config.status: creating src/fsharp/FSharp.Build/Makefile
config.status: creating src/fsharp/FSharp.Compiler/Makefile
config.status: creating src/fsharp/Fsc/Makefile
ryan@ryan-laptop:~/src/fsharp$ make
make -C src/fsharp all
make[1]: Entering directory /home/ryan/src/fsharp/src/fsharp' make -C FSharp.Build-proto all make[2]: Entering directory
/home/ryan/src/fsharp/src/fsharp/FSharp.Build-proto'
mkdir -p .libs
mkdir -p .libs//2.0
mkdir -p .libs//4.0
mono --debug /home/ryan/src/fsharp/lib/bootstrap/2.0/fssrgen.exe /home/ryan/src/fsharp/src/fsharp/FSharp.Build-proto/../FSharp.Build/FSBuild.txt .libs/FSBuild.fs .libs/FSBuild.resx
resgen .libs/FSBuild.resx .libs/FSBuild.resources
Read in 1 resources from '/home/ryan/src/fsharp/src/fsharp/FSharp.Build-proto/.libs/FSBuild.resx'
Writing resource file... Done.
MONO_PATH=/home/ryan/src/fsharp/lib/bootstrap/4.0/ mono --debug /home/ryan/src/fsharp/lib/bootstrap/4.0/fsc.exe -o:.libs/4.0/FSharp.Build-proto.dll -r:/home/ryan/src/fsharp/lib/bootstrap/4.0/FSharp.Core.dll -r:/opt/lib/mono/4.0/Microsoft.Build.Engine.dll -r:/opt/lib/mono/4.0/Microsoft.Build.Framework.dll -r:/opt/lib/mono/3.5/Microsoft.Build.Tasks.v3.5.dll -r:/opt/lib/mono/3.5/Microsoft.Build.Utilities.v3.5.dll -r:/opt/lib/mono/4.0/mscorlib.dll -r:/opt/lib/mono/4.0/System.Core.dll -r:/opt/lib/mono/4.0/System.dll -r:/opt/lib/mono/4.0/System.Numerics.dll --define:BUILDING_WITH_LKG --define:NO_STRONG_NAMES --define:TRACE --define:FX_ATLEAST_35 --define:MONO --define:CODE_ANALYSIS --define:DEBUG --define:FX_ATLEAST_40 --doc:.libs/4.0/FSharp.Build-proto.xml --version:4.0.0.0 -g --mlcompatibility --noframework --fullpaths --times --nowarn:9 --target:library --resource:.libs/FSBuild.resources .libs//FSBuild.fs /home/ryan/src/fsharp/src/fsharp/FSharp.Build-proto/../../utils/CompilerLocationUtils.fs /home/ryan/src/fsharp/src/fsharp/FSharp.Build-proto/../FSharp.Build/CreateFSharpManifestResourceName.fsi /home/ryan/src/fsharp/src/fsharp/FSharp.Build-proto/../FSharp.Build/CreateFSharpManifestResourceName.fs /home/ryan/src/fsharp/src/fsharp/FSharp.Build-proto/../FSharp.Build/Fsc.fsi /home/ryan/src/fsharp/src/fsharp/FSharp.Build-proto/../FSharp.Build/Fsc.fs
warning FS0075: The command-line option '--version' has been deprecated
warning FS0075: The command-line option 'times' is for internal use only
error FS0218: Unable to read assembly '/opt/lib/mono/4.0/mscorlib.dll'
make[2]: *** [.libs//4.0/FSharp.Build-proto.dll] Error 1
make[2]: Leaving directory /home/ryan/src/fsharp/src/fsharp/FSharp.Build-proto' make[1]: *** [all] Error 2 make[1]: Leaving directory
/home/ryan/src/fsharp/src/fsharp'
make: *** [all] Error 2
After building fsharp, the fsi.exe are missing. Expected in paths: /usr/lib/mono/2.0, /usr/lib/mono/4.0.
When we build with 'msbuild' the FSStrings.resx resources do not get included in the binaries. This is because the Microsoft.FSharp-proto.targets (and Microsoft.FSharp.targets) assume we're using xbuild.
We need targets files what work for both msbuild and xbuild. The only diffferenece is in how resources are treated.
Probably all this needs is a Condition switch in Microsoft.FSharp-proto.targets (and Microsoft.FSharp.targets) once we work out how to condition on whether xbuild or msbuild is running.
I've install mono 2.10 from debian.meeby.net/experimental
and I've compiled F# from this sources and I've installed PowerPack archive from MS's site.
I'm trying to compile this code using makefile below
OPTIONS=--target:library --out:bin/Debug/Lexer.dll --mlcompatibility
FSC=fsharpc --noframework --nologo $(OPTIONS)
LIBS=-r:/usr/lib/fsharp/FSharp.Core.dll \
-r:/usr/lib/mono/4.0/mscorlib.dll \
-r:/usr/lib/mono/4.0/System.dll \
-r:/usr/lib/fsharp/FSharp.PowerPack.dll \
-r:/usr/lib/fsharp/FSharp.PowerPack.Compatibility.dll \
-r:/usr/lib/fsharp/FSharp.PowerPack.Build.Tasks.dll \
all:
fslex clexer.fsl
$(FSC) $(LIBS) LexingStub.fs pretty.fs errormsg.fs cabs.fs cabshelper.fs whitetrack.fs lexerhack.fs \
Tokens.fs clexer.fs Lexer.fs
Best wishes,
Kakadu
I've started working on porting FSharp.Core.dll for .NETCore 4.5 (aka .NET for Metro/Windows Store).
The start of the work can be seen here: https://github.com/robertpi/fsharp
The main issues are:
System.Exception: Note: an unexpected exception in fsi.exe readline console support. Consider starting fsi.exe with the --no-readline option and report the stack trace below to the .NET or Mono implementors
Value must be positive and below the buffer height.
Parameter name: top
at System.TermInfoDriver.SetCursorPosition (Int32 left, Int32 top) [0x00000] in <filename unknown>:0
at System.TermInfoDriver.set_CursorTop (Int32 value) [0x00000] in <filename unknown>:0
at System.ConsoleDriver.set_CursorTop (Int32 value) [0x00000] in <filename unknown>:0
at System.Console.set_CursorTop (Int32 value) [0x00000] in <filename unknown>:0
at <StartupCode$fsi>[email protected] (Microsoft.FSharp.Core.Unit unitVar0) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Compiler.Interactive.Utils.guard (Microsoft.FSharp.Core.FSharpFunc`2 f) [0x00000] in <filename unknown>:0
If I remember correctly, I compiled my Fsharp from commit 6d4f78d
Need to suppress the generation of debuggerbrowsableattribute in debug builds, because monodroid doesnt implement it, below is the sample and exception details,
System.Net.WebException:
System.MissingMethodException: Constructor on type 'System.Diagnostics.DebuggerBrowsableAttribute' not found.
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at Mono.Debugging.Soft.SoftDebuggerAdaptor.BuildAttribute[T](CustomAttributeDataMirror attr)
at Mono.Debugging.Soft.SoftDebuggerAdaptor.GetAttribute[T](CustomAttributeDataMirror[] attrs)
at Mono.Debugging.Soft.SoftDebuggerAdaptor.OnGetTypeDisplayData(EvaluationContext gctx, Object type)
F#
module Tweets =
let url = "http://api.twitter.com/1/statuses/public_timeline.json"
let getPublicTweetsAsync() =
async {
let req = WebRequest.Create(url) :?> HttpWebRequest
let! resp = req.AsyncGetResponse()
use stream = resp.GetResponseStream()
use reader = new System.IO.StreamReader(stream)
return reader.ReadToEnd()
}
let getPublicTweets() = getPublicTweetsAsync() |> Async.RunSynchronously
using MathModule;
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace <StartupCode$AndroidFSharpLibrary>
{
internal static class $Module1
{
[DebuggerBrowsable(DebuggerBrowsableState.Never), CompilerGenerated, DebuggerNonUserCode]
internal static int init@;
static $Module1()
{
string url = Tweets.url;
}
}
}
Ideally we should build binary install packages and put them somewhere sensible.
For windows this would mean we don't have to install the MS VS Express to get a working F# 3.0 compiler
On OSX F# gets bundled with Mono so its less of a problem there.
For a resource reference
<EmbeddedResource Include="folder\AAA.xml" />
Microsoft F# for MSBuild creates a resource with name
AAA.xml.
The F# in this repository creates a resource with name
folder.AAA.xml
C# in VS2012 creates a manifest resource with name with the project file prepended:
ProjectName.folder.AAA.xml
No idea why F# differs to C#. We at least have to make the F# buiilds consistent.
Using the latest (ae23973) with mono 2.10.5, which is the version packaged with Fedora 16, I receive the following error.
mono /home/scratch/local2/lib/mono/4.0/fsi.exe
Microsoft (R) F# 2.0 Interactive build (private)
Copyright (c) 2002-2011 Microsoft Corporation. All Rights Reserved.
For help type #help;;
>
error FS0078: Unable to find the file 'System' in any of
/usr/lib64/mono/4.0
/home/scratch/.../<current directory>
/home/scratch/local2/lib/mono/4.0/
This seems strange because similar errors on the web seem to all be unable to find a file ending in ".dll"
Version 6d4f78d (the previous commit) works fine.
Currently we can install, but not uninstall, fsharp.
make install should copy the FSharp.Core.optdata and .sigdata to the $prefix/lib/mono/fsharp-X.Y/ directory
The flag "compiling-fslib-mscorlib40" makes fsc inject types into
FSharp.Core.dll, and they get duplicated (Tuple)
"make install" does not work on Mac OS X.
To fix this, in src/fsharp/targets.make replace:
ln -fs -t
with:
ln -fs ../gac/$(NAME)/$(VERSION)__$(TOKEN)/$(NAME).sigdata
(and repeat for .optdata two lines below).
Hi,
I really like that F# allows you to create inline code docs without the
/// Implements a TraceListener which writes NAnt like XML files.
let myFunction xmlOutputFile = ..
Unfortunately if you want to describe a parameter than you have to use the tags:
/// <summary>Implements a TraceListener which writes NAnt like XML files.</summary>
/// <param name="xmlOutputFile">Defines the xml output file.</param>
let myFunction xmlOutputFile = ..
It would be cool if we could keep it plain text and don't have to use this XML stuff.
In the ruby (and github) world people seem to like TomDoc.
http://tom.preston-werner.com/2010/05/11/tomdoc-reasonable-ruby-documentation.html
I would like to such a feature in F#
When I use -j3 option, get such error:
Preparing source in /mnt/other/tmp/portage/dev-dotnet/fsharp-9999/work/fsharp-9999 ...
- Running eautoreconf in '/mnt/other/tmp/portage/dev-dotnet/fsharp-9999/work/fsharp-9999' ...
- Running aclocal ... [ ok ]
- Running autoconf ... [ ok ]
Source prepared.
Configuring source in /mnt/other/tmp/portage/dev-dotnet/fsharp-9999/work/fsharp-9999 ...
./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64
checking whether make sets $(MAKE)... yes
configure: creating ./config.status
config.status: creating launcher
config.status: creating Makefile
config.status: creating config.make
config.status: creating src/fsharp/Makefile
config.status: creating src/fsharp/FSharp.Build-proto/Makefile
config.status: creating src/fsharp/FSharp.Compiler-proto/Makefile
config.status: creating src/fsharp/Fsc-proto/Makefile
config.status: creating src/fsharp/FSharp.Core/Makefile
config.status: creating src/fsharp/FSharp.Build/Makefile
config.status: creating src/fsharp/FSharp.Compiler/Makefile
config.status: creating src/fsharp/Fsc/Makefile
config.status: creating src/fsharp/FSharp.Compiler.Interactive.Settings/Makefile
config.status: creating src/fsharp/FSharp.Compiler.Server.Shared/Makefile
config.status: creating src/fsharp/fsi/Makefile
Source configured.
Compiling source in /mnt/other/tmp/portage/dev-dotnet/fsharp-9999/work/fsharp-9999 ...
make -j3
make -C src/fsharp all
make[1]: Entering directory/mnt/other/tmp/portage/dev-dotnet/fsharp-9999/work/fsharp-9999/src/fsharp' make -C FSharp.Build-proto all make[2]: Entering directory
/mnt/other/tmp/portage/dev-dotnet/fsharp-9999/work/fsharp-9999/src/fsharp/FSharp.Build-proto'
mkdir -p .libs
mkdir -p .libs//2.0
mkdir -p .libs//4.0
mono --debug /mnt/other/tmp/portage/dev-dotnet/fsharp-9999/work/fsharp-9999/lib/bootstrap/2.0/fssrgen.exe /mnt/other/tmp/portage/dev-dotnet/fsharp-9999/work/fsharp-9999/src/fsharp/FSharp.Build-proto/../FSharp.Build/FSBuild.txt .libs/FSBuild.fs .libs/FSBuild.resx
make[2]: *** No rule to make target.libs//FSBuild.fs', needed by
.libs//4.0/FSharp.Build-proto.dll'. Stop.
make[2]: *** Waiting for unfinished jobs....
resgen .libs/FSBuild.resx .libs/FSBuild.resources
Read in 1 resources from '/mnt/other/tmp/portage/dev-dotnet/fsharp-9999/work/fsharp-9999/src/fsharp/FSharp.Build-proto/.libs/FSBuild.resx'
Writing resource file... Done.
make[2]: Leaving directory/mnt/other/tmp/portage/dev-dotnet/fsharp-9999/work/fsharp-9999/src/fsharp/FSharp.Build-proto' make[1]: *** [all] Error 2 make[1]: Leaving directory
/mnt/other/tmp/portage/dev-dotnet/fsharp-9999/work/fsharp-9999/src/fsharp'
make: *** [all] Error 2
When I use -j1 option It work.
Starting up fsharpi with --gui gives an exception with Mono 3.0 on MacOS, looks like it is DefaultFont
Microsoft (R) F# 3.0 Interactive version (Mono build)
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;Exception by fsi.exe:
System.ArgumentException: The requested FontFamily could not be found [GDI+ status: FontFamilyNotFound]
at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in :0
at System.Drawing.FontFamily..ctor (GenericFontFamilies genericFamily) [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.Drawing.FontFamily:.ctor (System.Drawing.Text.GenericFontFamilies)
at System.Drawing.FontFamily.get_GenericSansSerif () [0x00000] in :0
at System.Drawing.Font.CreateFont (System.String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte charSet, Boolean isVertical) [0x00000] in :0
at System.Drawing.Font..ctor (System.String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont) [0x00000] in :0
at System.Drawing.Font..ctor (System.String familyName, Single emSize, System.String systemName) [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.Drawing.Font:.ctor (string,single,string)
at System.Drawing.SystemFonts.get_DefaultFont () [0x00000] in :0
at System.Windows.Forms.Theme.get_DefaultFont () [0x00000] in :0
at System.Windows.Forms.Control.get_DefaultFont () [0x00000] in :0
at System.Windows.Forms.Control.get_Font () [0x00000] in :0
at System.Windows.Forms.Form..ctor () [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.Windows.Forms.Form:.ctor ()
at Microsoft.FSharp.Compiler.Interactive.Shell+DummyForm..ctor () [0x00000] in :0
at (wrapper remoting-invoke-with-check) Microsoft.FSharp.Compiler.Interactive.Shell/DummyForm:.ctor ()
at Microsoft.FSharp.Compiler.Interactive.Shell+WinFormsEventLoop..ctor (Microsoft.FSharp.Compiler.Interactive.FsiConsoleOutput fsiConsoleOutput, Microsoft.FSharp.Core.FSharpOption`1 lcid) [0x00000] in :0
at Microsoft.FSharp.Compiler.Interactive.Shell+FsiEvaluationSession.Run () [0x00000] in :0
at Microsoft.FSharp.Compiler.Interactive.Main.MainMain (System.String[] argv) [0x00000] in :0
the xml files are installed into the gac under this version b03f5f7f11d50a3a however the directory doesn't exist so it renames the xml file to b03f5f7f11d50a3a.
[ 455s] /usr/lib/mono/4.0/FSharp.Compiler.Interactive.Settings.xml -> /usr/lib/mono/gac/FSharp.Compiler.Interactive.Settings/4.3.0.0__b03f5f7f11d50a3a/FSharp.Compiler.Interactive.Settings.xml
[ 455s] /usr/lib/mono/4.0/fsc.xml -> /usr/lib/mono/gac/fsc/4.3.0.0__b03f5f7f11d50a3a/fsc.xml
[ 455s] /usr/lib/mono/4.0/FSharp.Compiler.Server.Shared.xml -> /usr/lib/mono/gac/FSharp.Compiler.Server.Shared/4.3.0.0__b03f5f7f11d50a3a/FSharp.Compiler.Server.Shared.xml
[ 455s] /usr/lib/mono/4.0/FSharp.Build.xml -> /usr/lib/mono/gac/FSharp.Build/4.3.0.0__b03f5f7f11d50a3a/FSharp.Build.xml
[ 455s] /usr/lib/mono/4.0/FSharp.Compiler.xml -> /usr/lib/mono/gac/FSharp.Compiler/4.3.0.0__b03f5f7f11d50a3a/FSharp.Compiler.xml
All of the dlls are in f536804aa0eb945b.
Note: this is broken with 3.0.15, but not 3.0.13
Could we have /Library/Frameworks as the default location for Mono on Mac OS so I don't have to type ./autogen.sh --prefix=/Library/Frameworks/Mono.framework/Versions/Current
every time? Without it, it finishes with a warning however it builds fine.
jacek:~/oss/fsharp
$ ./autogen.sh
...
config.status: creating src/fsharp/policy.2.0.FSharp.Core/Makefile
config.status: creating src/fsharp/policy.4.0.FSharp.Core/Makefile
config.status: creating src/fsharp/policy.2.3.FSharp.Core/Makefile
config.status: creating src/fsharp/policy.4.3.FSharp.Core/Makefile
configure: WARNING: /usr/local/bin/mono not found: it is recommended to use the same install prefix where mono is installed
jacek:~/oss/fsharp
$ type mono
mono is hashed (/Library/Frameworks/Mono.framework/Versions/Current/bin/mono)
I thought it was me that I had to add the prefix, but just noticed on Mono's download page that Mono and Gtk# install in /Library/Frameworks which led me to report the issue.
It's currently very hard to build a cross platform fsx script due to the above limitation.
Suggestions could include:
SGEN on Mac and Linux has been rock solid for me for Mono 3.0.0.
We should really use it by default if mono-sgen is detected on the path in configuration. A 50% performance win in the compiler is too much too ignore. If there is instability the user could always disable it.
Trace:
$ make
...
Writing resource file... Done.
mono --gc=sgen /Users/andrew/Desktop/src/fsharp/lib/bootstrap/4.0/../2.0/fsyacc.exe ../../absil/ilpars.fsy -o .libs/ilpars.fs --internal --module Microsoft.FSharp.Compiler.AbstractIL.Internal.AsciiParser --lexlib Internal.Utilities.Text.Lexing --parslib Internal.Utilities.Text.Parsing | | tee .libs/ilpars.fs.report | grep "time"
/bin/sh: -c: line 0: syntax error near unexpected token `|'
/bin/sh: -c: line 0: `mono --gc=sgen /Users/andrew/Desktop/src/fsharp/lib/bootstrap/4.0/../2.0/fsyacc.exe ../../absil/ilpars.fsy -o .libs/ilpars.fs --internal --module Microsoft.FSharp.Compiler.AbstractIL.Internal.AsciiParser --lexlib Internal.Utilities.Text.Lexing --parslib Internal.Utilities.Text.Parsing | | tee .libs/ilpars.fs.report | grep "time" '
make[3]: *** [.libs/ilpars.fs] Error 2
make[2]: *** [do-proto] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2
Specs:
xbuild doesn't rebuild a project when a resource file has changed
Repo:
(a) build the F# compiler for Mono 2.11.4
(b) run fsi.exe
Result: Failed to install ctrl-c handler - Ctrl-C handling will not be available. Error was:
Exception has been thrown by the target of an invocation
You can still use fsi.exe its just an annoying startup message
Reported by Robert Pickering
fsharpi
...type A = | Bar;;
--> "Operation not supported"
I like using hard tabs. I shouldn't have to add special magical code just to use tabs. Please change this.
$ fsharpc fizzy.fs
Microsoft (R) F# 2.0 Compiler build (private)
Copyright (c) 2002-2010 Microsoft Corporation. All Rights Reserved.
/Users/andrew/Desktop/src/mcandre/fsharp/fizzy.fs(6,1): error FS1161: TABs are not allowed in F# code unless the #indent "off" option is used
/Users/andrew/Desktop/src/mcandre/fsharp/fizzy.fs(7,1): error FS1161: TABs are not allowed in F# code unless the #indent "off" option is used
/Users/andrew/Desktop/src/mcandre/fsharp/fizzy.fs(8,1): error FS1161: TABs are not allowed in F# code unless the #indent "off" option is used
/Users/andrew/Desktop/src/mcandre/fsharp/fizzy.fs(9,1): error FS1161: TABs are not allowed in F# code unless the #indent "off" option is used
/Users/andrew/Desktop/src/mcandre/fsharp/fizzy.fs(10,1): error FS1161: TABs are not allowed in F# code unless the #indent "off" option is used
/Users/andrew/Desktop/src/mcandre/fsharp/fizzy.fs(11,1): error FS1161: TABs are not allowed in F# code unless the #indent "off" option is used
/Users/andrew/Desktop/src/mcandre/fsharp/fizzy.fs(12,1): error FS1161: TABs are not allowed in F# code unless the #indent "off" option is used
/Users/andrew/Desktop/src/mcandre/fsharp/fizzy.fs(13,1): error FS1161: TABs are not allowed in F# code unless the #indent "off" option is used
/Users/andrew/Desktop/src/mcandre/fsharp/fizzy.fs(16,1): error FS1161: TABs are not allowed in F# code unless the #indent "off" option is used
/Users/andrew/Desktop/src/mcandre/fsharp/fizzy.fs(17,1): error FS1161: TABs are not allowed in F# code unless the #indent "off" option is used
charles@charles-desktop:~$ mono-2.10 mono -V
Mono JIT compiler version 2.10.2 ((no/ce3b0b7 Sun Jul 31 23:44:53 CDT 2011)
Copyright (C) 2002-2011 Novell, Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: Included Boehm (with typed GC and Parallel Mark)
charles@charles-desktop:~$ mono-2.10 fsc --resident /?
Microsoft (R) F# 2.0 Compiler build 1.9.9.9
Copyright (c) 2002-2010 Microsoft Corporation. All Rights Reserved.
server error: System.Runtime.Remoting.RemotingException: Unix transport error.
Server stack trace:
at Mono.Remoting.Channels.Unix.UnixMessageIO.ReceiveMessageStatus (System.IO.Stream networkStream, System.Byte[] buffer) [0x00000] in <filename unknown>:0
at Mono.Remoting.Channels.Unix.UnixClientTransportSink.ProcessMessage (IMessage msg, ITransportHeaders requestHeaders, System.IO.Stream requestStream, ITransportHeaders& responseHeaders, System.IO.Stream& responseStream) [0x00000] in <filename unknown>:0
at Mono.Remoting.Channels.Unix.UnixBinaryClientFormatterSink.SyncProcessMessage (IMessage msg) [0x00000] in <filename unknown>:0
Exception rethrown at [0]:
---> System.Runtime.Remoting.RemotingException: Connection closed
at Mono.Remoting.Channels.Unix.UnixMessageIO.StreamRead (System.IO.Stream networkStream, System.Byte[] buffer, Int32 count) [0x00000] in <filename unknown>:0
at Mono.Remoting.Channels.Unix.UnixMessageIO.ReceiveMessageStatus (System.IO.Stream networkStream, System.Byte[] buffer) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Remoting.Channels.Unix.UnixMessageIO.ReceiveMessageStatus (System.IO.Stream networkStream, System.Byte[] buffer) [0x00000] in <filename unknown>:0
at Mono.Remoting.Channels.Unix.UnixClientTransportSink.ProcessMessage (IMessage msg, ITransportHeaders requestHeaders, System.IO.Stream requestStream, ITransportHeaders& responseHeaders, System.IO.Stream& responseStream) [0x00000] in <filename unknown>:0
at Mono.Remoting.Channels.Unix.UnixBinaryClientFormatterSink.SyncProcessMessage (IMessage msg) [0x00000] in <filename unknown>:0
warning FS2021: The resident compilation service was not used because a problem occured in communicating with the server.
If you're curious, here's the contents of mono-2.10 (it just allows me to switch versions):
#!/bin/bash
MONO_PREFIX=/opt/mono-2.10
GNOME_PREFIX=/usr
export DYLD_LIBRARY_FALLBACK_PATH=/opt/mono-2.10/lib:
export LD_LIBRARY_PATH=/opt/mono-2.10/lib:
export C_INCLUDE_PATH=/opt/mono-2.10/include:/usr/include
export ACLOCAL_PATH=/opt/mono-2.10/share/aclocal
export PKG_CONFIG_PATH=/opt/mono-2.10/lib/pkgconfig:/usr/lib/pkgconfig
export PATH=/opt/mono-2.10/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
exec "$@"
Can you reproduce this? Let me know if there's anything I can do to help.
I've a project that fsyacc/fslex and I'm trying to compile/run it on mono on MacOS X.
I'm able to compile everything, but when I run my code I get an error for a missing method:
Missing method Microsoft.FSharp.Text.Parsing.Tables<Parser.token>::
Interpret<[1]>(FSharpFunc`2<LexBuffer`1<!!0>, !0>,LexBuffer`1<!!0>,int)
in assembly <>/FSharp.PowerPack.dll, referenced in assembly <...>LParser.dll
I'm using the assemblies from the FSharp PowerPack zip. I've put the FSharp.PowerPack.dll in the same dir of my .exe.
If I use ILSpy on that dll I can see the method.
I tried with both the Mono 3.0 framework and with the 2.10.9 (in this case FSharp comes from the .zip found here (http://www.microsoft.com/en-us/download/details.aspx?id=11100)
I've compiled .exe on .NET and mono on Ubuntu as well.
On mono I compile using makefiles.
I've done the following tests as well:
Miguel said this means buildiing FSharp.Core against the 2.1 profile of Mono but I can't even find that profile yet.
I installed the emulator-only version of MonoDroid and MonoTouch and looked for the binaries for the 2.1 profile in the MonoDroid installation files but can't find them.
The problem is that whenever I run "fsi" or "fsharpi" (either using fsharp mode or in a shell buffer), the buffer becomes unresponsive. I check the system monitor and see a mono process using 100% CPU and obviously anything I type doesn't get evaluated:
(alternatively, press C-c C-s in fsharp mode)
This does not happen when running it in an ansi-term buffer.
I've reproduced this problem with F# 3.0, F# 2.0, different versions of Mono (currently running 3.0), different versions of Emacs (24.1, 23.2) and different OSs (OS X, Linux Mint, Fedora).
See https://groups.google.com/forum/?fromgroups=#!topic/fsharp-opensource/0fQOCBTjFng for the discussion in the fsharp opensource mailing list.
Update: After running it with mono --trace, the first few lines are (not sure if this is of help).
bash-3.2$ export MONO_OPTIONS="--trace"
bash-3.2$ fsharpi
[0xac170a28: 0.00000 0] ENTER: (wrapper runtime-invoke) :runtime_invoke_void__this___object (object,intptr,intptr,intptr)([System.OutOfMemoryException:0x30005d0], 0xbffff7f8, 0x0, 0x79ac40, )
[0xac170a28: 0.00005 1] ENTER: System.OutOfMemoryException:.ctor (string)(this:0x30005d0[System.OutOfMemoryException fsi.exe], [STRING:0x30005a8:Out of memory], )
[0xac170a28: 0.00016 2] ENTER: System.SystemException:.ctor (string)(this:0x30005d0[System.OutOfMemoryException fsi.exe], [STRING:0x30005a8:Out of memory], )
[0xac170a28: 0.00025 3] ENTER: System.Exception:.ctor (string)(this:0x30005d0[System.OutOfMemoryException fsi.exe], [STRING:0x30005a8:Out of memory], )
[0xac170a28: 0.00027 3] LEAVE: System.Exception:.ctor (string)
[0xac170a28: 0.00028 2] LEAVE: System.SystemException:.ctor (string)
[0xac170a28: 0.00029 1] LEAVE: System.OutOfMemoryException:.ctor (string)
[0xac170a28: 0.00029 0] LEAVE: (wrapper runtime-invoke) :runtime_invoke_void__this___object (object,intptr,intptr,intptr)[OBJECT:0x0]
[0xac170a28: 0.00040 0] ENTER: (wrapper runtime-invoke) :runtime_invoke_void__this___object (object,intptr,intptr,intptr)([System.NullReferenceException:0x30006b0], 0xbffff7f8, 0x0, 0x79ae30, )
[0xac170a28: 0.08080 1] ENTER: System.NullReferenceException:.ctor (string)(this:0x30006b0[System.NullReferenceException fsi.exe], [STRING:0x3000628:A null value was found where an object instance was required], )
[0xac170a28: 0.08085 2] ENTER: System.SystemException:.ctor (string)(this:0x30006b0[System.NullReferenceException fsi.exe], [STRING:0x3000628:A null value was found where an object instance was required], )
[0xac170a28: 0.08088 3] ENTER: System.Exception:.ctor (string)(this:0x30006b0[System.NullReferenceException fsi.exe], [STRING:0x3000628:A null value was found where an object instance was required], )
fsprojects/FSharpx.Extras#151 reminded me of the problem with the nuget package "FSharp.Core"
We should update the package with the latest build artifacts,
If anybody wants to help I can make you admin of the package ;-)
$ ./autogen.sh
checking whether make sets $(MAKE)... yes
checking for pkg-config... /usr/bin/pkg-config
./configure: line 1758: syntax error near unexpected token MONO,' ./configure: line 1758:
PKG_CHECK_MODULES(MONO, mono >= 2.9)'
-- Mac OSX 10.8.2, automake and autoconf form MacPorts.
Hi folks,
I tried running the commands;
msbuild fsharp-library-build.proj /p:TargetFramework=sl5
msbuild fsharp-compiler-build.proj /p:TargetFramework=sl5-compiler
And it failed to buid....
It works in the codeplex release and it would be really great if this was fixed.
Many thanks,
Matt
From discussion on fsharp-opensource - there is no way to install after you build F# from source on windows. On Windows the F# compiler is only properly installed if it installs registry keys etc. Also building on windows requires Microsoft tools.
This is not high priority because if people want to use F# on windows they can just get the free F# tools from Microsoft, e.g. from http://fsharp.net
i just did a fresh mono dev install , and autogen fails, and I also have absolutely no clue where mono installs anything aside from the mono binary. (and the docs on the mono site don't help me or perhaps i'm not looking in the correct part of the site)
Downloads/fsharp-fsharp-f3369c1 » ./autogen.sh
aclocal: error: couldn't open directory '/opt/local/share/aclocal': No such file or directory
checking whether make sets $(MAKE)... yes
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for MONO... no
configure: error: Package requirements (mono >= 2.9) were not met:
No package 'mono' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables MONO_CFLAGS
and MONO_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
(point being, while i'm not a general newbie, i am a mono novice / noob but I do want to try out F# for a change :) )
There is a simple fix (fsc.exe must be installed in 4.5)
First, if this is the wrong place to report bugs regarding the interactive environment, I am sorry, and would like directions to the right place.
On Linux (Debian Wheezy and Ubuntu 11.04), the following piece of code gave an error. I tested it on Windows 7, but it didn't give any error there. Neither systems gave an error when running the code through the regular compiler, only the interactive environment gave problems. Note that this is a reduced version of another function, which actually did something meaningful:
let rec testFunc = function | x1::xs -> x1::testFunc(xs) | _ -> [];;
val testFunc : 'a list -> 'a listtestFunc([3.0; 4.0; 1.0]);;
System.InvalidProgramException: Invalid IL code in FSI_0042:testFunc (Microsoft.FSharp.Collections.FSharpList1<double>): IL_003b: ldarg.0 at FSI_0042.testFunc[Double] (Microsoft.FSharp.Collections.FSharpList
1 _arg1) [0x00000] in :0
at <StartupCode$FSI_0043>.$FSI_0043.main@ () [0x00000] in :0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0
Stopped due to error
However, adding a type annotation, such as int, float or string, and thus changing its type from having a type parameter 'a to something specific, worked fine:
let rec testFunc = function | (x1:int)::xs -> x1::testFunc(xs) | _ -> [];;
val testFunc : int list -> int listtestFunc([3; 4; 1]);;
val it : int list = [3; 4; 1]
As far as I can tell, there are no errors in this test code. InvalidProgramException also seems to indicate that it is a bug in the compiler. If I would have to qualify a guess, the bug is related to generic types, lists and recursion.
Another sample code that has buggy behavior is:
let rec testFunc2 = function | (a:int)::b -> a::testFunc2(b) | []->[];;
val testFunc2 : 'a list -> 'a listtestFunc2([3; 4; 5]);;
val it : int list = [3]
The result is clearly wrong, and the right result, [3; 4; 5], is computed correctly on Windows (interactive and compiler) as well as Linux compiler, just like for the above code. There seems to be something wrong with generics, recursive functions and lists for the interactive environment on Linux. I have only tested the buggy code on one machine with Linux, on a 64-bit system.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.