Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the broken cmake commands in sdk integration tutorial #3391

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 18 additions & 4 deletions docs/source/tutorials_source/sdk-integration-tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,24 @@ def forward(self, x):
# Use CMake (follow `these instructions <../runtime-build-and-cross-compilation.html#configure-the-cmake-build>`__ to set up cmake) to execute the Bundled Program to generate the ``ETDump``::
#
# cd executorch
# rm -rf cmake-out && mkdir cmake-out && cd cmake-out && cmake -DEXECUTORCH_BUILD_SDK=1 -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=1 ..
# cd ..
# cmake --build cmake-out -j8 -t sdk_example_runner
# ./cmake-out/examples/sdk/sdk_example_runner --bundled_program_path <bundled_program>
# rm -rf cmake-out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old instructions only needed a few lines, but this is too complicated to copy-and-paste; please add a script.

I put together a first pass in https://gist.github.com/dbort/55cb1aee2c5673aab4f61087c80363b4.

Though when I run it it fails during the second cmake with

CMake Error at /Users/dbort/local/executorch/build/Codegen.cmake:132 (add_library):
  add_library cannot create target "portable_ops_lib" because an imported
  target with the same name already exists.
Call Stack (most recent call first):
  CMakeLists.txt:57 (gen_operators_lib)

If you do keep this as pasteable instructions, you should remove the local keyword, since it's not useful in this context.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I'll cherry-pick this PR first to unbreak the tutorial, then work on moving it to a script.

# cmake -DCMAKE_INSTALL_PREFIX=cmake-out \
# -DCMAKE_BUILD_TYPE=Release \
# -DEXECUTORCH_BUILD_SDK=ON \
# -DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
# -Bcmake-out .
# cmake --build cmake-out -j9 --target install --config Release
#
# local example_dir=examples/sdk
# local build_dir=cmake-out/${example_dir}
# CMAKE_PREFIX_PATH="${PWD}/cmake-out/lib/cmake/ExecuTorch;${PWD}/cmake-out/third-party/gflags"
# rm -rf ${build_dir}
# cmake -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
# -DCMAKE_BUILD_TYPE=Release \
# -B${build_dir} \
# ${example_dir}
# cmake --build ${build_dir} -j9 --config Release
# ${build_dir}/sdk_example_runner --bundled_program_path="bundled_program.bp"

######################################################################
# Creating an Inspector
Expand Down