{"id":15046875,"url":"https://github.com/jiacai2050/zigcc","last_synced_at":"2025-10-28T13:31:27.570Z","repository":{"id":220979320,"uuid":"753097387","full_name":"jiacai2050/zigcc","owner":"jiacai2050","description":"A util script that aims to ease use zig cc to compile C/C++/Rust/Go programs.","archived":false,"fork":false,"pushed_at":"2024-06-10T09:53:22.000Z","size":42,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-09-29T02:05:36.917Z","etag":null,"topics":["compile","go","golang","rust","rustlang","zig","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jiacai2050.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-05T13:17:43.000Z","updated_at":"2024-09-05T12:45:14.000Z","dependencies_parsed_at":"2024-02-05T14:48:58.480Z","dependency_job_id":"43afe88b-9c30-422c-9675-827719e1ac0f","html_url":"https://github.com/jiacai2050/zigcc","commit_stats":null,"previous_names":["jiacai2050/zig-cc","jiacai2050/zigcc"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiacai2050%2Fzigcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiacai2050%2Fzigcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiacai2050%2Fzigcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiacai2050%2Fzigcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jiacai2050","download_url":"https://codeload.github.com/jiacai2050/zigcc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219859520,"owners_count":16556036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compile","go","golang","rust","rustlang","zig","ziglang"],"created_at":"2024-09-24T20:53:41.616Z","updated_at":"2025-10-28T13:31:27.558Z","avatar_url":"https://github.com/jiacai2050.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+begin_quote\n[!TIP]\nRepo Move to https://github.com/jiacai2050/my-works/tree/main/zigcc\n#+end_quote\n\n* zigcc\n[[https://github.com/jiacai2050/zig-cc/actions/workflows/ci.yml][https://github.com/jiacai2050/zig-cc/actions/workflows/ci.yml/badge.svg]]\n[[https://github.com/jiacai2050/zig-cc/actions/workflows/zig.yml][https://github.com/jiacai2050/zig-cc/actions/workflows/zig.yml/badge.svg]]\n[[https://github.com/jiacai2050/zig-cc/actions/workflows/release.yml][https://github.com/jiacai2050/zig-cc/actions/workflows/release.yml/badge.svg]]\n[[https://pypi.org/project/zigcc][https://img.shields.io/pypi/v/zigcc.svg]]\n\nUtil scripts aimed at simplifying the use of =zig cc= for compiling C, C++, Rust, and Go programs.\n\n* Why\nIn most cases, we can use following command to use Zig for compile\n#+begin_src bash\nCC='zig cc' CXX='zig c++' ...\n#+end_src\nHowever in real world, there are many issues this way, such as:\n- [[https://github.com/ziglang/zig/issues/4911][zig cc: parse -target and -mcpu/-march/-mtune flags according to clang #4911]]\n- [[https://gist.github.com/kassane/446889ea1dd5ff07048d921f2b755e78][Targets compare: Rust to Zig]]\n- [[https://github.com/search?q=repo%3Aziglang%2Fzig+unsupported+linker+arg%3A\u0026type=issues][unsupported linker arg]]\n- [[https://www.reddit.com/r/rust/comments/q866qx/rust_zig_cc_crt_conflict/][Rust + `zig cc` CRT conflict. : rust]]\nSo this project was born, it will\n- Convert target between Zig and Rust/Go\n- Ignore link args when =zig cc= throw errors, hopefully this will make compile successfully, WIP.\n* Install\n#+begin_src bash\npip3 install -U zigcc\n#+end_src\n\nThis will install three executables:\n- =zigcc=, used for =CC=\n- =zigcxx=, used for =CXX=\n- =zigcargo= can used to replace =cargo=, it will automatically set\n  - =CC= =CARGO_TARGET_\u003ctriple\u003e_LINKER= to =zigcc=\n  - =CXX= to =zigcxx=\n\n* Use in GitHub Action\nAdding a step to your workflow like this:\n#+begin_src yaml\n      - name: Install zigcc\n        uses: jiacai2050/zigcc@v1\n        with:\n          zig-version: master\n#+end_src\nThen you can invoke =zigcc= =zigcxx= =zigcargo= in following steps.\n\n* Config\nThere some are env variable to config zigcc:\n- =ZIGCC_FLAGS=, space separated flags, pass to zig cc.\n- =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 [[https://nathancraddock.com/blog/zig-cc-undefined-behavior/][Catching undefined behavior with zig cc]].\n\n  So we disable it by default, set this variable to =1= to re-enable it.\n- =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\n  #+begin_src bash\n  note: error: unsupported linker arg: -dylib\n  #+end_src\n- =ZIGCC_VERBOSE= Set to =1= enable verbose logs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiacai2050%2Fzigcc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjiacai2050%2Fzigcc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiacai2050%2Fzigcc/lists"}