Files
yallie 9fa3874800 Added the contents of the archive.
Moved the original file to the archive subfolder.
2017-11-20 16:11:42 +03:00

937 lines
34 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Building the Shared Source CLI and C# Source Tree</title>
<link rel="stylesheet" type="text/css" href="../rotor.css">
</head>
<body>
<h1>Building the Shared Source CLI and C# Source Tree</h1>
<h3>Contents</h3>
<ul>
<li><a href="#Quickstart">QuickStart</a></li>
<li><a href="#OverviewoftheSharedSourceCLIBuildProcess">Overview of the Shared
Source CLI Build Process</a></li>
<li><a href="#SharedSourceCLIBuildDetailsandScenarios">Shared Source CLI Build
Details and Scenarios</a><ul>
<li><a href="#PrimaryBootstrap">Primary Bootstrap</a></li>
<li><a href="#SecondaryBootstrap">Secondary Bootstrap</a></li>
<li><a href="#SharedSourceCLICoreCLI">Shared Source CLI Core CLI, C# Compiler,
Base Class Libraries, and Supporting Tools</a></li>
<li><a href="#FXClassLibraries">FX Class Libraries</a></li>
<li><a href="#ManagedClassLibraries">Managed Class Libraries</a></li>
<li><a href="#ManagedCompilers">Managed Compilers</a></li>
</ul>
</li>
<li><a href="#UsingBuildLogstoTroubleshootBuildProblems">Using Build Logs to
Troubleshoot Build Problems</a></li>
<li><a href="#NotesHintsandTips">Notes, Hints, and Tips</a><ul>
<li><a href="#AutogeneratedFiles">Autogenerated Files</a></li>
<li><a href="#FasterRebuilds">Faster Rebuilds</a></li>
<li><a href="#FilePreprocessing">File Preprocessing</a></li>
<li><a href="#BaseClassLibraryBuild">Base Class Library Build</a></li>
</ul>
</li>
</ul>
<h2><a name="Quickstart"></a>QuickStart</h2>
<p>The following steps represent the quickest and most reliable way to build the
Microsoft&reg; Shared
Source CLI (SSCLI) implementation:</p>
<p>On the Microsoft&reg; Windows&reg; operating system:</p>
<ol>
<li>Change directories into the root of the SSCLI source tree.</li>
<li>Run the <a href="env.html">env.bat</a> batch file.</li>
<li>Run the <a href="buildall.html">buildall.cmd</a> batch file.</li>
</ol>
<p>On the UNIX system-based platforms:</p>
<ol>
<li>Switch to the root of the SSCLI source tree.</li>
<li>Run the correct <a href="env.html">environment variable script</a> for
your shell:<ul>
<li>If you use the [t]csh shell, enter: source env.csh</li>
<li>If you use the [ba|k]sh shell, enter: . ./env.sh [option]
</li>
</ul>
</li>
<li>Run the <a href="buildall.html">buildall</a> script.</li>
</ol>
<h2><a name="OverviewoftheSharedSourceCLIBuildProcess"></a>Overview of the
Shared Source CLI&nbsp; (SSCLI) Build Process</h2>
<p>The SSCLI build process is designed in a modular manner.&nbsp; You can build
all of the SSCLI or only parts of the SSCLI; however, there are strict
sequential dependencies between elements of the source tree.&nbsp; In all cases,
the build process requires that your environment variables be set correctly
before building. For more information on correctly configuring your environment
prior to building, see <a href="env.html">env.html</a>.</p>
<p>Note that the path to and directory name of the location where the SSCLI is installed
cannot contain spaces.&nbsp;Some tools that the build process depends on do not
work correctly on paths containing spaces.</p>
<p>Elements of the SSCLI implementation depend on other
elements in a strict sequential order.&nbsp;The best way to start modifying
elements of the source tree is to build the entire tree using the buildall batch
file or script that will build the required dependencies in the correct order and have them
available in the path.&nbsp;After that it is possible to selectively rebuild
specific elements of the source tree.</p>
<p>The SSCLI source tree has the following major elements:</p>
<ol>
<li>Primary bootstrap elements: the PAL and unmanaged bootstrap build tools.</li>
<li>Secondary bootstrap elements: the remaining tools and support infrastructure.</li>
<li>The core CLI implementation, base class libraries, the C# compiler, and
supporting tools.</li>
<li>The FX class libraries and supporting tools.</li>
<li>Other assemblies.</li>
<li>Managed compilers.</li>
</ol>
<p>In general each major element depends on the preceding element having
been built and the output of the build in the path.&nbsp;There are more
complicated dependencies within each of the major elements.&nbsp; The dependency
order of the major elements can be determined by reading buildall.bat or the
buildall script.&nbsp;Dependency orders within large elements such as the
CLI, C#, and base class libraries or the FX class libraries can be
determined by reading the order of the files in the dirs file at the
root of the relevant source tree.&nbsp; </p>
<h2><a name="SharedSourceCLIBuildDetailsandScenarios"></a>SSCLI Build Details and Scenarios</h2>
<p>You should always use buildall.cmd or the buildall script to build the entire
source tree before attempting to work with separate elements.&nbsp;The
scenarios below describe the necessary procedures for modifying and building
specific portions of the SSCLI source tree.</p>
<p>The SSCLI build process works off of relative path location.&nbsp;You must
switch to the correct directory where the sources files or makefiles are and
then execute the required command.</p>
<p>In the following tables if the same build commands work for both the
Microsoft Windows and UNIX system-based platforms, then the commands are specified using the
Windows syntax.&nbsp; Similarly, if the location for source or output is
the same on all operating systems only the path to the Windows location is
specified and the path on UNIX system-based platforms should be inferred.</p>
<p>Available build options for the build utility are specified in
<a href="buildutility.html">buildutility.html</a>.&nbsp; Builds that use
make.cmd support only the <b>-c</b> (clean) option to indicate that existing object files
are to be deleted.</p>
<h3><a name="PrimaryBootstrap"></a>Primary Bootstrap</h3>
<p>The primary bootstrap element of the SSCLI source tree uses makefiles during
the initial build rather than the build utility, because this utility and the other
supporting build tools have not been built yet.&nbsp; On Windows, the build
process uses make.cmd batch files which then invoke the Microsoft Program
Maintenance Utility (nmake.exe provided in the
path by Microsoft&reg; Visual Studio&reg; .NET) to process the required makefiles.&nbsp;On UNIX system-based platforms, the build process uses various implementations of
make to process the makefiles.</p>
<p>The primary build bootstrap subelements are:</p>
<ul>
<li>The Platform Adaptation Layer (PAL).&nbsp;The PAL is used by build and
other tools so it must be built first.</li>
<li>The nmake makefile tool (the version built during the build process is only used on
UNIX system-based platforms).</li>
<li>The Build Output Manager tool.</li>
<li>The build utility.</li>
</ul>
<p>The PAL must be built before any other builds are attempted.&nbsp; </p>
<table border="1" width="90%">
<TR VALIGN="top">
<TH width="20%">Build scenario</TH>
<TH width="8%">Operating System</TH>
<TH width="18%">Source location</TH>
<TH width="26%">Build commands</TH>
<TH width="68%">Build output</TH>
</TR>
<TR VALIGN="top">
<TD width="20%" rowspan="2">Build the Platform Adaptation
Layer (PAL).</TD>
<TD width="8%"><b>Windows</b></TD>
<TD width="18%">%ROTOR_DIR%\pal\<b>win32</b></TD>
<TD width="26%">cd %ROTOR_DIR%<i>\</i>pal\win32<br>
build [options]<p>(If build.exe is not built yet, you can use make.cmd)</TD>
<TD width="68%">%TARGETCOMPLUS%\rotor_pal.dll</TD>
</TR>
<TR VALIGN="top">
<TD width="8%"><b>UNIX system-based platforms</b></TD>
<TD width="18%">${ROTOR_DIR}/pal/<b>unix</b></TD>
<TD width="26%">cd ${ROTOR_DIR}<i>/</i>pal/unix<br>make</TD>
<TD width="68%">${TARGETCOMPLUS}/librotor_pal.so</TD>
</TR>
<TR VALIGN="top">
<TD width="20%">Build the nmake makefile tool.&nbsp;
<p>The SSCLI version of nmake is used only on Unix operating systems because the
SSCLI build
process on Windows assumes nmake.exe is in the path.</TD>
<TD width="8%">&nbsp;<p><b>UNIX system-based platforms</b></TD>
<TD width="18%">${ROTOR_DIR}/tools/nmake</TD>
<TD width="26%">cd ${ROTOR_DIR}<i>/</i>tools/nmake<br>make</TD>
<TD width="68%">${TARGETCOMPLUS}/nmake</TD>
</TR>
<TR VALIGN="top">
<TD width="20%" rowspan="2">Build the VBuild Output Manager tool.</TD>
<TD width="8%"><b>Windows</b></TD>
<TD width="18%" rowspan="2" >%ROTOR_DIR%\tools\binplace</TD>
<TD width="26%">cd %ROTOR_DIR%<i>\</i>tools\nmake<br>
make [options]<p>The &quot;make&quot; command executes make.cmd.</TD>
<TD width="68%">%TARGETCOMPLUS%\binplace.exe</TD>
</TR>
<TR VALIGN="top">
<TD width="8%"><b>UNIX system-based platforms</b></TD>
<TD width="26%">cd ${ROTOR_DIR}<i>/</i>tools/nmake<br>make</TD>
<TD width="68%">${TARGETCOMPLUS}/binplace</TD>
</TR>
<TR VALIGN="top">
<TD width="20%" rowspan="2">Build the build utility.</TD>
<TD width="8%"><b>Windows</b></TD>
<TD width="18%" rowspan="2" >%ROTOR_DIR%\tools\build</TD>
<TD width="26%">cd %ROTOR_DIR%<i>\</i>tools\build<br>
make [options]<p>The &quot;make&quot; command executes make.cmd.</TD>
<TD width="68%">%TARGETCOMPLUS%\build.exe</TD>
</TR>
<TR VALIGN="top">
<TD width="8%"><b>UNIX system-based platforms</b></TD>
<TD width="26%">cd ${ROTOR_DIR}<i>/</i>tools/build<br>make</TD>
<TD width="68%">${TARGETCOMPLUS}/build</TD>
</TR>
</table>
<h3><a name="SecondaryBootstrap"></a>Secondary Bootstrap</h3>
<p>In the secondary bootstrap portion of the source tree it is assumed that the build tools are sufficiently complete to
enable using them to build.&nbsp;This means that the build directives are specified in a sources file
(see <a href="buildutility.html">buildutility.html</a>) and not in a makefile or
make.cmd file.</p>
<p>Subelements of the primary bootstrap are:</p>
<ul>
<li>The resource compiler.</li>
<li>The PAL runtime (PAL RT).&nbsp;The PAL RT supports some higher-level
functionality shared across platforms by the SSCLI implementation and
supporting tools.</li>
</ul>
<p>For the following tools and the PAL RT, all the primary bootstrap utilities
and the PAL must be built, functional, and in the path.&nbsp;The build utility
uses sources and dirs files in the same way on both the Windows and
UNIX system-based platforms.</p>
<table border="1" width="90%">
<TR VALIGN="top">
<TH width="28%">Build scenario</TH>
<TH width="12%">Operating system</TH>
<TH width="28%">Source location</TH>
<TH width="47%">Build commands</TH>
<TH width="52%">Build output</TH>
</TR>
<TR VALIGN="top">
<TD width="28%" rowspan="2">Build the resource compiler tool.</TD>
<TD width="12%"><b>Windows</b></TD>
<TD width="28%" rowspan="2">%ROTOR_DIR%\tools\<br>
resourcecompiler</TD>
<TD width="47%" rowspan="2">cd %ROTOR_DIR%<i>\</i>tools\resourcecompiler<br>
build [options]</TD>
<TD width="52%">%TARGETCOMPLUS%\<br>
resourcecompiler.exe</TD>
</TR>
<TR VALIGN="top">
<TD width="12%"><b>UNIX system-based platforms</b></TD>
<TD width="52%">${TARGETCOMPLUS}/<br>
resourcecompiler</TD>
</TR>
<TR VALIGN="top">
<TD width="28%" rowspan="2">Build the PAL RT common shared
utility infrastructure.</TD>
<TD width="12%"><b>Windows</b></TD>
<TD width="28%" rowspan="2">%ROTOR_DIR%\palrt\src</TD>
<TD width="47%" rowspan="2">cd %ROTOR_DIR%<i>\</i>palrt\src<br>
build [options]</TD>
<TD width="52%">%TARGETCOMPLUS%\rotor_palrt.dll</TD>
</TR>
<TR VALIGN="top">
<TD width="12%"><b>UNIX system-based platforms</b></TD>
<TD width="52%">${TARGETCOMPLUS}/<br>
librotor_palrt.so</TD>
</TR>
</table>
<br/>
<hr>
<p align="left">For all the following build scenarios the build commands are:<blockquote>
<pre>cd &lt;source_location&gt;
<br>build [options]</pre>
</blockquote>
<p>For more details on the build
utility options see
<a href="buildutility.html">buildutility.html</a>.&nbsp; The most common options are -c for clean build and -z to
skip calculating dependencies.<br><hr>
<h3><a name="SharedSourceCLICoreCLI"></a>SSCLI Core, C# Compiler, Base Class Libraries, and Supporting Tools</h3>
<p>After the primary and secondary bootstrap elements are built, it is possible
to proceed with building the core SSCLI
implementation, C# compiler, and base class libraries.&nbsp; This section of the
build is very complex due to interdependencies between the core CLI
code, C#, and the base class libraries.&nbsp; When making changes across
subelements of this tree, you should rebuild the entire tree starting at
%ROTOR_DIR%\clr\src.&nbsp; </p>
<p>Some critical
subelements of this tree are:</p>
<ul>
<li>utilcode<ul>
<li>Common shared C++ utility code.</li>
</ul>
</li>
<li>vm<ul>
<li>A large portion of the CLI implementation.</li>
</ul>
</li>
<li>fusion<ul>
<li>Assembly searching and binding.</li>
</ul>
</li>
<li>dlls<ul>
<li>Unmanaged CLI support libraries.</li>
</ul>
</li>
<li>ilasm<ul>
<li>The ilasm assembler tool.</li>
</ul>
</li>
<li>ildasm<ul>
<li>The ildasm disassembly tool.</li>
</ul>
</li>
<li>fjit<ul>
<li>The just-in-time (JIT) compiler implementation.</li>
</ul>
</li>
<li>tools<ul>
<li>Supporting tools and utilities.</li>
</ul>
</li>
<li>csharp<ul>
<li>The C# compiler.</li>
</ul>
</li>
<li>bcl<ul>
<li>The base class libraries.&nbsp; These are the most fundamental managed
code assemblies.</li>
</ul>
</li>
<li>toolbox<ul>
<li>Some additional managed tools.</li>
</ul>
</li>
</ul>
<p>&nbsp;</p>
<table border="1" width="90%">
<TR VALIGN="top" width=100%>
<TH width="25%" height="16">Build scenario</TH>
<TH width="5%" height="16">Operating System</TH>
<TH width="25%" height="16">Source location</TH>
<TH width="25%" height="16">Build output</TH>
</TR>
<TR VALIGN="top">
<TD width="25%" height="70">Modify any CLI, C#, or&nbsp; base class library file
and rebuild the entire tree.</TD>
<TD width="5%" height="70"><b>All</b></TD>
<TD width="25%" height="70">%ROTOR_DIR%\clr\src</TD>
<TD width="25%" height="70">Most of the contents of the
%TARGETCOMPLUS% directory and subdirectories are produced from this build
command.</TD>
</TR>
<TR VALIGN="top">
<TD width="25%" height="383">Build the main CLI execution engine directory: VM<p>
The .lib file produced from this step is used to link the
sscoree.dll/libsscoree.so/libsscoree.dylib library.&nbsp; After successfully
building the execution engine, you must relink the resulting file
(cee_wks.lib) into the sscoree.dll/libsscoree.so/libsscoree.dylib library in order
to incorporate your change. Do this by building the
mscoree directory, as detailed further down in this table.</p>
<p>
Changing .asm/.s files requires either a clean build using -c, or manual
deletion of the .obj file from under wks/obj{d|df|}/rotor_x86/<p>
The src\vm directory contains the dirs file, and src\vm\wks directory contains the sources
file
</TD>
<TD width="5%" height="383"><b>All</b></TD>
<TD width="25%" height="383">%ROTOR_DIR%\clr\src\vm</TD>
<TD width="25%" height="383">%ROTOR_DIR%\clr\bin\rotor_x86\<br>
%DDKBUILDENV%\cee_wks.lib</TD>
</TR>
<TR VALIGN="top">
<TD width="25%" rowspan="2" height="260">Build the C# compiler and Assembly Linker.</TD>
<TD width="5%" height="127"><b>Windows</b></TD>
<TD width="25%" rowspan="2" height="260">%ROTOR_DIR%\clr\src\csharp</TD>
<TD width="25%" height="127">%TARGETCOMPLUS%\csc.exe<p>%TARGETCOMPLUS%\cscomp.dll</p>
<p>%TARGETCOMPLUS%\al.exe</p>
<p>%TARGETCOMPLUS%\alink.dll</TD>
</TR>
<TR VALIGN="top">
<TD width="5%" height="127"><b>UNIX system-based platforms</b></TD>
<TD width="25%" height="127">${TARGETCOMPLUS}/csc<p>${TARGETCOMPLUS}/libcscomp.so</p>
<p>${TARGETCOMPLUS}/al</p>
<p>${TARGETCOMPLUS}/libalink.so</TD>
</TR>
<TR VALIGN="top">
<TD width="25%" rowspan="2" height="133">Build the C# compiler.</TD>
<TD width="5%" height="57"><b>Windows</b></TD>
<TD width="25%" rowspan="2" height="133">%ROTOR_DIR%\clr\src\csharp\csharp</TD>
<TD width="25%" height="57">%TARGETCOMPLUS%\csc.exe<p>%TARGETCOMPLUS%\cscomp.dll</TD>
</TR>
<TR VALIGN="top">
<TD width="5%" height="70"><b>UNIX system-based platforms</b></TD>
<TD width="25%" height="70">${TARGETCOMPLUS}/csc<p>${TARGETCOMPLUS}/libcscomp.so</TD>
</TR>
<TR VALIGN="top">
<TD width="25%" height="156">Build the base class libraries (BCL).<p>Note: All of the BCLs are built
through one call to the C# compiler, passing all .cs files by way of a
response file. There is no partial build of the BCLs.<p>See the note below about
multistage build of mscorlib.dll.<br>
</TD>
<TD width="5%" height="156"><b>All</b></TD>
<TD width="25%" height="156">%ROTOR_DIR%\clr\src\bcl</TD>
<TD width="25%" height="156">%TARGETCOMPLUS%\mscorlib.dll<p>
%TARGETCOMPLUS%\*.nlp</TD>
</TR>
<TR VALIGN="top">
<TD width="25%" height="220">Build core CLI dynamic libraries and .lib files.
These can also be built individually in each subdirectory:<ul>
<li>shim - creates shim.lib support libbrary</li>
<li>mscorsn - strongname verification</li>
<li>mscorpe - PE file reading and writing</li>
<li>mscoree -&nbsp; See table item below.</li>
<li>mscordbi and mscordbc - debugging services<br>
&nbsp;</li>
</ul>
</TD>
<TD width="5%" height="220"><b>All</b></TD>
<TD width="25%" height="220">%ROTOR_DIR%\clr\src\dlls</TD>
<TD width="25%" height="220">(See individual components <i>sources</i> file.)</TD>
</tr>
<TR VALIGN="top">
<TD width="25%" rowspan="3" height="144">Build the mscoree directory.&nbsp; This directory
builds the dynamic library that is loaded first when the SSCLI CLI execution
engine starts up.<p>This library&nbsp; is a merged combination of the
mscoree.dll and mscorwks.dll/mscorsvr.dll in the Windows .NET Framework
implementation.</TD>
<TD width="5%" height="32"><b>Windows</b></TD>
<TD width="25%" rowspan="3" height="144">%ROTOR_DIR%\clr\src\dlls\mscoree</TD>
<TD width="25%" height="32">%TARGETCOMPLUS%\sscoree.dll</TD>
</TR>
<TR VALIGN="top">
<TD width="5%" height="69"><b>UNIX system-based platforms</b></TD>
<TD width="25%" height="48">${TARGETCOMPLUS}/libsscoree.so
<p>&nbsp;</TD>
</TR>
<TR VALIGN="top">
<TD width="5%" height="31"><b>Mac&reg; OS X</b></TD>
<TD width="25%" height="58">${TARGETCOMPLUS}/libsscoree.dylib</TD>
</TR>
<TR VALIGN="top">
<TD width="25%" height="105">Build the C++ common code shared between many
components.<p>To incorporate changes to these libraries you should rebuild the
entire tree starting at clr\src.</TD>
<TD width="5%" height="105"><b>All</b></TD>
<TD width="25%" height="105">%ROTOR_DIR%\src\utilcode</TD>
<TD width="25%" height="105">%ROTOR_DIR%\clr\bin\ROTOR_X86\<br>
%DDKBUILDENV%\utilcode.lib<p>%ROTOR_DIR%\clr\bin\ROTOR_X86\<br>
%DDKBUILDENV%\utilcodestatic.lib</TD>
</TR>
<TR VALIGN="top">
<TD width="25%" rowspan="3" height="60">Build the just-in-time (JIT) compiler
implementation.</TD>
<TD width="5%" height="22"><b>Windows</b></TD>
<TD width="25%" rowspan="3" height="60">%ROTOR_DIR%\src\fjit </TD>
<TD width="25%" height="22">%TARGETCOMPLUS%\mscorejt.dll</TD>
</TR>
<TR VALIGN="top">
<TD width="5%" height="1"><b>UNIX system-based platforms</b></TD>
<TD width="25%" height="1">${TARGETCOMPLUS}/libmscorejt.so </TD>
</TR>
<TR VALIGN="top">
<TD width="5%" height="35"><b>Mac OS X</b></TD>
<TD width="25%" height="35">${TARGETCOMPLUS}/libmscorejt.dylib</TD>
</TR>
<TR VALIGN="top">
<TD width="25%" rowspan="3" height="98">Build the assembly searching and binding
code that implements the global assembly cache.</TD>
<TD width="5%" height="22"><b>Windows</b></TD>
<TD width="25%" rowspan="3" height="98">%ROTOR_DIR%\src\fusion</TD>
<TD width="25%" height="22">%TARGETCOMPLUS%\fusion.dll</TD>
</TR>
<TR VALIGN="top">
<TD width="5%" height="35"><b>UNIX system-based platforms</b></TD>
<TD width="25%" height="35">${TARGETCOMPLUS}/libfusion.so </TD>
</TR>
<TR VALIGN="top">
<TD width="5%" height="35"><b>Mac OS X</b></TD>
<TD width="25%" height="35">${TARGETCOMPLUS}/libfusion.dylib</TD>
</TR>
<TR VALIGN="top">
<TD width="25%" rowspan="2" height="98">Build the ilasm IL assembler.</TD>
<TD width="5%" height="22"><b>Windows</b></TD>
<TD width="25%" rowspan="2" height="98">%ROTOR_DIR%\src\ilasm</TD>
<TD width="25%" height="22">%TARGETCOMPLUS%\sdk\bin\ilasm.exe</TD>
</TR>
<TR VALIGN="top">
<TD width="5%" height="70"><b>UNIX system-based platforms</b></TD>
<TD width="25%" height="70">${TARGETCOMPLUS}/sdk/bin/ilasm</TD>
</TR>
<TR VALIGN="top">
<TD width="25%" rowspan="2" height="98">Build the ildasm assembly disassembler.</TD>
<TD width="5%" height="22"><b>Windows</b></TD>
<TD width="25%" rowspan="2" height="98">%ROTOR_DIR%\src\ildasm </TD>
<TD width="25%" height="22">%TARGETCOMPLUS%\sdk\bin\ildasm.exe</TD>
</TR>
<TR VALIGN="top">
<TD width="5%" height="70"><b>UNIX system-based platforms</b></TD>
<TD width="25%" height="70">${TARGETCOMPLUS}/sdk/bin/ildasm</TD>
</TR>
<TR VALIGN="top">
<TD width="25%" rowspan="2" height="98">Build the managed debugger. Part of the debugger
functionality is built into the
CLI execution
engine and part of it is built into the Runtime Debugger.</TD>
<TD width="5%" height="22"><b>Windows</b></TD>
<TD width="25%" rowspan="2" height="98">%ROTOR_DIR%\src\debug<br>
&nbsp;</TD>
<TD width="25%" height="22">%TARGETCOMPLUS%\sdk\bin\cordbg</TD>
</TR>
<TR VALIGN="top">
<TD width="5%" height="70"><b>UNIX system-based platforms</b></TD>
<TD width="25%" height="70">${TARGETCOMPLUS}/sdk/bin/cordbg</TD>
</TR>
<TR VALIGN="top">
<TD width="25%" height="89">Build the metadata reader/writer.<p>To incorporate
changes to this library you should rebuild the entire tree starting at clr\src.</TD>
<TD width="5%" height="89"><b>All</b></TD>
<TD width="25%" height="89">%ROTOR_DIR%\src\md </TD>
<TD width="25%" height="89">%ROTOR_DIR%\clr\bin\ROTOR_X86\<br>
%DDKBUILDENV%\ceefgen.lib</TD>
</TR>
<TR VALIGN="top">
<TD width="25%" height="284">Build miscellaneous unmanaged tools.&nbsp;Each of these
tools can be built individually as well.<ul>
<li>clix directory- managed application launcher</li>
<li>ildbsymbols directory - managed debugger symbol reader/writer</li>
<li>metainfo directory - metadata viewer</li>
<li>peverify - IL verifier</li>
<li>internalresgen directory - internal build tool</li>
<li>sn directory - Strong Name tool</li>
<li>permview-&nbsp; security permissions viewer</li>
<li>gac directory - global assembly cache management tool</li>
<li>sos - debug support library</li>
</ul>
</TD>
<TD width="5%" height="284"><b>All</b></TD>
<TD width="25%" height="284">%ROTOR_DIR%\src\tools</TD>
<TD width="25%" height="284">(See individual source files for tools.)</TD>
</TR>
</table>
<h3><a name="FXClassLibraries"></a>FX Class Libraries</h3>
<p>The FX class libraries provide basic runtime class library
support.&nbsp; Important sub-elements include:</p>
<ul>
<li>The <b>System</b> assembly.</li>
<li>The <b>System.Xml </b>assembly.</li>
</ul>
<p>To build the FX class libraries, switch to the source location
directory and run the build utility.</p>
<table border="1" width="90%">
<TR VALIGN="top">
<TH width="33%">Build scenario</TH>
<TH width="33%">Source location</TH>
<TH width="33%">Build output</TH>
</TR>
<TR VALIGN="top" width=100%>
<TD width="33%">Build the System.dll and System.Xml.dll assemblies.<p>Note: There is
a circular dependency between System.dll and System.Xml.dll assemblies. If you
delete one of these assemblies you must build both from this location.</TD>
<TD width="33%">%ROTOR_DIR%\fx\src</TD>
<TD width="33%">%TARGETCOMPLUS%\System.dll<br>
%TARGETCOMPLUS%\System.Xml.dll<p>These are also installed to<br>
%TARGETCOMPLUS%\assembly\GAC</p>
</TD>
</tr>
<TR VALIGN="top" width=100%>
<TD width="33%">Build the System.dll assembly.</TD>
<TD width="33%">%ROTOR_DIR%\fx\src\sys</TD>
<TD width="33%">%TARGETCOMPLUS%\System.dll</TD>
</tr>
<tr>
<TD width="33%">Build the System.Xml.dll assembly.</TD>
<TD width="33%">%ROTOR_DIR%\fx\src\xml</TD>
<TD width="33%">%TARGETCOMPLUS%\System.Xml.dll</TD>
</tr>
</table>
<h3><a name="ManagedClassLibraries"></a>Managed Class Libraries</h3>
<p>Additional managed class libraries:</p>
<ul>
<li>System.Runtime.Serialization.Formatters.Soap assembly</li>
<li>System.Runtime.Remoting assembly</li>
</ul>
<p>To build the managed class libraries switch to the source location
directory and run the build utility.</p>
<table border="1" width="90%">
<TR VALIGN="top">
<TH width="30%">Build scenario</TH>
<TH width="30%">Source location</TH>
<TH width="30%">Build output</TH>
</TR>
<tr>
<TD width="30%">Build the System.Runtime.Serialization.Formatters.Soap.dll
assembly.</TD>
<TD width="30%">%ROTOR_DIR%\managedlibraries\<br>
soapserializer</TD>
<TD width="30%">%TARGETCOMPLUS%\<br>
System.Runtime.Serialization.Formatters.Soap.dll</TD>
</tr>
<TR VALIGN="top">
<TD width="30%">Build the System.Runtime.Remoting.dll<br>
assembly.</TD>
<TD width="30%">%ROTOR_DIR%\managedlibraries\<br>
remoting</TD>
<TD width="30%">%TARGETCOMPLUS%\<br>
System.Runtime.Remoting.dll</TD>
</TR>
</table>
<h3><a name="ManagedCompilers"></a>Managed Compilers</h3>
<p>The Microsoft JScript&reg; compiler is implemented as a managed application.&nbsp;
It also builds managed applications.</p>
<p>To build the managed compilers, switch to the source location directory and
run the build utility.</p>
<table border="1" width="90%">
<TR VALIGN="top" width=100%>
<TH width="33%">Build scenario</TH>
<TH width="33%">Source location</TH>
<TH width="33%">Build output</TH>
</TR>
<TR VALIGN="top">
<TD width="33%">Modify and rebuild the JScript managed compiler.</TD>
<TD width="33%">%ROTOR_DIR%\jscript</TD>
<TD width="33%">%TARGETCOMPLUS%\jsc.exe<p>The files below are also installed to<br>
%TARGETCOMPLUS%\assembly\GAC</p>
<p>%TARGETCOMPLUS%\Microsoft.Vsa.dll</p>
<p>%TARGETCOMPLUS%\Microsoft.JScript.dll</p>
</TD>
</TR>
</table>
<h2>
<span class="subheadingblack">
<a name="UsingBuildLogstoTroubleshootBuildProblems"></a>Using Build
Logs to Troubleshoot Build Problems</span></h2>
<p>
When you build the SSCLI, a large volume of information is sent to the console
window during the build.&nbsp;Many people assume that this is important build
log output but it is not the complete build log output and is useful mostly for the final summary
content which
indicates whether there were build errors or warnings.&nbsp;The build utility emits
its useful information to build log files.&nbsp; </p>
<p>
<span class="subheadingblack">Build log file names are annotated with the type
of build and have an extension that indicates whether they contain error,
warning, or general log information. Log file names are annotated to
prevent build logs of one build type from overwriting the logs of another
build type.&nbsp; Subsequent build runs with the same build type will overwrite
the previous log file.</span></p>
<p>
<span class="subheadingblack">Build log file names are annotated using the value of the </span>BUILD_ALT_DIR environment variable.&nbsp; The extension
of the log file will be .log for the complete log output, .err for a build error
output subset, and .wrn for a build warning output subset.</p>
<h4>
Build Log File Names</h4>
<table border="1" width="90%">
<tr valign="top">
<th width="17%">Build type</th>
<th width="14%">BUILD_ALT_DIR env var</th>
<th width="23%">Full log file name<br>
(always created)</th>
<th width="23%">Error log file name<br>
(only created if build contains errors)</th>
<th width="48%">Warning log file name<br>
(only created if build contains warnings)</th>
</tr>
<tr>
<td width="17%">Checked</td>
<td width="14%">d</td>
<td width="23%">buildd.log</td>
<td width="23%">buildd.err</td>
<td width="48%">buildd.wrn </td>
</tr>
<tr>
<td width="17%">Fastchecked</td>
<td width="14%">df</td>
<td width="23%">builddf.log</td>
<td width="23%">builddf.err</td>
<td width="48%">builddf.wrn </td>
</tr>
<tr>
<td width="17%">Free on Windows</td>
<td width="14%">[not set]</td>
<td width="23%">build.log</td>
<td width="23%">build.err</td>
<td width="48%">build.wrn </td>
</tr>
<tr>
<td width="17%">Free on UNIX system-based platforms</td>
<td width="14%">r</td>
<td width="23%">buildr.log</td>
<td width="23%">buildr.err</td>
<td width="48%">buildr.wrn </td>
</tr>
</table>
<p>
<span class="subheadingblack">Build log files will be generated at the root
directory where the build utility finds a dirs file and begins recursively
building the source tree.&nbsp; When you execute the buildall script or batch
file several different builds are sequentially performed.&nbsp; </span></p>
<p>
<span class="subheadingblack">After a fastchecked
buildall on Windows, the following build files will be generated:</span></p>
<blockquote>
<p>
sscli\clr\src\builddf.log<br>
sscli\clr\src\bcl\builddf.log<br>
sscli\clr\src\toolbox\secdbedit\builddf.log<br>
sscli\fx\src\builddf.log<br>
sscli\jscript\builddf.log<br>
sscli\managedlibraries\builddf.log<br>
sscli\pal\win32\builddf.log<br>
sscli\palrt\src\builddf.log<br>
sscli\samples\builddf.log<br>
sscli\tools\binplace\builddf.log<br>
sscli\tools\build\builddf.log<br>
sscli\tools\ildbconv\builddf.log<br>
sscli\tools\resourcecompiler\builddf.log</p>
</blockquote>
<p>
After a checked buildall on FreeBSD, the following build files will be
generated:</p>
<blockquote>
<p>
sscli/clr/src/bcl/buildd.log<br>
sscli/clr/src/toolbox/secdbedit/buildd.log<br>
sscli/clr/src/buildd.log<br>
sscli/fx/src/buildd.log<br>
sscli/jscript/buildd.log<br>
sscli/managedlibraries/buildd.log<br>
sscli/pal/unix/buildd.log<br>
sscli/palrt/src/buildd.log<br>
sscli/samples/buildd.log<br>
sscli/tools/binplace/buildd.log<br>
sscli/tools/build/buildd.log<br>
sscli/tools/cppmunge/buildd.log<br>
sscli/tools/nmake/buildd.log<br>
sscli/tools/resourcecompiler/buildd.log<br>
sscli/buildd.log</p>
</blockquote>
<p>
If you explicitly switch to a directory and run build, log files will be
generated in that directory.&nbsp;For the build utility to work you must be in
a directory with either a <i>dirs</i> or <i>sources</i> file. </p>
<p>
For example, following a buildall, switch to the <i>sscli\samples\utilities\grep</i>
directory where the sources file for the grep sample resides, and type <code> build -c.</code>
In this case, a builddf.log file will be created in the <i>sscli\samples\utilities\grep</i> directory.&nbsp;If there are build errors or warnings, the other specific output files will
also be generated in that directory.</p>
<p>
If you encounter an error during build, you should look for build error log
files (such as builddf.err) to obtain more information.&nbsp; However, the build
error log files will often only contain incomplete error output resulting from a
previous error that did not get sent to the error log file.&nbsp; For example,
many errors that occur when building managed code using the SSCLI C# compiler
are not emitted correctly to the error log file.&nbsp; For complete diagnostics
you should read the full build log file.&nbsp; This will show the initial build
error that might have cascaded into subsequent output in the build error log
file.</p>
<h2><a name="NotesHintsandTips"></a>Notes, Hints, and Tips</h2>
<h3><a name="AutogeneratedFiles"></a>Autogenerated Files</h3>
<p>Note that some files in the SSCLI source tree are autogenerated before being
placed in the SSCLI source tree, due to the requirement to interoperate with
other build environments within Microsoft and the decision not to port some
internal Microsoft tools to run on top of the SSCLI PAL.&nbsp; For example:</p>
<ul>
<li>Some .h include files are generated by the Microsoft MIDL compiler from
.idl files.&nbsp; Only the .h files are included in the SSCLI source tree.</li>
<li>Parseasm.cpp is generated by means of an internal YACC-like tool.&nbsp;
Only the resulting output file is included in the SSCLI source tree.</li>
<li>All .nlp files are generated by internal Microsoft tools.&nbsp;Only the
resulting .nlp output files are included.</li>
</ul>
<h3><a name="FasterRebuilds"></a>Faster Rebuilds</h3>
<p>If you want to do a quick rebuild after changing a C/C++ file, use: </p>
<blockquote>build -z</blockquote>
<p>The -z option skips recalculations of file dependencies.</p>
However, if you are changing a C/C++ header file, do not use -z because it will
not evaluate the dependency between the header file and the source code.<h3>
<a name="FilePreprocessing"></a>File Preprocessing</h3>
<p>In any directory that contains a sources file, you can have the
build process preprocess a file for you: </p>
<blockquote>
<p>cd %ROTOR_DIR%\clr\src\vm\wks<br>
nmake assembly.pp ROTOR_X86=1 </p>
</blockquote>
<p>This will create %ROTOR_DIR%\clr\src\vm\wks\assembly.pp, the C-preprocessed
version of assembly.cpp. This is useful for understanding the include process and
macro expansion. </p>
<h3><a name="BaseClassLibraryBuild"></a>Base Class Library (mscorlib.dll) Build</h3>
<p>The security attributes built into the mscorlib assembly (mscorlib.dll) need to be serialized using code
that also resides in that assembly. To solve the self-referential dependency, mscorlib.dll
is built in several phases:</p>
<ul>
<li>First compiler pass: external storage of security attributes<ul>
<li>When the security attribute is about to be serialized, it
is written into a temporary file called sscli\clr\src\bcl\securitydb.idx in
a simple XML format. The %__SECURITY_BOOTSTRAP_DB% environment variable
must be set to enable this behavior; otherwise, an execution engine
initialization exception will be thrown because mscorlib.dll does not yet
exist.</li>
</ul>
</li>
<li>The tool secdbedit.exe is executed.&nbsp;
<ul>
<li>The secdbedit tool generates the actual binary serialized BLOBs for all
security attributes in <i>sscli</i>\clr\src\bcl\securitydb.idx using the
temporary mscorlib assembly.</li>
</ul>
</li>
<li>Second compiler pass: final mscorlib.dll is built.<ul>
<li>When the security attribute is about to be serialized, the serialized
BLOB is obtained by lookup into securitydb.idx file.</li>
</ul>
</li>
</ul>
<p>The code that handles this multistage process can be found in <i>sscli</i>\clr\src\vm\permset.cpp
(especially TranslateSecurityAttributesMSCORLIB) and <i>sscli</i>\clr\src\vm\securitydb.cpp.</p>
<p>Under normal circumstances code should not both define and use security
attibutes in the same assembly.&nbsp; The secdbedit tool is only meant to
support this by necessity in mscorlib.dll and is narrowly targeted for that
purpose.&nbsp;For example, the tool only supports code access security
permissions and not the full set of security permissions.</p>
<hr>
<p><i>Copyright (c) 2002 Microsoft Corporation. All rights reserved.</i></p>
</body>
</html>