Skip to content

Commit

Permalink
Update glog to use stack unwinding based on backtrace function (#242)
Browse files Browse the repository at this point in the history
Also some improvements in handling the `--dev-repo` flag.

Issue: yugabyte/yugabyte-db#19085
  • Loading branch information
mbautin authored Nov 2, 2023
1 parent 55eee2b commit ec8ab75
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion python/build_definitions/glog.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class GLogDependency(Dependency):
def __init__(self) -> None:
super(GLogDependency, self).__init__(
name='glog',
version='0.4.0-yb-5',
version='0.4.0-yb-8',
url_pattern='https://github.com/yugabyte/glog/archive/v{0}.tar.gz',
build_group=BuildGroup.POTENTIALLY_INSTRUMENTED)
self.patch_version = 1
Expand Down
2 changes: 1 addition & 1 deletion python/yugabyte_db_thirdparty/cmd_line_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def parse_cmd_line_args() -> argparse.Namespace:
parser.add_argument(
'--dev-repo',
help='Specify "development mode" local repository paths for some dependencies. E.g. '
'--dev-repo- tcmalloc=~/code/tcmalloc. These development repository paths are '
'--dev-repo tcmalloc=~/code/tcmalloc. These development repository paths are '
'created automatically if not present.',
nargs='+')

Expand Down
14 changes: 11 additions & 3 deletions python/yugabyte_db_thirdparty/compiler_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,14 @@ def run(self) -> None:
COMPILER_WRAPPER_ENV_VAR_NAME_LD_FLAGS_TO_REMOVE, '').strip().split())
cmd_args = [arg for arg in cmd_args if arg not in ld_flags_to_remove]

if len(output_files) == 1 and output_files[0].endswith('.o'):
if (len(output_files) == 1 and
output_files[0].endswith('.o') and
# Protobuf build produces a file named libprotobuf.15.dylib-master.o out of multiple
# .o files.
not output_files[0].endswith('.dylib-master.o')):

output_path = output_files[0]
pp_output_path = output_path + 'pp'
pp_output_path = output_path + '.pp' # "pp" for "preprocessed"
is_assembly_input = any([arg.endswith('.s') for arg in self.compiler_args])

compile_commands_tmp_dir = compile_commands.get_tmp_dir_env_var()
Expand Down Expand Up @@ -166,7 +171,10 @@ def run(self) -> None:
pp_args.append('-E')
subprocess.check_call(pp_args)
assert pp_output_path is not None
assert os.path.isfile(pp_output_path)
assert os.path.isfile(pp_output_path), (
f"Preprocessed output file does not exist: {pp_output_path}. "
f"Preprocessing command arguments: {shlex_join(pp_args)}."
)

# Collect included files from preprocessor output.
# https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html
Expand Down
1 change: 1 addition & 0 deletions python/yugabyte_db_thirdparty/download_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def dest_dir_already_exists(full_out_path: str) -> bool:
if os.path.exists(tmp_out_dir):
raise IOError("Just-generated unique directory name already exists: %s" % tmp_out_dir)
os.makedirs(tmp_out_dir)
assert os.path.isdir(tmp_out_dir), f"Failed to create directory {tmp_out_dir}"

archive_extension = None
for ext in ARCHIVE_TYPES:
Expand Down
7 changes: 6 additions & 1 deletion python/yugabyte_db_thirdparty/file_system_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ def get_llvm_tool_dir(self) -> str:
return os.path.join(self.tp_build_dir, 'llvm-tools')

def add_dev_repo_mapping(self, mapping_str: str) -> None:
dep_name, repo_dir = mapping_str.split('=')
components = mapping_str.split('=', 1)
if len(components) != 2:
raise ValueError(
f"Expected a dev repo mapping to be of the form name=directory, got: {mapping_str}")
dep_name, repo_dir = components
repo_dir = os.path.expanduser(repo_dir)
if dep_name in self.dev_repo_mappings:
raise ValueError(
f"Duplicate development repository directory mapping for dependency {dep_name}: "
Expand Down
3 changes: 2 additions & 1 deletion python/yugabyte_db_thirdparty/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,9 @@ def capture_all_output(
except subprocess.CalledProcessError as ex:
cmd_line_str = shlex_join(args)
if ex.returncode not in allowed_exit_codes:
expected_exit_codes = set(sorted(allowed_exit_codes | {0}))
error_msg = f"Unexpected exit code {ex.returncode} from: {cmd_line_str} " \
f"(expected one of { set(sorted(allowed_exit_codes | {0})) })"
f"(expected one of {expected_exit_codes})"
log(error_msg)
log("Output from %s (stdout/stderr combined):", cmd_line_str)
log(ex.stdout.decode('utf-8'))
Expand Down
1 change: 1 addition & 0 deletions thirdparty_src_checksums.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ fd167e7c5bd33fa6d15dcd7e7ddcf08cdf1428d4123d60041951cb4210d97990 glog-0.4.0-yb-
dfdaf6d5ea276cbb20fabace03821d4a0c08ee143ff3addd34a86f32833fa860 glog-0.4.0-yb-3.tar.gz
4e04b9182904bea9e1f106fc13541aba63d06440d5651b4b712a02398d5cda3a glog-0.4.0-yb-4.tar.gz
8016f57ccffc198a827489c697d3ae4b3dc828359500b4d3f8fcf269d221beac glog-0.4.0-yb-5.tar.gz
ff13d31eca6d5aaf83b13d18730e8d59fdec5d8a6369e533fb34ab13eb0b1968 glog-0.4.0-yb-8.tar.gz
80439c8a92af974e6788347c59d71d59fdf51f808d80d52fabe744eacf4f9cba glog-0.4.0-yb1.tar.gz
f28359aeba12f30d73d9e4711ef356dc842886968112162bc73002645139c39c glog-0.4.0.tar.gz
407992e9ef17a08339cd383c33dbaff923969cfa01f8e4ceaeea679400016d85 gmock-1.7.0.zip
Expand Down

0 comments on commit ec8ab75

Please sign in to comment.