Bug 41052

Summary: fsharp build from source fails
Product: [Mono] Runtime Reporter: Atsushi Eno <atsushi>
Component: GeneralAssignee: Alexander Köplinger [MSFT] <alkpli>
Status: VERIFIED FIXED    
Severity: normal CC: alkpli, mono-bugs+mono, mono-bugs+runtime, shrutis
Priority: ---    
Version: unspecified   
Target Milestone: (C7)   
Hardware: PC   
OS: Linux   
Tags: c7regression Is this bug a regression?: ---
Last known good build:

Description Atsushi Eno 2016-05-12 12:46:43 UTC
With mono master installed, run fsharp build:

----
git clone https://github.com/fsharp/fsharp.git
cd fsharp
./autogen.sh --prefix={specify appropriate one}
make
----

The build fail with:

--------
Build FAILED.
Errors:

/sources/fsharp/src/fsharp/FSharp.Core/FSharp.Core.fsproj (default targets) ->
/sources/fsharp/packages/FSharp.Compiler.Tools.4.0.0.1/tools/Microsoft.FSharp.Targets (CoreCompile target) ->

	/sources/fsharp/packages/FSharp.Compiler.Tools.4.0.0.1/tools/Microsoft.FSharp.Targets: error : Tool exited with code: 1. Output: 
Unhandled Exception:
System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "FSComp.resources" was correctly embedded or linked into assembly "FSharp.Compiler-proto" at compile time, or that all the satellite assemblies required are loadable and fully signed.
  at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing (System.String fileName) <0x7f92b281b430 + 0x00270> in <filename unknown>:0 
  at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet (System.Globalization.CultureInfo culture, System.Collections.Generic.Dictionary`2[TKey,TValue] localResourceSets, System.Boolean tryParents, System.Boolean createIfNotExists, System.Threading.StackCrawlMark& stackMark) <0x7f92b28198b0 + 0x002d7> in <filename unknown>:0 

... snip ...

  at Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ErrorLogger.ErrorRecovery (Microsoft.FSharp.Compiler.ErrorLogger+ErrorLogger x, System.Exception exn, Microsoft.FSharp.Compiler.Range+range m) <0x4146e4e0 + 0x0027b> in <filename unknown>:0 


	 0 Warning(s)
	 1 Error(s)
--------

The full error stack trace is https://gist.github.com/atsushieno/fb295b9768dadcf900fb501f75d13221


All the following versions resulted the same:

Mono JIT compiler version 4.2.1 (Debian 4.2.1.102+dfsg2-7ubuntu4)
Mono JIT compiler version 4.4.0 (tarball 2016年  5月 12日 木曜日 20:44:23 JST)
Mono JIT compiler version 4.5.1 (master/3c2fd4f 2016年  5月 12日 木曜日 08:23:10 JST)
Comment 1 Alexander Köplinger [MSFT] 2016-05-12 12:59:43 UTC
I can repro on OSX too with Mono 4.4.
Comment 2 Alexander Köplinger [MSFT] 2016-05-12 13:56:29 UTC
If I compile with Mono 4.2.3.4 on Ubuntu 14.04 then it works fine.

Looking at the differences in ./src/fsharp/FSharp.Compiler-proto/obj/proto/FSharp.Compiler-proto.dll between 4.4 and the 4.2 compiled assemblies in the former case it is missing the resources, so this seems to me like a regression somewhere in 4.4. I'm wondering why you hit the same in 4.2.1 though (did you clean the repository after switching Mono versions?)
Comment 3 Alexander Köplinger [MSFT] 2016-05-12 15:54:33 UTC
Ok, so the issue is that the FSharp compiler package that is used for bootstrapping has a .targets that contains this:

    <UsingXBuild Condition="Exists('$(MSBuildExtensionsPath32)\..\4.0\Mono.Posix.dll')">true</UsingXBuild>

This doesn't work on Mono 4.4 since the <prefix>/lib/mono/4.0 folder doesn't contain assemblies anymore (the reference assemblies were renamed to 4.0-api).

It was already fixed with https://github.com/fsharp/fsharp/pull/525 in fsharp upstream, but apparently hasn't made it's way into the bootstrap package yet.

We'll do the same as we did for nunit in https://bugzilla.xamarin.com/show_bug.cgi?id=38331 and copy the stub Mono.Posix.dll to the 4.0 folder so this keeps working: https://github.com/mono/mono/pull/2990
Comment 4 Alexander Köplinger [MSFT] 2016-05-12 16:18:04 UTC
Merged to master with https://github.com/mono/mono/pull/2990.

Filed a trello card for getting the fix into 4.4: https://trello.com/c/cdL4uAJA/252-mono-bug-41052-fsharp-build-from-source-fails
Comment 5 Shruti 2016-05-13 13:29:09 UTC
*****************
Reproduce Status:
*****************
I am able to reproduce this issue on  Mono 4.4.0.142.
Error Log: https://gist.github.com/shrutis360/2b0ad4fadaf62fec280b587e35abfeae

*****************
Verify Status:
*****************
I have verified this issue with master build MonoFramework-MDK-4.5.1.578.macos10.xamarin.universal_4b2901be9fc92cd1d625e2f8811857fc11781cb8
Now build does not get fail while make 
Terminal Output :https://gist.github.com/shrutis360/5d055bf45101208e5f5129b3c910a711


Ι will close the issue once verify with C7 builds
Comment 6 Shruti 2016-05-16 06:01:56 UTC
I have verified this issue with master build MonoFramework-MDK-4.4.0.165.macos10.xamarin.universal_d8ae4a1a3b6e9f9f460e81e4e818a24b4fc392be
Now build does not get fail after make 

Terminal Output: https://gist.github.com/shrutis360/e8aef4d24d9fd9882b32eb29d3f6b8f7.


This is working fine. Hence, Closing this issue.