From 1b8561f752b8d7ecf67e4f2e82aee70bc8da6120 Mon Sep 17 00:00:00 2001 From: Peter Scheibel Date: Wed, 8 Mar 2023 09:46:13 -0800 Subject: add logging to help users debug where external file searches are taking a long time (#35900) --- lib/spack/spack/build_environment.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib') diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index da5127a951..14195f7c25 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -485,7 +485,13 @@ def set_wrapper_variables(pkg, env): query = pkg.spec[dep.name] dep_link_dirs = list() try: + # In some circumstances (particularly for externals) finding + # libraries packages can be time consuming, so indicate that + # we are performing this operation (and also report when it + # finishes). + tty.debug("Collecting libraries for {0}".format(dep.name)) dep_link_dirs.extend(query.libs.directories) + tty.debug("Libraries for {0} have been collected.".format(dep.name)) except NoLibrariesError: tty.debug("No libraries found for {0}".format(dep.name)) @@ -772,7 +778,9 @@ def setup_package(pkg, dirty, context="build"): set_compiler_environment_variables(pkg, env_mods) set_wrapper_variables(pkg, env_mods) + tty.debug("setup_package: grabbing modifications from dependencies") env_mods.extend(modifications_from_dependencies(pkg.spec, context, custom_mods_only=False)) + tty.debug("setup_package: collected all modifications from dependencies") # architecture specific setup platform = spack.platforms.by_name(pkg.spec.architecture.platform) @@ -780,6 +788,7 @@ def setup_package(pkg, dirty, context="build"): platform.setup_platform_environment(pkg, env_mods) if context == "build": + tty.debug("setup_package: setup build environment for root") builder = spack.builder.create(pkg) builder.setup_build_environment(env_mods) @@ -790,6 +799,7 @@ def setup_package(pkg, dirty, context="build"): " includes and omit it when invoked with '--cflags'." ) elif context == "test": + tty.debug("setup_package: setup test environment for root") env_mods.extend( inspect_path( pkg.spec.prefix, @@ -806,6 +816,7 @@ def setup_package(pkg, dirty, context="build"): # Load modules on an already clean environment, just before applying Spack's # own environment modifications. This ensures Spack controls CC/CXX/... variables. if need_compiler: + tty.debug("setup_package: loading compiler modules") for mod in pkg.compiler.modules: load_module(mod) @@ -943,6 +954,7 @@ def modifications_from_dependencies( _make_runnable(dep, env) def add_modifications_for_dep(dep): + tty.debug("Adding env modifications for {0}".format(dep.name)) # Some callers of this function only want the custom modifications. # For callers that want both custom and default modifications, we want # to perform the default modifications here (this groups custom @@ -968,6 +980,7 @@ def modifications_from_dependencies( builder.setup_dependent_build_environment(env, spec) else: dpkg.setup_dependent_run_environment(env, spec) + tty.debug("Added env modifications for {0}".format(dep.name)) # Note that we want to perform environment modifications in a fixed order. # The Spec.traverse method provides this: i.e. in addition to -- cgit v1.2.3-60-g2f50