Util scripts aimed at simplifying the use of `zig cc` for compiling C, C++, Rust, and Go programs.
Project description
zigcc
Scripts aimed at simplifying the use of zig cc 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:
- zig cc: parse -target and -mcpu/-march/-mtune flags according to clang #4911
- Targets compare: Rust to Zig
- unsupported linker arg
- Rust + `zig cc` CRT conflict. : rust
So this project was born, it will
- Convert target between Zig and Rust/Go
- Ignore link args when
zig ccthrow errors, hopefully this will make compile successfully, WIP.
Install
pip3 install -U zigcc
This will install three executables:
zigcc, used forCCzigcxx, used forCXXzigcargocan used to replacecargo, it will automatically setCCCARGO_TARGET_<triple>_LINKERtozigccCXXtozigcxx
Use in GitHub Action
Adding a step to your workflow like this:
- name: Install zigcc
uses: jiacai2050/my-works@main
with:
zig-version: master
Then you can invoke zigcc zigcxx
zigcargo in following steps.
Config
There some are env variable to config zigcc:
-
ZIGCC_FLAGS, space separated flags, pass to zig cc. -
ZIGCC_ENABLE_SANITIZEBy default Zig will pass-fsanitize=undefined -fsanitize-trap=undefinedto clang when compile without-O2,-O3, this causes Undefined Behavior to cause an Illegal Instruction, see Catching undefined behavior with zig cc.So we disable it by default, set this variable to
1to re-enable it. -
ZIGCC_BLACKLIST_FLAGS, space separated flags, used to filter flagszig ccdon't support, such as-Wl,-dylibotherwise you could see errors belownote: error: unsupported linker arg: -dylib
-
ZIGCC_VERBOSESet to1enable 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zigcc-1.1.0.tar.gz.
File metadata
- Download URL: zigcc-1.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.12.3 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a01791ff35dd0dac62ec378885d6e5a09dc0d28d87cb31b8a190dd893390bbe4
|
|
| MD5 |
c7396b08fc2de2c70588355b0bf948fe
|
|
| BLAKE2b-256 |
3775316c8fbcaa4c3cb995196edd3fab4f94750664aaafccacebb4c421b4888b
|
File details
Details for the file zigcc-1.1.0-py3-none-any.whl.
File metadata
- Download URL: zigcc-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.12.3 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2324230c36f995b92e14ab6ef1d78a9f08301bcb4fd1b5487455da44c28a01c
|
|
| MD5 |
4af8279f3ef1a35fbfd19bcc52dab81e
|
|
| BLAKE2b-256 |
9901a50937782c93864510a4b05bc4dbe84dbd3d266cc59249638e1f4da03f50
|