Name | zigcc JSON |
Version |
1.0.1
JSON |
| download |
home_page | None |
Summary | Util scripts aimed at simplifying the use of `zig cc` for compiling C, C++, Rust, and Go programs. |
upload_time | 2024-11-24 13:54:33 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.0.0 |
license | GPL-3.0 |
keywords |
compile
cross-compile
go
rust
zig
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# zigcc
[![](https://github.com/jiacai2050/zig-cc/actions/workflows/ci.yml/badge.svg)](https://github.com/jiacai2050/zig-cc/actions/workflows/ci.yml)
[![](https://github.com/jiacai2050/zig-cc/actions/workflows/zig.yml/badge.svg)](https://github.com/jiacai2050/zig-cc/actions/workflows/zig.yml)
[![](https://github.com/jiacai2050/zig-cc/actions/workflows/release.yml/badge.svg)](https://github.com/jiacai2050/zig-cc/actions/workflows/release.yml)
[![](https://img.shields.io/pypi/v/zigcc.svg)](https://pypi.org/project/zigcc)
Util 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
``` bash
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](https://github.com/ziglang/zig/issues/4911)
- [Targets compare: Rust to
Zig](https://gist.github.com/kassane/446889ea1dd5ff07048d921f2b755e78)
- [unsupported linker
arg](https://github.com/search?q=repo%3Aziglang%2Fzig+unsupported+linker+arg%3A&type=issues)
- [Rust + \`zig cc\` CRT conflict. :
rust](https://www.reddit.com/r/rust/comments/q866qx/rust_zig_cc_crt_conflict/)
So this project was born, it will
- Convert target between Zig and Rust/Go
- Ignore link args when `zig cc` throw errors, hopefully
this will make compile successfully, WIP.
# Install
``` bash
pip3 install -U zigcc
```
This will install three executables:
- `zigcc`, used for `CC`
- `zigcxx`, used for `CXX`
- `zigcargo` can used to replace `cargo`, it
will automatically set
- `CC` `CARGO_TARGET_<triple>_LINKER` to
`zigcc`
- `CXX` to `zigcxx`
# Use in GitHub Action
Adding a step to your workflow like this:
``` yaml
- name: Install zigcc
uses: jiacai2050/zigcc@v1
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_SANITIZE` By default Zig will pass
`-fsanitize=undefined -fsanitize-trap=undefined` to clang
when compile without `-O2`, `-O3`, this causes
Undefined Behavior to cause an Illegal Instruction, see [Catching
undefined behavior with zig
cc](https://nathancraddock.com/blog/zig-cc-undefined-behavior/).
So we disable it by default, set this variable to `1` to
re-enable it.
- `ZIGCC_BLACKLIST_FLAGS`, space separated flags, used to
filter flags `zig cc` don\'t support, such as
`-Wl,-dylib` otherwise you could see errors below
``` bash
note: error: unsupported linker arg: -dylib
```
- `ZIGCC_VERBOSE` Set to `1` enable verbose
logs.
Raw data
{
"_id": null,
"home_page": null,
"name": "zigcc",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.0.0",
"maintainer_email": null,
"keywords": "compile, cross-compile, go, rust, zig",
"author": null,
"author_email": "Jiacai Liu <dev@liujiacai.net>",
"download_url": "https://files.pythonhosted.org/packages/bb/5b/8aa529bf4cd4cd2746d31a5f2be15a677a05c1e216b687e0c38bad5014cf/zigcc-1.0.1.tar.gz",
"platform": null,
"description": "# zigcc\n\n[![](https://github.com/jiacai2050/zig-cc/actions/workflows/ci.yml/badge.svg)](https://github.com/jiacai2050/zig-cc/actions/workflows/ci.yml)\n[![](https://github.com/jiacai2050/zig-cc/actions/workflows/zig.yml/badge.svg)](https://github.com/jiacai2050/zig-cc/actions/workflows/zig.yml)\n[![](https://github.com/jiacai2050/zig-cc/actions/workflows/release.yml/badge.svg)](https://github.com/jiacai2050/zig-cc/actions/workflows/release.yml)\n[![](https://img.shields.io/pypi/v/zigcc.svg)](https://pypi.org/project/zigcc)\n\nUtil scripts aimed at simplifying the use of `zig cc` for\ncompiling C, C++, Rust, and Go programs.\n\n# Why\n\nIn most cases, we can use following command to use Zig for compile\n\n``` bash\nCC='zig cc' CXX='zig c++' ...\n```\n\nHowever in real world, there are many issues this way, such as:\n\n- [zig cc: parse -target and -mcpu/-march/-mtune flags according to\n clang #4911](https://github.com/ziglang/zig/issues/4911)\n- [Targets compare: Rust to\n Zig](https://gist.github.com/kassane/446889ea1dd5ff07048d921f2b755e78)\n- [unsupported linker\n arg](https://github.com/search?q=repo%3Aziglang%2Fzig+unsupported+linker+arg%3A&type=issues)\n- [Rust + \\`zig cc\\` CRT conflict. :\n rust](https://www.reddit.com/r/rust/comments/q866qx/rust_zig_cc_crt_conflict/)\n\nSo this project was born, it will\n\n- Convert target between Zig and Rust/Go\n- Ignore link args when `zig cc` throw errors, hopefully\n this will make compile successfully, WIP.\n\n# Install\n\n``` bash\npip3 install -U zigcc\n```\n\nThis will install three executables:\n\n- `zigcc`, used for `CC`\n- `zigcxx`, used for `CXX`\n- `zigcargo` can used to replace `cargo`, it\n will automatically set\n - `CC` `CARGO_TARGET_<triple>_LINKER` to\n `zigcc`\n - `CXX` to `zigcxx`\n\n# Use in GitHub Action\n\nAdding a step to your workflow like this:\n\n``` yaml\n- name: Install zigcc\n uses: jiacai2050/zigcc@v1\n with:\n zig-version: master\n```\n\nThen you can invoke `zigcc` `zigcxx`\n`zigcargo` in following steps.\n\n# Config\n\nThere some are env variable to config zigcc:\n\n- `ZIGCC_FLAGS`, space separated flags, pass to zig cc.\n\n- `ZIGCC_ENABLE_SANITIZE` By default Zig will pass\n `-fsanitize=undefined -fsanitize-trap=undefined` to clang\n when compile without `-O2`, `-O3`, this causes\n Undefined Behavior to cause an Illegal Instruction, see [Catching\n undefined behavior with zig\n cc](https://nathancraddock.com/blog/zig-cc-undefined-behavior/).\n\n So we disable it by default, set this variable to `1` to\n re-enable it.\n\n- `ZIGCC_BLACKLIST_FLAGS`, space separated flags, used to\n filter flags `zig cc` don\\'t support, such as\n `-Wl,-dylib` otherwise you could see errors below\n\n ``` bash\n note: error: unsupported linker arg: -dylib\n ```\n\n- `ZIGCC_VERBOSE` Set to `1` enable verbose\n logs.\n",
"bugtrack_url": null,
"license": "GPL-3.0",
"summary": "Util scripts aimed at simplifying the use of `zig cc` for compiling C, C++, Rust, and Go programs.",
"version": "1.0.1",
"project_urls": {
"Issues": "https://github.com/jiacai2050/zigcc/issues",
"Repository": "https://github.com/jiacai2050/zigcc"
},
"split_keywords": [
"compile",
" cross-compile",
" go",
" rust",
" zig"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "5df0f86f8e3775f2b5fdc527a7be1d997a913276d8a9e624232e263c4e99ff0c",
"md5": "d11c0df70630390c9061f35b38a77f33",
"sha256": "e4c7a5cfe57cd760f69748a9a01fc8effd1354ee18469176693a0eaf4f735106"
},
"downloads": -1,
"filename": "zigcc-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d11c0df70630390c9061f35b38a77f33",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.0.0",
"size": 5736,
"upload_time": "2024-11-24T13:54:34",
"upload_time_iso_8601": "2024-11-24T13:54:34.930327Z",
"url": "https://files.pythonhosted.org/packages/5d/f0/f86f8e3775f2b5fdc527a7be1d997a913276d8a9e624232e263c4e99ff0c/zigcc-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "bb5b8aa529bf4cd4cd2746d31a5f2be15a677a05c1e216b687e0c38bad5014cf",
"md5": "23db730e19d62dc5bb83f5e474598a0a",
"sha256": "43033173fae68d7e8b8aaaa3e1f03fc3ceb385c746c02b72497465e9fb2131ad"
},
"downloads": -1,
"filename": "zigcc-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "23db730e19d62dc5bb83f5e474598a0a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.0.0",
"size": 5083,
"upload_time": "2024-11-24T13:54:33",
"upload_time_iso_8601": "2024-11-24T13:54:33.594998Z",
"url": "https://files.pythonhosted.org/packages/bb/5b/8aa529bf4cd4cd2746d31a5f2be15a677a05c1e216b687e0c38bad5014cf/zigcc-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-24 13:54:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jiacai2050",
"github_project": "zigcc",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "zigcc"
}