Skip to content

Commit

Permalink
Update on "[BE] Remind users to update submodule"
Browse files Browse the repository at this point in the history
Summary: 

Fixing #7243

As titled. This PR adds 2 things:
1. `check_and_update_submodule()` check if required submodule folders exist and at least contains a CMakeLists.txt file.
2. Give useful error when the submodule is corrupted (most likely missing a file, caused by submodule out of sync).

Test Plan: 

1. Test if we can still install, if submodule is not updated

```
rm -rf third-party/prelude
./install_executorch.sh
```
See the following log

```
...
Processing /data/users/larryliu/executorch
  Preparing metadata (pyproject.toml): started
  Running command Preparing metadata (pyproject.toml)
  2025-02-05 11:28:46,430 [ExecuTorch] WARNING: Some required submodules are missing. Updating submodules...
  Submodule path 'third-party/prelude': checked out '851d3f09c452937fc5adef27e2c50f7f304f1646'
  2025-02-05 11:28:46,748 [ExecuTorch] INFO: All required submodules are present.
  2025-02-05 11:28:47,018 [ExecuTorch] INFO: running dist_info
...
```
This proves that we can update submodule for the user.

2. Test if we can give useful error message, if we are missing a file.

```
rm third-party/gflags/src/gflags.cc
./install_executorch.sh --clean
./install_executorch.sh
```

See the following error:

```
  2025-02-05 12:08:56,889 [ExecuTorch] ERROR: Failed to query buck for sources. Failed command:

     buck2 cquery inputs(deps('//runtime/executor:program'))

  This is likely due to missing git submodules or outdated CMake cache. Please run the following before retry:

      ./install_executorch.sh --clean
      git submodule update --init --recursive

```
Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D69156975](https://our.internmc.facebook.com/intern/diff/D69156975)

[ghstack-poisoned]
  • Loading branch information
larryliu0820 committed Feb 5, 2025
1 parent e642591 commit c8583b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion build/extract_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ def get_sources(
"to missing git submodules or outdated CMake cache. "
"Please run the following before retry:\033[0m\n\n"
" \033[32;1m./install_executorch.sh --clean\033[0m\n"
" \033[32;1mgit submodule update --init --recursive\033[0m\n"
" \033[32;1mgit submodule sync\033[0m\n"
" \033[32;1mgit submodule update --init\033[0m\n"
)
raise e

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,8 @@ def run(self):
"\033[31;1mEither CMake cache is outdated or git submodules are not synced.\n"
"Please run the following before retry:\033[0m\n"
" \033[32;1m./install_executorch.sh --clean\033[0m\n"
" \033[32;1mgit submodule update --init --recursive\033[0m\n"
" \033[32;1mgit submodule sync\033[0m\n"
" \033[32;1mgit submodule update --init\033[0m\n"
)
raise Exception(error + "\n" + additional_log) from e

Expand Down

0 comments on commit c8583b4

Please sign in to comment.