Files
4682098d3a Move optdata and version file generation up to MSBuild from build-runtime (#58674)
* Move optdata and version file generation from the native build scripts up into the managed scripts. The native build scripts will now by default copy a fallback version file in place if the version files do not exist and will disable PGO if no pgo file path is passed in to the build-runtime scripts.

This removes all cases of build-runtime calling into MSBuild.

* Update CI to use the new prereqs model.

* Remove some old MSBuild arg pass-through that's no longer needed as build-runtime no longer calls into any MSBuild processes.

* Apply suggestions from code review

Co-authored-by: Viktor Hofer <[email protected]>
Co-authored-by: Jan Kotas <[email protected]>

* Move some targets around based on feedback.

* Output version files in the artifacts/obj dir so they can be easily shared.

* Move native pgo into a targets file instead of being a separate project to be more static-graph friendly.

* Fix subsets.

* Share version file path by default

* Fix VER_FILEDESCRIPTION_STR

* Fix version fallback copies.

* Fix include path for the version headers.

* Update src/coreclr/dlls/mscordac/CMakeLists.txt

Co-authored-by: Juan Hoyos <[email protected]>

* Enable easily sharing the fallback version files between all components of the repo.

* Remove some now-unused command-line options from our build scripts.

* Bump importance output to pass the pgo path between steps.

* Add eval statement to run copy_version_files script

* Rename some files and and standardize on a _version.c file name for Linux.

* Remove temp proj ref.

* Fix permissions

* Reference targets to produce version file in libraries native build.

* Fix CoreCLR build breaks

* Generate the version files for Mono

* include configurepaths.cmake on the Windows CoreFX build.

* Restore mono.proj when building it through monoaotcross.proj.

* Update copy script to work on macos.

* Make sure mono pulls in the shared version files.

* Add artifcats/obj dir as include dir for CoreCLR diagonstic components included in Mono

* Add artifacts/obj include for the whole mono build.

* Update CMakeLists.txt

* Fix NativeVersion.rc path on Windows.

* Fix linux version parsing to point at the right file.

* Fix mono version parsing (apparently the quotes make a difference here)

* Update src/coreclr/build-runtime.sh

Co-authored-by: Adeel Mujahid <[email protected]>

* Update eng/native/version/copy_version_files.sh

Co-authored-by: Adeel Mujahid <[email protected]>

* Update copy_version_files.sh to insert the current commit hash into _version.c.

* Apply suggestions from code review

Co-authored-by: Adeel Mujahid <[email protected]>

* Update the _version.c writing script to only update the placeholder version file if it actually is a placeholder (not a real generated file).

* Generate the version files for wasm/browser as well.

* Fix Mono WASM cross build.

* Update eng/nativepgo.targets

Co-authored-by: Juan Hoyos <[email protected]>

* Fix comparison for NativeOptimizationDataSupported.

Co-authored-by: Viktor Hofer <[email protected]>
Co-authored-by: Jan Kotas <[email protected]>
Co-authored-by: Juan Hoyos <[email protected]>
Co-authored-by: Adeel Mujahid <[email protected]>
2021-10-27 10:03:34 -07:00
..
2021-05-01 10:55:00 -07:00

Workflow Guide

The repo can be built for the following platforms, using the provided setup and the following instructions. Before attempting to clone or build, please check these requirements.

Build Requirements

Chip Windows Linux macOS FreeBSD
x64 ✔ ✔ ✔ ✔
x86 ✔
ARM ✔ ✔
ARM64 ✔ ✔
Requirements Requirements Requirements Requirements

Before proceeding further, please click on the link above that matches your machine and ensure you have installed all the prerequisites for the build to work.

Additionally, keep in mind that cloning the full history of this repo takes roughly 400-500 MB of network transfer, inflating to a repository that can consume somewhere between 1 to 1.5 GB. A build of the repo can take somewhere between 10 and 20 GB of space for a single OS and Platform configuration depending on the portions of the product built. This might increase over time, so consider this to be a minimum bar for working with this codebase.

Concepts

The runtime repo can be built from a regular, non-administrator command prompt, from the root of the repo, as follows:

For Linux and macOS

./build.sh

For Windows:

build.cmd

This builds the product (in the default debug configuration), but not the tests.

For information about the different options available, supply the argument --help|-h when invoking the build script:

build -h

On Unix like systems, arguments can be passed in with a single - or double hyphen --.

The repository currently consists of different major parts: the runtimes, the libraries, and the installer. To build just one part you use the root build script (build.cmd/sh), and you add the -subset flag.

Editing and Debugging

For instructions on how to edit code and debug your changes, see Editing and Debugging.

Configurations

You may need to build the tree in a combination of configurations. This section explains why.

A quick reminder of some concepts -- see the glossary for more on these:

  • Debug Configuration -- Non-optimized code. Asserts are enabled.
  • Checked Configuration -- Optimized code. Asserts are enabled. Only relevant to CoreCLR runtime.
  • Release Configuration -- Optimized code. Asserts are disabled. Runs at the best speed, and suitable for performance profiling. You will have limited debugging experience.

When we talk about mixing configurations, we're discussing the following sub-components:

  • Runtime is the execution engine for managed code and there are two different implementations available. Both are written in C/C++, therefore, easier to debug when built in a Debug configuration.
    • CoreCLR is the comprehensive execution engine which, if built in Debug Configuration, executes managed code very slowly. For example, it will take a long time to run the managed code unit tests. The code lives under src/coreclr.
    • Mono is portable and also slimmer runtime and it's not that sensitive to Debug Configuration for running managed code. You will still need to build it without optimizations to have good runtime debugging experience though. The code lives under src/mono.
  • CoreLib (also known as System.Private.CoreLib) is the lowest level managed library. It has a special relationship to the runtimes and therefore it must be built in the matching configuration, e.g., if the runtime you are using was built in a Debug configuration, this must be in a Debug configuration. The runtime agnostic code for this library can be found at src/libraries/System.Private.CoreLib/src.
  • Libraries is the bulk of the dlls that are oblivious to the configuration that runtimes and CoreLib were built in. They are most debuggable when built in a Debug configuration, and, happily, they still run sufficiently fast in that configuration that it's acceptable for development work. The code lives under src/libraries.

What does this mean for me?

At this point you probably know what you are planning to work on primarily: the runtimes or libraries.

  • if you're working in runtimes, you may want to build everything in the Debug configuration, depending on how comfortable you are debugging optimized native code.
  • if you're working in libraries, you will want to use debug libraries with a release version of runtime and CoreLib, because the tests will run faster.
  • if you're working in CoreLib - you probably want to try to get the job done with release runtime and CoreLib, and fall back to debug if you need to. The Building Libraries document explains how you'll do this.

Now you know about configurations and how we use them, you will want to read how to build what you plan to work on. Pick one of these:

After that, here's information about how to run tests:

And how to measure performance: