{"id":24520460,"url":"https://github.com/keith/bazel-cc-sysroot-generator","last_synced_at":"2025-12-30T01:04:47.939Z","repository":{"id":272821541,"uuid":"913974059","full_name":"keith/bazel-cc-sysroot-generator","owner":"keith","description":"Create hermetic CC sysroots for use with bazel","archived":false,"fork":false,"pushed_at":"2025-01-16T19:50:33.000Z","size":46,"stargazers_count":11,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T20:51:39.711Z","etag":null,"topics":[],"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/keith.png","metadata":{"files":{"readme":"README.md","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":"2025-01-08T17:50:36.000Z","updated_at":"2025-01-16T19:50:36.000Z","dependencies_parsed_at":"2025-01-16T20:51:42.357Z","dependency_job_id":"06d32372-90f7-4255-9e50-a965d935f6db","html_url":"https://github.com/keith/bazel-cc-sysroot-generator","commit_stats":null,"previous_names":["keith/bazel-cc-sysroot-generator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keith%2Fbazel-cc-sysroot-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keith%2Fbazel-cc-sysroot-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keith%2Fbazel-cc-sysroot-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keith%2Fbazel-cc-sysroot-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keith","download_url":"https://codeload.github.com/keith/bazel-cc-sysroot-generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235050208,"owners_count":18927917,"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":[],"created_at":"2025-01-22T02:25:34.094Z","updated_at":"2025-10-02T23:35:13.166Z","avatar_url":"https://github.com/keith.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bazel-cc-sysroot-generator\n\nThis is a CLI for generating Ubuntu and macOS hermetic sysroots for use\nwith bazel.\n\n## Usage\n\n### Prerequisites\n\nPlease make sure you have at least Python 3.12, `tar`, `zstd`, and `xz-utils` installed.\n\n### Generate sysroots\n\nCreate a config file named `sysroot-config.toml` (or `.json`) to define\nyour sysroots:\n\n```toml\n[[platforms]]\nos = \"jammy\"\narchs = [\"aarch64\", \"x86_64\"]\npackages = [\n  \"libstdc++-11-dev\",\n  \"libstdc++6\",\n]\ndeleted_patterns = [\n  \"etc\",\n  \"usr/bin\",\n]\n\n[[platforms]]\nos = \"macos\"\ndeleted_patterns = [\n  \"*Swift*\",\n  \"*iOSSupport*\",\n  \"usr/share\",\n  \"usr/libexec\",\n]\n```\n\nFor Ubuntu you can optionally specifiy repositories to pull from:\n\n```toml\n[[platforms]]\nos = \"jammy\"\nrepositories = [\"main\", \"universe\"]\n...\n```\n\nRun `./bazel-cc-sysroot-generator` (optionally passing `--config\npath/to/sysroot-config.toml`).\n\nThis example config generates 3 sysroots in the current directory.\n\n\u003e [!NOTE]\n\u003e macOS sysroots can only be generated on macOS and copy the\n\u003e currently selected SDK directory.\n\n### Include in bazel\n\nOnce you have generated the sysroots, you can upload them somewhere and\nreference them in bazel with something like:\n\n```bzl\n# MODULE.bazel\nbazel_dep(name = \"sysroot-jammy-x86_64\")\narchive_override(\n    module_name = \"sysroot-jammy-x86_64\",\n    integrity = \"...\",\n    urls = [\n        \"https://...\",\n    ],\n)\n```\n\nAnd use them with a hermetic CC toolchain such as\n[toolchains_llvm](https://github.com/bazel-contrib/toolchains_llvm) with\nsomething like:\n\n```bzl\n# MODULE.bazel\nllvm = use_extension(\"@toolchains_llvm//toolchain/extensions:llvm.bzl\", \"llvm\")\nllvm.toolchain(\n    name = \"llvm_toolchain\",\n    llvm_versions = {\"\": \"19.1.9\"},\n    stdlib = {\"\": \"dynamic-stdc++\"},\n)\n\nllvm.sysroot(\n    name = \"llvm_toolchain\",\n    label = \"@sysroot-jammy-x86_64\",\n    targets = [\"linux-x86_64\"],\n)\nuse_repo(llvm, \"llvm_toolchain\")\n\nregister_toolchains(\"@llvm_toolchain//:all\")\n```\n\nOptionally you can disable bazel's builtin CC toolchain to make sure\nit's an error if you accidentally use it by adding this to your\n`.bazelrc`:\n\n```\ncommon --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1\n```\n\n\u003e [!TIP]\n\u003e While iterating on your required packages, you can use\n\u003e `--override_module=sysroot-jammy-x86_64=path/to/sysroot-jammy-x86_64`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeith%2Fbazel-cc-sysroot-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeith%2Fbazel-cc-sysroot-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeith%2Fbazel-cc-sysroot-generator/lists"}