Skip to content

Make TDLib builds more hermetic - #2263

Open
Kylmakalle wants to merge 1 commit into
TelegramMessenger:masterfrom
Kylmakalle:patch-3
Open

Make TDLib builds more hermetic#2263
Kylmakalle wants to merge 1 commit into
TelegramMessenger:masterfrom
Kylmakalle:patch-3

Conversation

@Kylmakalle

Copy link
Copy Markdown

When ccache is installed in system, TDLib may report CCACHE_FOUND=1 during configuration and generate ccache-dependent compile commands. However, Bazel will fail to execute them, since it tries to be hermetic and there is no ccache in $PATH.

Error log
[3,184 / 5,953] Compiling Swift module //submodules/TelegramApi:TelegramApi; 101s worker ... (6 actions running)
ERROR: /Users/admin/.cache/act/ca1cbef3abe92f84/hostexecutor/Telegram-iOS/third-party/td/BUILD:23:8: Executing genrule //third-party/td:td_build failed: (Exit 2): bash failed: error executing Genrule command (from target //third-party/td:td_build) 
  (cd /private/var/tmp/_bazel_admin/28e24203993477b4b129fe9b797f560f/execroot/_main && \
  exec env - \
    PATH=/usr/bin:/bin:/usr/sbin:/sbin \
    ZERO_AR_DATE=1 \
  /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; 
    set -ex
    if [ "ios_sim_arm64" == "ios_arm64" ]; then
        BUILD_ARCH="arm64"
... TRUNCATED ...
+ cd /private/var/tmp/_bazel_admin/28e24203993477b4b129fe9b797f560f/execroot/_main/bazel-out/ios_sim_arm64-opt-ios-sim_arm64-min13.0-ST-28e2ff30e5be/bin/third-party/td/build_sim_arm64
+ mkdir native-build
+ cd native-build
+ cmake -DTD_GENERATE_SOURCE_FILES=ON ../td
++ sysctl -n hw.ncpu
+ cmake --build . -- -j6
/bin/sh: ccache: command not found
/bin/sh: ccache: command not found
make[2]: *** [tdutils/generate/CMakeFiles/generate_mime_types_gperf.dir/generate_mime_types_gperf.cpp.o] Error 127

This PR makes TDLib builds a little more hermetic. Disabling ccache should not be a problem for day to day development, Bazel will reuse outputs if TDLib is unchanged.

I've first noticed it on my system, but was able to quickly reproduce in a similar VM container, simply doing brew install ccache.
This may become a more frequent scenario when TDLib will be updated, since it will be able to correctly report tools availability, including ccache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant