Solution of Problems in Building sscli via Visual Studio 2008

前些天,发布了一个能够在Visual Studio2005查看sscli源代码的项目文件。不过,在VS2008中编译sscli,会出现一大堆错误。这里,有幸在Jeremy Kuhne's Blog上面找到了一篇文章来解决这个问题。

原文链接可以点这里。这里,时间原因就不翻译过来了,希望对sscli团队中研究这个的同志们有帮助,特别希望“装配脑袋”能看到这篇文章。

The currently available SSCLI 2.0 (Rotor) does not build successfully with Visual Studio 2008.   I've managed to make it build and I thought I'd share my changes.   Be very aware:

  1. I haven't done anything resembling thorough testing on these changes
  2. I made the changes so that it would build for me on my 32bit Vista machine
  3. I avoided changing source files, and focused on build files
  4. The warnings I disabled are pretty tame, see #3
  5. I tried to keep the changes to a minimum
  6. I know next to nothing about NMAKE
  7. I have no idea about any MS plans regarding SSCLI and VS2008
  8. This is does not constitute official support for building SSCLI in VS2008

\sscli20\mswin32.startup.pl

  1. change the if block that begins at line 41:

if (my $msvcdir = Get("MSVCDir")) {

    # These are the INCLUDE paths used during the primary bootstrap.

    my $winsdkdir = Get("ROTOR_WINSDKDIR");

    Set("SDK_INC_PATH_BOOT", catdir ($winsdkdir, "include"));

    Set("CRT_INC_PATH_BOOT", catdir ($msvcdir, "Include"));

    Set("SDK_LIB_PATH", catdir ($winsdkdir, "lib"));

    Set("CRT_LIB_PATH", catdir ($msvcdir, "lib"));

    Set("VC_BIN_PATH", catdir ($msvcdir, "bin"));

}

 \sscli20\win.env.bat

  1. change %VS80COMNTOOLS% on line 37 to %VS90COMNTOOLS%
  2. after line 42, insert the following:

REM Set the SDK path

if "%ROTOR_WINSDKDIR%"=="" set ROTOR_WINSDKDIR=%WindowsSdkDir%

if "%ROTOR_WINSDKDIR%"=="" set ROTOR_WINSDKDIR=%MSVCDIR%\PlatformSDK

call :ShortName "%ROTOR_WINSDKDIR%"

set ROTOR_WINSDKDIR=%RESULT%

\sscli20\clr\src\classlibnative\nls\wks\sources; \sscli20\clr\src\debug\daccess\wks\sources; \sscli20\clr\src\vm\dacwks\sources; \sscli\clr\src\classlibnative\float\wks\sources; \sscli\clr\src\dlls\mscordac\wks\sources; \sscli\clr\src\vm\wks1\sources; \sscli\clr\src\vm\wks2\sources; \sscli\clr\src\vm\wks3\sources; \sscli\clr\src\vm\wks4\sources

  1. Kill line 16 (MSC_WARNING_LEVEL =-Wp64)

\sscli\clr\src\classlibnative\float\sources.inc 

  1. Kill line 21 (COMPILER_WARNINGS =/W4)

\sscli20\clr\src\toolbox\sos\strike\sources

  1. Kill line 18 (MSC_WARNING_LEVEL =/W4)

\env\bin\devdiv.def

  1. Change line 334 to SUBSYSTEM_WINVER = ,5.00
  2. Change line 338 to SUBSYSTEM_CONVER = ,5.00

\pal\inc\vs9.h (NEW FILE)

// Patch up the conflicting defines to allow building with VS9

#undef MAKEWORD

#undef MAKELONG

#undef LOWORD

#undef HIWORD

#undef LOBYTE

#undef HIBYTE

#undef IPPROTO_IP

#undef IPPROTO_ICMP

#undef IPPROTO_IGMP

#undef IPPROTO_GGP

#undef IPPROTO_TCP

#undef IPPROTO_PUP

#undef IPPROTO_UDP

#undef IPPROTO_IDP

#undef IPPROTO_ND

#undef IPPROTO_RAW

#undef INADDR_ANY

#undef INADDR_BROADCAST

#undef INADDR_NONE

 

#pragma warning (disable :4985)

 

#define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER    224

#define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER    240

 

#ifdef _WIN64

#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER     IMAGE_SIZEOF_NT_OPTIONAL64_HEADER

#else

#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER     IMAGE_SIZEOF_NT_OPTIONAL32_HEADER

#endif

 \sscli20\pal\win32\win32pal.h

  1. Add #include <Vs9.h> after line 1272 (before the windows includes) 

\sscli20\tools\binplace\sources; \sscli\clr\src\tools\ildbdump\sources

  1. Change line 27 SUBSYSTEM_VERSION=4.00 to SUBSYSTEM_VERSION=5.00

\sscli20\tools\resourcecompiler\sources

  1. Change line 31 SUBSYSTEM_VERSION=4.00 to SUBSYSTEM_VERSION=5.00

\sscli20\tools\cppmunge\sources

  1. Change line 24 SUBSYSTEM_VERSION=4.00 to SUBSYSTEM_VERSION=5.00

\sscli20\tools\build\sources

  1. Change line 48 SUBSYSTEM_VERSION=4.00 to SUBSYSTEM_VERSION=5.00

\sscli20\pal\win32\make.cmd

  1. Kill the if not "%ROTOR_TOOLSET_VERSION%" block from line 43-46

\sscli20\clr\src\vm\sources.inc

  1. Add -wd4800 to the end of line 22
  2. Delete lines 23-25

\ssclie20\clr\src\classlibnative\nls\sources.inc

  1. Add -wd4800 to the end of line 20

\sscli20\csharp\sccomp\sources.inc

  1. Kill lines 52-54 (USER_C_FLAGS)

\sscli20\pal\win32\rotor_pal.src

  1. Replace line 57 (#if _MSC_VER == 1400) with:

#if _MSC_VER == 1500

  #define _MSVCRT MSVCR90D

 #elif _MSC_VER == 1400

  1. b.  Replace line 67 ( #if _MSC_VER == 1400) with:

#if _MSC_VER == 1500

  #define _MSVCRT MSVCR90

 #elif _MSC_VER == 1400

 

Well there you have it.  Hopefully I didn't miss any of my changes or make too many typos.  I ran through these instructions on a clean install of SSCLI and was able to successfully build per the docs and compile and run HelloWorld.

你可能感兴趣的:(Build)