Skip to main content

A catch-all compile-tool wrapper

Project description



canker is a catch-all compile tool wrapper.


$ pip3 install canker
$ eval $(canker-env --guess-wrapped)
$ export CANKER_ACTIONS="Record"
$ export CANKER_ACTION_RECORD="output=/tmp/demo.jsonl"
$ cd /your/project && make
$ cat /tmp/demo.jsonl


  • Wrapping CC, CXX, CPP, LD, and AS.
  • Providing a visitor-style API for each of the above, pre- and post-execution.
  • Providing a nice set of default actions.
  • Being as non-invasive as possible.


  • Using LD_PRELOAD to capture every exec in a build system, a la Bear.
  • Supporting cl.exe.
  • Detailed support for non C/C++ languages.
  • Parsing arguments that are passed via @file.

Contributing a new action

New canker actions are easy to write. For example, the following prints a message before every ld invocation:

# src/canker/actions/

from canker.action import LDAction

class PrintLD(LDAction):
    def before_run(self, tool):
        print(f"ld was run with: {tool.args}")
# src/canker/actions/

# bring PrintLD into canker.actions so that `CANKER_ACTIONS` can find it
from printld import PrintLD  # noqa: F401
$ eval $(canker-env --guess-wrapped)
$ export CANKER_ACTIONS="PrintLD"
$ make

Check out canker's API documentation for more details, including the kinds of available actions.

The name?

My phone autocorrected "CMake" to "canker" once.

Canker is cognate with cancer, which is appropriate for both build systems and tools that instrument build systems (like canker does).

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

canker-0.0.7.tar.gz (14.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page