Skip to content

Commit 4e42d6c

Browse files
committed
Build size_test binaries with debug info
The CI workflow already runs strip before checking size, so this shouldn't break it (and we'll see if it does on this PR). Having debug info makes it much easier to investigate issues with bloaty. ghstack-source-id: 2dd714f ghstack-comment-id: 3009793476 Pull-Request-resolved: #12019
1 parent 9200dca commit 4e42d6c

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

.github/workflows/pull.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ jobs:
366366
# build module for executorch.extension.pybindings.portable_lib
367367
bash test/build_size_test.sh
368368
strip cmake-out/test/size_test
369+
strip --strip-debug cmake-out/test/size_test
369370
output=$(ls -la cmake-out/test/size_test)
370371
arr=($output)
371372
size=${arr[4]}
@@ -403,6 +404,7 @@ jobs:
403404
# build module for executorch.extension.pybindings.portable_lib
404405
bash test/build_size_test.sh
405406
strip cmake-out/test/size_test
407+
strip --strip-debug cmake-out/test/size_test
406408
output=$(ls -la cmake-out/test/size_test)
407409
arr=($output)
408410
size=${arr[4]}

test/build_size_test.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ EXTRA_BUILD_ARGS="${@:-}"
1515
# TODO(#8357): Remove -Wno-int-in-bool-context
1616
# TODO: Replace -ET_HAVE_PREAD=0 with a CMake option.
1717
# FileDataLoader used in the size_test breaks baremetal builds with pread when missing.
18-
COMMON_CXXFLAGS="-fno-exceptions -fno-rtti -Wall -Werror -Wno-int-in-bool-context -DET_HAVE_PREAD=0"
18+
# -Werror=maybe-uninitialized causes failures with GCC 9.5, which we
19+
# -currently use in CI. There were known issues with this warning and
20+
# -std::optional: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635
21+
COMMON_CXXFLAGS="-fno-exceptions -fno-rtti -Wall -Werror -Wno-int-in-bool-context -Wno-maybe-uninitialized -DET_HAVE_PREAD=0"
1922

2023
cmake_install_executorch_lib() {
2124
echo "Installing libexecutorch.a"
@@ -26,23 +29,23 @@ cmake_install_executorch_lib() {
2629
CXXFLAGS="$COMMON_CXXFLAGS" retry cmake -DBUCK2="$BUCK2" \
2730
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
2831
-DCMAKE_INSTALL_PREFIX=cmake-out \
29-
-DCMAKE_BUILD_TYPE=Release \
32+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
3033
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=OFF \
3134
-DEXECUTORCH_OPTIMIZE_SIZE=ON \
3235
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
3336
${EXTRA_BUILD_ARGS} \
3437
-Bcmake-out .
35-
cmake --build cmake-out -j9 --target install --config Release
38+
cmake --build cmake-out -j9 --target install --config RelWithDebInfo
3639
}
3740

3841
test_cmake_size_test() {
39-
CXXFLAGS="$COMMON_CXXFLAGS" retry cmake -DCMAKE_BUILD_TYPE=Release \
42+
CXXFLAGS="$COMMON_CXXFLAGS" retry cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
4043
-DCMAKE_INSTALL_PREFIX=cmake-out \
4144
${EXTRA_BUILD_ARGS} \
4245
-Bcmake-out/test test
4346

4447
echo "Build size test"
45-
cmake --build cmake-out/test -j9 --config Release
48+
cmake --build cmake-out/test -j9 --config RelWithDebInfo
4649

4750
echo 'ExecuTorch with no ops binary size, unstripped:'
4851
ls -al cmake-out/test/size_test

0 commit comments

Comments
 (0)