Skip to main content

Util scripts aimed at simplifying the use of `zig cc` for compiling C, C++, Rust, and Go programs.

Project description

zigcc

Util scripts aimed at simplifying the use of zig cc{.verbatim} for compiling C, C++, Rust, and Go programs.

Why

In most cases, we can use following command to use Zig for compile

CC='zig cc' CXX='zig c++' ...

However in real world, there are many issues this way, such as:

So this project was born, it will

  • Convert target between Zig and Rust/Go
  • Ignore link args when zig cc{.verbatim} throw errors, hopefully this will make compile successfully, WIP.

Install

pip3 install -U zigcc

This will install three executables:

  • zigcc{.verbatim}, used for CC{.verbatim}
  • zigcxx{.verbatim}, used for CXX{.verbatim}
  • zigcargo{.verbatim} can used to replace cargo{.verbatim}, it will automatically set
    • CC{.verbatim} CARGO_TARGET_<triple>_LINKER{.verbatim} to zigcc{.verbatim}
    • CXX{.verbatim} to zigcxx{.verbatim}

Use in GitHub Action

Adding a step to your workflow like this:

- name: Install zigcc
  uses: jiacai2050/zigcc@v1
  with:
    zig-version: master

Then you can invoke zigcc{.verbatim} zigcxx{.verbatim} zigcargo{.verbatim} in following steps.

Config

There some are env variable to config zigcc:

  • ZIGCC_FLAGS{.verbatim}, space separated flags, pass to zig cc. An example is set this to -fno-sanitize=undefined{.verbatim} to disable sanitize since they may break your programs. See Catching undefined behavior with zig cc

  • ZIGCC_BLACKLIST_FLAGS{.verbatim}, space separated flags, used to filter flags zig cc{.verbatim} don't support, such as -Wl,-dylib{.verbatim} otherwise you could see errors below

    note: error: unsupported linker arg: -dylib
    
  • ZIGCC_VERBOSE{.verbatim} Set to 1{.verbatim} enable verbose logs.

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

zigcc-1.0.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zigcc-1.0.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file zigcc-1.0.0.tar.gz.

File metadata

  • Download URL: zigcc-1.0.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.2

File hashes

Hashes for zigcc-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2af491a6be24df3ffc9a89a6d638c3ec8e96a3f33749c9390be448c60a0e0c5e
MD5 baa26e3409bc05a555e9d532168c712b
BLAKE2b-256 43e66b353a86260d4be817b1fa4d786b5fc64ae8966fe8a5ac634c61acad394e

See more details on using hashes here.

File details

Details for the file zigcc-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: zigcc-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.2

File hashes

Hashes for zigcc-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af2b712edc27514d98ab1a9ddb62e1815486efef60a23a7a259d6d979cb7b228
MD5 bb096ebd0a7efe88d963441c641f215b
BLAKE2b-256 23d4690393ad6dc44cf045cf79518b2505a2e357d7acc545ce5b6650b68fb420

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page