Bug 27218 - Mono doesn't build on Windows-json.c/h
Summary: Mono doesn't build on Windows-json.c/h
Status: RESOLVED ANSWERED
Alias: None
Product: Runtime
Classification: Mono
Component: Build ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-02-19 11:28 UTC by Ken Domino
Modified: 2018-01-11 18:15 UTC (History)
7 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Ken Domino 2015-02-19 11:28:47 UTC
Hi Folks,

Just tried to do a build of the trunk in Windows Visual Studio 2013. It does not build as is. See the explanation below and diff below to get it to build.

Problems:
1) mono/metadata/decimal-ms.c declares "MonoDecimal result;" after code. That doesn't work for C89-compliant compilation--which is what happens because it's a ".C" file in MSVC. It should be moved to the point after the open brace.
2) msvc/libmono.vcxproj -- libmono has a new dependency on libmonoutils to json.c code.
3) msvc/libmonoutils.vcxproj -- json.c is not an include header file, but it's labeled that way in the .vcxproj file.

Here are the diffs to get it to build.
diff --git a/libgc/depcomp b/libgc/depcomp
index 3480ce4..16549e4 100755
Binary files a/libgc/depcomp and b/libgc/depcomp differ
diff --git a/libgc/missing b/libgc/missing
index dd58370..ed47db0 100755
Binary files a/libgc/missing and b/libgc/missing differ
diff --git a/mcs/jay/jay.vcxproj b/mcs/jay/jay.vcxproj
index ab29caf..80468e4 100644
--- a/mcs/jay/jay.vcxproj
+++ b/mcs/jay/jay.vcxproj
@@ -19,12 +19,12 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v110</PlatformToolset>
+    <PlatformToolset>v120</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v110</PlatformToolset>
+    <PlatformToolset>v120</PlatformToolset>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
diff --git a/mono/metadata/decimal-ms.c b/mono/metadata/decimal-ms.c
index 1efc614..abb59ad 100644
--- a/mono/metadata/decimal-ms.c
+++ b/mono/metadata/decimal-ms.c
@@ -2231,10 +2231,10 @@ mono_decimal_compare (MonoDecimal *left, MonoDecimal *right)
 	// operand is +, 0, or -.
 	//
 	if (left_sign == right_sign) {
+		MonoDecimal result;
 		if (left_sign == 0)    // both are zero
 			return MONO_DECIMAL_CMP_EQ; // return equal
 
-		MonoDecimal result;
 
 		DecAddSub(left, right, &result, DECIMAL_NEG);
 		if (DECIMAL_LO64_GET(result) == 0 && result.Hi32 == 0)
diff --git a/msvc/libmono.vcxproj b/msvc/libmono.vcxproj
index e602b28..0a55f8d 100644
--- a/msvc/libmono.vcxproj
+++ b/msvc/libmono.vcxproj
@@ -604,6 +604,9 @@
       <Project>{eb56000b-c80b-4e8b-908d-d84d31b517d3}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="libmonoutils.vcxproj">
+      <Project>{8fc2b0c8-51ad-49df-851f-5d01a77a75e4}</Project>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
diff --git a/msvc/libmonoutils.vcxproj b/msvc/libmonoutils.vcxproj
index a091267..cb70602 100644
--- a/msvc/libmonoutils.vcxproj
+++ b/msvc/libmonoutils.vcxproj
@@ -73,7 +73,7 @@
     <ClCompile Include="..\mono\utils\mono-hwcap.c" />
     <ClCompile Include="..\mono\utils\mono-hwcap-x86.c" />
     <ClCompile Include="..\mono\utils\bsearch.c" />
-    <ClInclude Include="..\mono\utils\json.c" />    
+    <ClCompile Include="..\mono\utils\json.c" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\mono\utils\dlmalloc.h" />
Comment 4 Ludovic Henry 2018-01-11 18:15:42 UTC
It has been fixed as of https://github.com/mono/mono/commit/77ba59959f597398e222660eeaa6f44e85ce79b8. Please reopen if you still have trouble compiling with VS2013. Thank you