{"id":42685532,"url":"https://github.com/eclipse-score/bazel_cpp_toolchains","last_synced_at":"2026-01-29T12:17:17.493Z","repository":{"id":328163489,"uuid":"1107690440","full_name":"eclipse-score/bazel_cpp_toolchains","owner":"eclipse-score","description":"Bazel C/C++ toolchain configuration repository","archived":false,"fork":false,"pushed_at":"2026-01-19T21:55:53.000Z","size":49,"stargazers_count":1,"open_issues_count":6,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-20T04:19:44.579Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eclipse-score.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-01T13:37:28.000Z","updated_at":"2025-12-17T09:53:12.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/eclipse-score/bazel_cpp_toolchains","commit_stats":null,"previous_names":["eclipse-score/bazel_cpp_toolchains"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/eclipse-score/bazel_cpp_toolchains","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-score%2Fbazel_cpp_toolchains","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-score%2Fbazel_cpp_toolchains/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-score%2Fbazel_cpp_toolchains/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-score%2Fbazel_cpp_toolchains/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eclipse-score","download_url":"https://codeload.github.com/eclipse-score/bazel_cpp_toolchains/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-score%2Fbazel_cpp_toolchains/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28877319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T10:31:27.438Z","status":"ssl_error","status_checked_at":"2026-01-29T10:31:01.017Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-01-29T12:17:16.830Z","updated_at":"2026-01-29T12:17:17.485Z","avatar_url":"https://github.com/eclipse-score.png","language":"Starlark","funding_links":[],"categories":[],"sub_categories":[],"readme":"# S-CORE Bazel C/C++ Toolchain Configuration Repository\n\nThis repository provides the configuration layer for all S-CORE C++ toolchains used in Bazel builds.\u003c/br\u003e\nIt contains **no compiler binaries**. Instead, it defines:\n* Toolchain configurations\n* Toolchain rules and extensions for Bzlmod\n* Common compiler flags\n* Templates for generating toolchain configs\n* Package descriptors for external toolchain binaries\n* Tests ensuring correct toolchain behavior\n\nAll toolchain binaries (GCC, QCC, etc.) are downloaded through Bazel repositories defined in consuming workspaces. \u003c/br\u003e\nThis repository is structured and versioned as a Bazel module and is intended to be consumed through MODULE.bazel.\n\n## Key Goals\n\n* Provide a centralized, unified configuration source for all C++ toolchains used across S-CORE.\n* Enforce consistency through shared flags, templates, and mandatory feature tests.\n* Support multiple compilers (GCC, QCC) and multiple platforms (Linux, QNX).\n* Ensure reproducible builds across architectures by separating:\n    * configuration logic (this repo).\n    * binary/toolchain distributions (external packages).\n* Support plug-and-play toolchain activation via Bzlmod extensions.\n\n## Repository Structure\n\n```bash\n.\n│\n├── extensions                   # Module extensions for GCC/QCC toolchains\n│   ├── BUILD\n│   └── gcc.bzl\n│\n├── rules                        # Bazel rule implementations for toolchains\n│   ├── BUILD\n│   └── gcc.bzl\n│\n├── packages                     # Toolchain package descriptors (no binaries)\n│   ├── linux/                   # Linux toolchain versions (GCC only)\n│   ├── qnx/                     # QNX SDP/QCC toolchain metadata\n│   └── version_matrix.bzl       # Supported toolchain version definitions\n│\n├── templates                    # Templates for toolchain definition and configuration\n│   ├── linux/\n│   ├── qnx/\n│   ├── BUILD\n│   └── BUILD.template\n│\n├── examples                     # Functional examples for toolchain validation\n│\n├── docs                         # Sphinx documentation sources\n│\n├── tools                        # Utility scripts (e.g., QNX credential helper)\n│\n├── MODULE.bazel                 # Module declaration for Bzlmod\n├── BUILD\n├── LICENSE\n├── NOTICE\n└── README.md\n\n```\n\n## Toolchain Model\n\nThis repository does not contain compiler binaries. \u003c/br\u003e\nInstead:\n- Toolchain **packages** describe how to fetch compiler binaries via `http_archive` or internal artifact storage.\n- Toolchain **templates** describe how Bazel should use the binaries.\n- Toolchain **rules** and **extensions** generate and register toolchains.\n- Toolchain **examples** validate the toolchains.\n- This separation provides:\n    - Hermetic configurations\n    - Full reproducibility\n    - Clear ownership boundaries\n    - Easy addition of new compilers or versions\n\n\n## Using Toolchains in a different Bazel Module\n\n### GCC Example (Linux x86_64)\n\n```starlark\nbazel_dep(name = \"score_cpp_toolchains\", version = \"0.1.0\")\nuse_extension(\"@score_cpp_toolchains//extensions:gcc.bzl\", \"gcc\")\ngcc(\n    target_os = \"linux\",\n    target_cpu = \"x86_64\",\n    version = \"12.2.0\",\n    use_default_package = True,\n)\nuse_repo(gcc, \"score_gcc_toolchain\")\n```\n\n### QCC Example (QNX ARM64)\n\n```starlark\nbazel_dep(name = \"score_cpp_toolchains\", version = \"0.2.0\")\nuse_extension(\"@score_cpp_toolchains//extensions:gcc.bzl\", \"gcc\")\ngcc(\n    target_os = \"qnx\",\n    target_cpu = \"arm64\",\n    sdp_version = \"8.0.0\",\n    version = \"12.2.0\",\n    use_default_package = True,\n)\nuse_repo(gcc, \"score_gcc_qnx_toolchain\")\n```\n\nThe registration of toolchains is done by adding command line option `--extra_toolchains=@\u003ctoolchain_repo\u003e//:toolchain_name`\nIn case above this would be:\n```bash\n--extra_toolchains=@score_gcc_toolchain//:x86_64-linux-gcc-12.2.0\n--extra_toolchains=@score_gcc_qnx_toolchain//:x86_64-qnx-sdp-8.0.0\n```\n\n\u003e NOTE: In case that more than one toolchain needs to be defined, the registration must be protected via config flags otherwise\u003c/br\u003e\nthe first toolchain that matches constraints will be selected by toolchain resolutions.\n\n## Configuration Flags\n\nShared flag sets live under: \n\n- [linux](templates/linux/cc_toolchain_flags.bzl.template)\n- [qnx](templates/qnx/cc_toolchain_config.bzl.template)\n\nThese define:\n\n- Base C/C++ flags  \n- Optimization flags  \n- PIC/PIE handling  \n- Debug and sanitizer modes  \n- Linker behavior  \n- Warning levels  \n\n## Templates\n\nTemplates define how toolchain files are generated:\n\n- `BUILD.template`\n- `cc_toolchain_config.bzl.template`\n- `cc_gcov_wrapper.template`\n- `cc_toolchain_flags.bzl.template`\n\nThese templates simplify adding:\n\n- New compiler versions  \n- New compiler families  \n- New OS/arch combinations  \n\n## Testing and Validation\n\nTesting is part of the **integration gate pipeline**.\n\n## Examples\n\nExample cover:\n\n- Simple compilation ( [examples/main.cpp](./examples/main.cpp))\n- Toolchain registration behavior ([examples/.bazelrc](./examples/.bazelrc))\n\n# Documentation\n\nDocumentation uses **Sphinx** and lives in `docs/`. (Not yet prepared!)\n\n# QNX License\n\n## Local License File\n\nBy default, the QNX toolchain uses `/opt/score_qnx/license/licenses` as the license path.\nIf you want to change this location, you can override it by setting the `license_path` variable\nwhen calling the `gcc.toolchain(...)` function in your `MODULE.bazel` file.\n\n**Example:**\n\n```bazel\ngcc.toolchain(\n    name = \"score_qcc_toolchain\",\n    target_os = \"qnx\",\n    ...\n    license_path = \"/path/to/your/custom/licenses\",\n)\n```\n\n\u003e **TODO:** Is it possible to set this via environment variable?\n\n## License Servers\n\nIn case you are using a license server for QNX licenses (FLEXlm), you can set the license server information\neither locally in your module or centrally in your bazel configuration.\nThis also applies to floating licenses.\n\n### Module Local Configuration\n\nYou can set the license server for your toolchains by setting the variables `license_info_variable` and\n`license_info_url` when calling the `gcc.toolchain(...)` function in your `MODULE.bazel` file.\n\n**Example (for QNXLM_LICENSE_FILE variable):**\n\n```bazel\ngcc.toolchain(\n    name = \"score_qcc_toolchain\",\n    target_os = \"qnx\",\n    ...\n    license_info_variable = \"QNXLM_LICENSE_FILE\",\n    license_info_url = \"\u003cport\u003e@\u003clicense_server_host\u003e\",\n)\n```\n\n### Central Configuration\n\nIn case you want to set the license server for all your bazel projects you can set the\nenvironment variable in your `~/.bazelrc` file:\n\n**Example (for QNXLM_LICENSE_FILE variable):**\n\n```bazel\ncommon --action_env=QNXLM_LICENSE_FILE=\u003cport\u003e@\u003clicense_server_host\u003e\n```\n\nIn case you do not want to set it for all commands you can also set it per build/test command:\n\n```bazel\nbuild --action_env=QNXLM_LICENSE_FILE=\u003cport\u003e@\u003clicense_server_host\u003e\ntest --action_env=QNXLM_LICENSE_FILE=\u003cport\u003e@\u003clicense_server_host\u003e\n```\n\n# Adding New Toolchain Versions\n\n1. Update `packages/version_matrix.bzl`\n2. Add a package descriptor (e.g., `packages/linux/x86_64/gcc/13.1.0`)\n3. Generate configuration from templates\n4. Update flags if needed\n5. Submit through integration gate\n\n---\n\n# Tools\n\nUtility scripts such as:\n\n```\ntools/qnx_credential_helper.py\n```\n\nare used for repository authentication flows.\n\n---\n\n# License\n\nDistributed under:\n\n- `LICENSE`\n- `NOTICE`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclipse-score%2Fbazel_cpp_toolchains","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feclipse-score%2Fbazel_cpp_toolchains","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclipse-score%2Fbazel_cpp_toolchains/lists"}