Skip to content

Commit 198fecd

Browse files
committed
Add env setup instructions for source build
1 parent 7d72c5a commit 198fecd

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

docs/source/using-executorch-building-from-source.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,98 @@ ExecuTorch uses [CMake](https://cmake.org/) as the primary build system.
44
Even if you don't use CMake directly, CMake can emit scripts for other format
55
like Make, Ninja or Xcode. For information, see [cmake-generators(7)](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html).
66

7+
## System Requirements
8+
### Operating System
9+
10+
We've tested these instructions on the following systems, although they should
11+
also work in similar environments.
12+
13+
14+
Linux (x86_64)
15+
- CentOS 8+
16+
- Ubuntu 20.04.6 LTS+
17+
- RHEL 8+
18+
19+
macOS (x86_64/M1/M2)
20+
- Big Sur (11.0)+
21+
22+
Windows (x86_64)
23+
- Windows Subsystem for Linux (WSL) with any of the Linux options
24+
25+
### Software
26+
* `conda` or another virtual environment manager
27+
- We recommend `conda` as it provides cross-language
28+
support and integrates smoothly with `pip` (Python's built-in package manager)
29+
- Otherwise, Python's built-in virtual environment manager `python venv` is a good alternative.
30+
* `g++` version 7 or higher, `clang++` version 5 or higher, or another
31+
C++17-compatible toolchain.
32+
33+
Note that the cross-compilable core runtime code supports a wider range of
34+
toolchains, down to C++17. See the [Runtime Overview](./runtime-overview.md) for
35+
portability details.
36+
37+
## Environment Setup
38+
39+
### Create a Virtual Environment
40+
41+
[Install conda on your machine](https://conda.io/projects/conda/en/latest/user-guide/install/index.html). Then, create a virtual environment to manage our dependencies.
42+
```bash
43+
# Create and activate a conda environment named "executorch"
44+
conda create -yn executorch python=3.10.0
45+
conda activate executorch
46+
```
47+
48+
### Clone and install ExecuTorch requirements
49+
50+
```bash
51+
# Clone the ExecuTorch repo from GitHub
52+
# 'main' branch is the primary development branch where you see the latest changes.
53+
# 'viable/strict' contains all of the commits on main that pass all of the necessary CI checks.
54+
git clone --branch viable/strict https://github.com/pytorch/executorch.git
55+
cd executorch
56+
57+
# Update and pull submodules
58+
git submodule sync
59+
git submodule update --init
60+
61+
# Install ExecuTorch pip package and its dependencies, as well as
62+
# development tools like CMake.
63+
# If developing on a Mac, make sure to install the Xcode Command Line Tools first.
64+
./install_executorch.sh
65+
```
66+
67+
Use the [`--pybind` flag](https://github.com/pytorch/executorch/blob/main/install_executorch.sh#L26-L29) to install with pybindings and dependencies for other backends.
68+
```bash
69+
./install_executorch.sh --pybind <coreml | mps | xnnpack>
70+
71+
# Example: pybindings with CoreML *only*
72+
./install_executorch.sh --pybind coreml
73+
74+
# Example: pybinds with CoreML *and* XNNPACK
75+
./install_executorch.sh --pybind coreml xnnpack
76+
```
77+
78+
By default, `./install_executorch.sh` command installs pybindings for XNNPACK. To disable any pybindings altogether:
79+
```bash
80+
./install_executorch.sh --pybind off
81+
```
82+
83+
> **_NOTE:_** Cleaning the build system
84+
>
85+
> When fetching a new version of the upstream repo (via `git fetch` or `git
86+
> pull`) it is a good idea to clean the old build artifacts. The build system
87+
> does not currently adapt well to changes in build dependencies.
88+
>
89+
> You should also update and pull the submodules again, in case their versions
90+
> have changed.
91+
>
92+
> ```bash
93+
> # From the root of the executorch repo:
94+
> ./install_executorch.sh --clean
95+
> git submodule sync
96+
> git submodule update --init
97+
> ```
98+
799
## Targets Built by the CMake Build System
8100
9101
ExecuTorch's CMake build system covers the pieces of the runtime that are

0 commit comments

Comments
 (0)