code: def _linux_compile(
      output,
      objects,
      options,
      compile_cmd,
      cwd=None,
      ccache_env=None,
      compile_shared=False,
  ):
      cmd = [compile_cmd]
      if compile_cmd != "nvcc":
          if (
              compile_shared
              or output.endswith(".so")
              or output.endswith(".dylib")
          ):
              cmd += ["-shared", "-fPIC"]
              if sys.platform == "darwin":
                  cmd += ["-undefined", "dynamic_lookup"]
          elif output.endswith(".obj"):
              cmd += ["-c"]
      else:
          if (
              compile_shared
              or output.endswith(".so")
              or output.endswith(".dylib")
          ):
              cmd += ["-shared"]
      cmd += ["-o", output]
      if isinstance(objects, str):
          cmd += [objects]
      else:
          cmd += objects
      if options:
          cmd += options
      env = None
      if ccache_env is not None:
          if shutil.which("ccache"):
              cmd.insert(0, "ccache")
              env = os.environ.copy()
              env.update(ccache_env)
          else:
              raise ValueError("ccache not found")
      proc = subprocess.Popen(
          cmd,
          stdout=subprocess.PIPE,
          stderr=subprocess.STDOUT,
          cwd=cwd,
          env=env,
      )
      (out, _) = proc.communicate()
      if proc.returncode != 0:
          msg = "Compilation error:\n"
          msg += py_str(out)
          msg += "\nCommand line: " + " ".join(cmd)
          raise RuntimeError(msg)
  
file_path: tvm/python/tvm/contrib/cc.py
imports: import sys
  import shutil
  import os
  import subprocess
  from .None import utils, tar
  from .._ffi.base import py_str
label_desc: Use image node_id 10 for calling a global function with example usage: _linux_compile(output, objects, options, compile_cmd, cwd, ccache_env, compile_shared) without return types