zigcc


Namezigcc JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA util script that aims to ease use `zig cc` to compile C/C++/Rust/Go programs.
upload_time2024-06-07 15:48:42
maintainerNone
docs_urlNone
authorNone
requires_python>=3.0.0
licenseNone
keywords compile cross-compile 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>](https://pypi.org/project/zigcc)

A util script that aims to ease use `zig cc`{.verbatim} to compile
C/C++/Rust/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`{.verbatim} throw errors, hopefully
    this will make compile successfully, WIP.

# Install

``` bash
pip 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:

``` yaml
- uses: jiacai2050/zigcc@main
  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](https://nathancraddock.com/blog/zig-cc-undefined-behavior/)

-   `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

    ``` bash
    = note: error: unsupported linker arg: -dylib
    ```

-   `ZIGCC_VERBOSE`{.verbatim} Set to `1`{.verbatim} 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, rust, zig",
    "author": null,
    "author_email": "Jiacai Liu <dev@liujiacai.net>",
    "download_url": "https://files.pythonhosted.org/packages/5b/97/3f1133578a764a0998f2fe93d9ef5c8ada2c5f8a8af40c8e722560aea1b8/zigcc-0.1.0.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>](https://pypi.org/project/zigcc)\n\nA util script that aims to ease use `zig cc`{.verbatim} to compile\nC/C++/Rust/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`{.verbatim} throw errors, hopefully\n    this will make compile successfully, WIP.\n\n# Install\n\n``` bash\npip install -U zigcc\n```\n\nThis will install three executables:\n\n-   `zigcc`{.verbatim}, used for `CC`{.verbatim}\n-   `zigcxx`{.verbatim}, used for `CXX`{.verbatim}\n-   `zigcargo`{.verbatim} can used to replace `cargo`{.verbatim}, it\n    will automatically set\n    -   `CC`{.verbatim} `CARGO_TARGET_<triple>_LINKER`{.verbatim} to\n        `zigcc`{.verbatim}\n    -   `CXX`{.verbatim} to `zigcxx`{.verbatim}\n\n# Use in GitHub Action\n\nAdding a step to your workflow like this:\n\n``` yaml\n- uses: jiacai2050/zigcc@main\n  with:\n    zig-version: master\n```\n\nThen you can invoke `zigcc`{.verbatim} `zigcxx`{.verbatim}\n`zigcargo`{.verbatim} in following steps.\n\n# Config\n\nThere some are env variable to config zigcc:\n\n-   `ZIGCC_FLAGS`{.verbatim}, space separated flags, pass to zig cc. An\n    example is set this to `-fno-sanitize=undefined`{.verbatim} to\n    disable sanitize since they may break your programs. See [Catching\n    undefined behavior with zig\n    cc](https://nathancraddock.com/blog/zig-cc-undefined-behavior/)\n\n-   `ZIGCC_BLACKLIST_FLAGS`{.verbatim}, space separated flags, used to\n    filter flags `zig cc`{.verbatim} don\\'t support, such as\n    `-Wl,-dylib`{.verbatim} otherwise you could see errors below\n\n    ``` bash\n    = note: error: unsupported linker arg: -dylib\n    ```\n\n-   `ZIGCC_VERBOSE`{.verbatim} Set to `1`{.verbatim} enable verbose\n    logs.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A util script that aims to ease use `zig cc` to compile C/C++/Rust/Go programs.",
    "version": "0.1.0",
    "project_urls": {
        "Issues": "https://github.com/jiacai2050/zigcc/issues",
        "Repository": "https://github.com/jiacai2050/zigcc"
    },
    "split_keywords": [
        "compile",
        " cross-compile",
        " rust",
        " zig"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fffe963c38b1986d0c7ccffa0621f2d16e41a86623d97a1f5fd986a833ca6ce7",
                "md5": "9913f2b44b5eba558f5addea4deb4999",
                "sha256": "ea759e6fba54680a162281d2efbd1589b5117b09ed54e490683ff3ae7d52d9ea"
            },
            "downloads": -1,
            "filename": "zigcc-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9913f2b44b5eba558f5addea4deb4999",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.0.0",
            "size": 5564,
            "upload_time": "2024-06-07T15:48:44",
            "upload_time_iso_8601": "2024-06-07T15:48:44.407022Z",
            "url": "https://files.pythonhosted.org/packages/ff/fe/963c38b1986d0c7ccffa0621f2d16e41a86623d97a1f5fd986a833ca6ce7/zigcc-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5b973f1133578a764a0998f2fe93d9ef5c8ada2c5f8a8af40c8e722560aea1b8",
                "md5": "1431e28df8b67884d515e845c07472ae",
                "sha256": "70304d0a4719b5dbae9f6b4c8947ab0fa0a96c48f3e56da51055127809f67160"
            },
            "downloads": -1,
            "filename": "zigcc-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1431e28df8b67884d515e845c07472ae",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.0.0",
            "size": 4867,
            "upload_time": "2024-06-07T15:48:42",
            "upload_time_iso_8601": "2024-06-07T15:48:42.843526Z",
            "url": "https://files.pythonhosted.org/packages/5b/97/3f1133578a764a0998f2fe93d9ef5c8ada2c5f8a8af40c8e722560aea1b8/zigcc-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-07 15:48:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jiacai2050",
    "github_project": "zigcc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "zigcc"
}
        
Elapsed time: 0.57917s