yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
9.01k stars 1.08k forks source link

[yb_build] give clearer error if which fails with no output #16139

Closed jasonyb closed 1 year ago

jasonyb commented 1 year ago

Jira Link: DB-5578

Description

On docker image phusion/baseimage:focal-1.2.0 (minimal ubuntu 20.4) as root user in bash shell,

apt update
apt -y upgrade
apt -y install git python3.9 python3.9-venv
ln -sf python3.9 /usr/bin/python3
git clone https://github.com/yugabyte/yugabyte-db
cd yugabyte-db
./yb_build.sh

It fails without meaningful message. Running again for a shorter output:

./yb_build.sh
[2023-02-16T20:18:41 common-build-env.sh:588 set_cmake_build_type_and_compiler_type] Setting build type to 'debug' by default
[2023-02-16T20:18:41 yb_build.sh:1418 main] YugabyteDB build is running on host 'd611b44afc63'
[2023-02-16T20:18:41 yb_build.sh:1419 main] YB_COMPILER_TYPE=clang15
Details of third-party dependencies:
    YB_THIRDPARTY_DIR: /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20230207052503-9dadefc8ee-centos7-x86_64-clang15 (from file '/yugabyte-db/build/debug-clang15-dynamic/thirdparty_path.txt'))
    YB_LLVM_TOOLCHAIN_URL: https://github.com/yugabyte/build-clang/releases/download/v15.0.3-yb-1-1667342161-0b8d1183-ubuntu20.04-x86_64/yb-llvm-v15.0.3-yb-1-1667342161-0b8d1183-ubuntu20.04-x86_64.tar.gz
    YB_LLVM_TOOLCHAIN_DIR: /opt/yb-build/llvm/yb-llvm-v15.0.3-yb-1-1667342161-0b8d1183-ubuntu20.04-x86_64 (downloaded from https://github.com/yugabyte/build-clang/releases/download/v15.0.3-yb-1-1667342161-0b8d1183-ubuntu20.04-x86_64/yb-llvm-v15.0.3-yb-1-1667342161-0b8d1183-ubuntu20.04-x86_64.tar.gz)
    YB_DOWNLOAD_THIRDPARTY: 1
    NO_REBUILD_THIRDPARTY: 1
[2023-02-16T20:18:42 yb_build.sh:1663 main] This build is NOT using Ninja. Consider specifying --ninja or setting YB_USE_NINJA=1.
[2023-02-16T20:18:43 yb_build.sh:1695 main] Using make parallelism of 4 (YB_REMOTE_COMPILATION=0)
Saving BUILD_ROOT to /yugabyte-db/build/latest_build_root

==========================================================================================
YUGABYTE BUILD SUMMARY
==========================================================================================
Build type                       : debug
C/C++ compiler                   : clang15
Build architecture               : x86_64
Build directory                  : /yugabyte-db/build/debug-clang15-dynamic
Third-party dir                  : /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20230207052503-9dadefc8ee-centos7-x86_64-clang15
Exit code                        : 1
------------------------------------------------------------------------------------------

Investigation leads to it failing on this line

cmake_binary=$( which cmake )

because cmake is not found. The which cmake command outputs nothing and returns exit code 1. There should be a clearer message in this failure case. It seems which as a binary gives no output but which as a shell builtin gives output.

omkaark commented 1 year ago

Can I be assigned this please?