Build SSCLI20 under VS2008 full Document (完全手册)

以前build过几次sscli2都成功了,这次换了个新的环境,没想到出了一大堆的问题。折腾了半天,最终搞定,把解决问题的过程和方法都记录下来。

 

首先说说build的过程中参考过的链接和资源。

1.         首先就是sscli自带的文档:Building the Shared Source CLI 2.0 and C# 2.0 Source Tree

/sscli20/docs/buildtools/building_sscli.html),这里详细介绍了build的过程,build中需要用到的工具和方法,等。

2.         Shared Source CLI 2.0 Build Environment Variable Scripts(env.bat, env.csh, env.sh)sscli20/docs/buildtools/env.html),详细介绍了设置环境变量和buildall等工具的参数设置。Build中用到的其它工具的参考说明可以到sscli20/docs/buildtools这个目录下找到。

3.         张羿的“.NET / Rotor 源码研究1 - Building Rotor”,链接地址为:

http://blog.csdn.net/ATField/archive/2006/12/31/1471465.aspx

4.         Jeremy Kuhne's “SSCLI 2.0 and Visual Studio 2008”,URL:

http://blogs.msdn.com/jeremykuhne/archive/2008/02/19/sscli-2-0-and-visual-studio-2008.aspx

5.         XwangVisual Studio 2008的环境下Build SSCLI 2.0(ROTOR),URL:

http://www.cnblogs.com/zhzkl/archive/2008/05/13/1194258.html

6.         Building SSCLI20 (Rotor) in VS2008,URL:

http://code.msdn.microsoft.com/BuildRotorInVS2008,by codekaizen

 

 

还有就是发现问题和解决问题的过程了.

 

首先,如果是需要再AMD的系列CPU上面Build,最好参考codekaizen提供的源码修改包。其正对AMDcpu再上面的4上面做了一些小的修改:

l  In the modified win.env.bat file, I added @set PROCESSOR_ARCHITECTURE=x86 to line 106 to get it to build under AMD64. The build environment was X86 already, but apparently it wasn't enough.

l  On line 144 of the modified tools/nmake/def.mak file, comment out #CFLAGS = $(CFLAGS) -Wp64, since the flag is deprecated.

l  This one didn't seem right, but it was the most expedient: comment out lines 73 to 79 in pal/exception.c, which is the declaration of a function RtlUnwind which is apparently never used or defined. It could be some platform specific call, which works on a Windows machine.

其中如果是再intelcpu上面,按照他说的commentTrlUnwind,会出现:

 

d:/rotor/sscli20/pal/win32/exception.c(143) : error C2094: label 'RtlUnwind' was undefined

NMAKE : fatal error U1077: '"C:/Program Files/Microsoft Visual Studio 9.0/VC/BIN/cl.EXE"' : return code '0x2'

 

         这样的错误,这个时候,把他再pal/win32exception.c73行对

/*

WINBASEAPI

VOID

WINAPI

RtlUnwind(PVOID TargetFrame,

        PVOID TargetIp,

        PVOID ExceptionRecord,

        PVOID ReturnValue);

*/

的注释,去掉即可。

 

另外说说VC开发环境变量设置的问题。

修改sscli源码让其在VS2008下面运行的第一步,就是要修改MSVCDIRMSDEVDIR两个环境变量。在sscli20/docs/buildtools/env.html这个地方,可以看到MSVCDir的定义,指向的是:%VCINSTALLDIR%/VC,指向的是Microsoft Visual C++ 2005 root directory

如果不修改msvcdir变量,在env debug的时候,就会报出msvcdir没有设置的错误。

修改/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%

 

想这样因为环境变量引起的问题还挺多,可以参考Jeremy Kuhne的文章一一修改。另外,也可以看看上面的几个链接中他们在build的时候遇到的问题与解决方法。

 

Xwangblog上面把他的那个包给下载下来,然后直接覆盖到sscli,如果你出现code编码的保存方式不同造成的错误,请参考zhangyi的文章修改OSlocation。如果你出现不能正确识别操作系统的错误,也请参考zhangyi的那篇文章。如果你出现一些环境变量的莫名其妙的问题,请参考xwang的解决方法。

运行env debugbuildall

十分钟之后,build完成好了,就可以运行:

 

D:/Rotor/sscli20>cd binaries.x86dbg.rotor

 

D:/Rotor/sscli20/binaries.x86dbg.rotor>csc ../samples/hello/hello.cs

Microsoft (R) Shared Source CLI C# Compiler version 2.0.0001

for Microsoft (R) Shared Source CLI version 2.0.0

Copyright (C) Microsoft Corporation. All rights reserved.

 

D:/Rotor/sscli20/binaries.x86dbg.rotor>clix hellp.exe

hellp.exe: The system cannot find the file specified.

 

D:/Rotor/sscli20/binaries.x86dbg.rotor>clix hello.exe

Hello World!

 

Enjoy Rotor, Enjoy Code, and Enjoy research! Have fun!

 

Lbq1221119@cnblogs, first post at http://sscli.cnblogs.com

11/11/2008 9:42 PM

你可能感兴趣的:(Build SSCLI20 under VS2008 full Document (完全手册))