Skip to content

Commit d6a9e8f

Browse files
cccclaifacebook-github-bot
authored andcommitted
Update instruction to install flatc (#447)
Summary: See context in D49487908, the `flatc` from `brew install flatbuffers` seems good. Differential Revision: D49530021
1 parent 12b3a91 commit d6a9e8f

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

docs/website/docs/tutorials/00_setting_up_executorch.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ To install conda, you can look at the
1515
```bash
1616
conda create -yn executorch python=3.10.0
1717
conda activate executorch
18-
1918
conda install cmake
20-
conda install -c conda-forge flatbuffers
2119
```
2220

2321
### Step 2: Clone the `executorch` repo
@@ -51,7 +49,22 @@ you may need to re-install a new version the PyTorch nightly pip package. The
5149
`TORCH_VERSION` value in this document will be the correct version for the
5250
corresponsing version of the repo.
5351

54-
### Step 4: Generate a program file from an `nn.Module`
52+
### Step 4: Install host built tool
53+
54+
Install [flatc V23.5.9](https://github.com/google/flatbuffers/releases/tag/v23.5.9) as it's prerequist for both AOT and runtime.
55+
There are several ways to get the flatc compiler, including
56+
- [MacOS only] `brew install flatbuffers`
57+
- Download a prebuilt binary from https://github.com/google/flatbuffers/releases/tag/v23.5.9
58+
- Build it from `executorch/third-party/flatbuffers`, [following instruction from the official website](https://github.com/google/flatbuffers#quick-start), for example, if it's on MacOS:
59+
```bash
60+
cd executorch/third-party/flatbuffers && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && cmake --build . -j 9
61+
```
62+
Add the flatc path to $PATH like
63+
```
64+
export PATH="/path/to/flatc:$PATH"
65+
```
66+
67+
### Step 5: Generate a program file from an `nn.Module`
5568

5669
Via python script:
5770
```bash

docs/website/docs/tutorials/cmake_build_system.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ rm -rf cmake-android-out && mkdir cmake-android-out && cd cmake-android-out
123123

124124
# point -DCMAKE_TOOLCHAIN_FILE to the location where ndk is installed
125125
# Run `which buck2`, if it returns empty (meaning the system doesn't know where buck2 is installed), pass in pass in this flag `-DBUCK2=/path/to/buck2` pointing to buck2
126-
cmake -DCMAKE_TOOLCHAIN_FILE=/Users/{user_name}/Library/Android/sdk/ndk/25.2.9519653/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a ..
126+
cmake -DCMAKE_TOOLCHAIN_FILE=/Users/{user_name}/Library/Android/sdk/ndk/25.2.9519653/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DBUCK2=/path/to/buck2 -DFLATC_EXECUTABLE=/path/to/flatc ..
127127

128-
cd ..
129-
cmake --build cmake-android-out -j9
128+
# Move to the executorch folder and build
129+
cd .. && cmake --build cmake-android-out -j9
130130

131131
# push the binary to an Android device
132132
adb push cmake-android-out/executor_runner /data/local/tmp/executorch
@@ -162,7 +162,10 @@ git clone https://github.com/leetal/ios-cmake.git
162162
rm -rf cmake-ios-out && mkdir cmake-ios-out && cd cmake-ios-out
163163

164164
# change the platform accordingly, please refer to the table listed in Readme
165-
cmake . -G Xcode -DCMAKE_TOOLCHAIN_FILE=~/ios-cmake/ios.toolchain.cmake -DPLATFORM=SIMULATOR
165+
cmake -G Xcode -DCMAKE_TOOLCHAIN_FILE=~/ios-cmake/ios.toolchain.cmake -DPLATFORM=SIMULATOR -DBUCK2=/path/to/buck2 -DFLATC_EXECUTABLE=/path/to/flatc -DPYTHON_EXECUTABLE=/path/to/miniconda/envs/executorch/bin/python3 ..
166+
167+
# Move to the executorch folder and build
168+
cd .. && cmake --build cmake-ios-out -j9
166169

167170
# Create an include folder in cmake-ios-out to include all header files
168171
mkdir include

0 commit comments

Comments
 (0)