{"id":13648174,"url":"https://github.com/compiler-explorer/gcc-cross-builder","last_synced_at":"2025-09-03T18:32:10.484Z","repository":{"id":38025152,"uuid":"242880184","full_name":"compiler-explorer/gcc-cross-builder","owner":"compiler-explorer","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-08T10:32:41.000Z","size":773,"stargazers_count":8,"open_issues_count":5,"forks_count":15,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-08-29T23:46:02.561Z","etag":null,"topics":["docker-images"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/compiler-explorer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2020-02-25T01:17:08.000Z","updated_at":"2025-08-08T10:32:45.000Z","dependencies_parsed_at":"2024-01-17T10:13:31.985Z","dependency_job_id":"5a81cca9-8ecd-4dae-bcbf-5224480d8fca","html_url":"https://github.com/compiler-explorer/gcc-cross-builder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/compiler-explorer/gcc-cross-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compiler-explorer%2Fgcc-cross-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compiler-explorer%2Fgcc-cross-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compiler-explorer%2Fgcc-cross-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compiler-explorer%2Fgcc-cross-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/compiler-explorer","download_url":"https://codeload.github.com/compiler-explorer/gcc-cross-builder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compiler-explorer%2Fgcc-cross-builder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273489905,"owners_count":25115043,"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","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["docker-images"],"created_at":"2024-08-02T01:04:01.863Z","updated_at":"2025-09-03T18:32:09.723Z","avatar_url":"https://github.com/compiler-explorer.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"### GCC Cross Compiler build scripts\n\nThe repository is part of the [Compiler Explorer](https://godbolt.org/) project. It builds\nthe docker images used to build the various GCC cross-compilers used on the site.\n\n## How to add a new target\n\n- create a ct-ng config:\n  - can be based on a ct-ng sample\n  - can be a new config\n  - disable PROGRESS_BAR and any gdb features\n- check it builds correctly:\n  `./ct-ng build`\n- copy the config in this repository in `build/latest` following the naming convention.\n- build the container as a one-off with `docker build -t gcc-cross .`\n- use `local_build.sh` to test a build it within the docker container\n  `./local_build.sh arm64 13.2.0`\n- add ct-ng config and commit (and open a Pull Request)\n\nLater, when the config is added, trigger a build (only an admin can do that):\n\n``` sh\ngh workflow run -R compiler-explorer/infra 'Custom compiler build' -f image=gcc-cross -f version=\"arm64 14.2.0\"\n```\n\nLater, when the build is finished, add the needed config in `infra` repository. Test it with:\n\n``` sh\n ./bin/ce_install install compilers/c++/cross/gcc/arm 14.2.0\n```\nThe installation can be done locally without merging anything in `infra`.\n\nWhen the compiler is installed, then you can update the config files using the\ninstructions below (intallation is required, the script probes the install dir to check the required bin).\nThe script won't touch any config as it's a new target, but\nit will provide most of the content, ready to be copy/pasted all around.\n\n## How to add a new version for some/all cross compilers\n\nThe script [check_and_update_conf.py](./check_and_update_conf.py) can be used to automate some work:\n- update the various configurations for our nodes on AWS (i.e. all the\n  `*.amazon.properties` in the\n  [compiler-explorer](https://github.com/compiler-explorer/compiler-explorer/tree/main/etc/config)\n  repository).\n- while doing so, it checks the mapping between the languages enabled in the\n  crosstool-ng config file and the actually installed compiler.\n- generate a simple script to smoketest the newly added compilers using the\n  [API](https://github.com/compiler-explorer/compiler-explorer/blob/main/docs/API.md)\n\nBeware that you should not trust blindly everything the script does. You should\nprobably still try manually (or at least some random combination if testing\neverything is too much).\n\nThe script is invoked for a given target arch and will do its magic from this point. Here's a sample execution for adding GCC 12.2.0 for ARM64:\n\n```\n$ ./check_and_update_conf.py -a arm64 --version 12.2.0\\\n   --guess-previous\\\n   --config-dir ~/git/compiler-explorer/compiler-explorer/etc/config/\\\n   --inplace \\\n   --config-todo fixups.txt \\\n   --summary summary.txt \\\n   --create-api-tests tests.sh\n```\n\nThis will read/modify (`--inplace`) needed config files located in\n`~/git/compiler-explorer/compiler-explorer/etc/config`. The script tries to be\nsmart and find a previous matching compiler for all languages for the target,\nbut this may not be possible (e.g. the naming pattern is different or there is\nreally no previous one). In this case, the script still produces some\nconfiguration that you need to add manually. It in the `fixups.txt` (as\nspecified by `--config-todo fixups.txt`):\n\n```\nPlease add the following in /bla/git/compiler-explorer/compiler-explorer/etc/config/c++.amazon.properties:\n8\u003c---8\u003c--- BEGIN ---8\u003c---8\u003c---\n\ncompiler.rv32-cgcc1220.exe=/opt/compiler-explorer/riscv32/gcc-12.2.0/riscv32-unknown-linux-gnu/bin/riscv32-unknown-linux-gnu-g++\ncompiler.rv32-cgcc1220.semver=12.2.0\ncompiler.rv32-cgcc1220.objdumper=/opt/compiler-explorer/riscv32/gcc-12.2.0/riscv32-unknown-linux-gnu/bin/riscv32-unknown-linux-gnu-objdump\ncompiler.rv32-cgcc1220.demangler=/opt/compiler-explorer/riscv32/gcc-12.2.0/riscv32-unknown-linux-gnu/bin/riscv32-unknown-linux-gnu-c++filt\ncompiler.rv32-cgcc1220.name=riscv32 12.2.0\n\n8\u003c---8\u003c--- END ---8\u003c---8\u003c---\n```\n\nThe `--summary summary.txt ` instructs the script to create a small summary of what happened and what you still need to do by hand:\n\n```\nALREADY EXISTS: riscv32 12.2.0 D\nALREADY EXISTS: riscv32 12.2.0 FORTRAN\nMANUAL FIXUP NEEDED: riscv32 12.2.0 CXX\nALREADY EXISTS: riscv32 12.2.0 C\nALREADY EXISTS: riscv64 12.2.0 ADA\nALREADY EXISTS: riscv64 12.2.0 D\nALREADY EXISTS: riscv64 12.2.0 FORTRAN\nMANUAL FIXUP NEEDED: riscv64 12.2.0 CXX\nALREADY EXISTS: riscv64 12.2.0 GO\nALREADY EXISTS: riscv64 12.2.0 C\nALREADY EXISTS: mipsel 12.2.0 D\nALREADY EXISTS: mipsel 12.2.0 FORTRAN\nALREADY EXISTS: mipsel 12.2.0 CXX\nALREADY EXISTS: mipsel 12.2.0 GO\nALREADY EXISTS: mipsel 12.2.0 C\nALREADY EXISTS: mips64el 12.2.0 FORTRAN\nALREADY EXISTS: mips64el 12.2.0 CXX\nALREADY EXISTS: mips64el 12.2.0 GO\nALREADY EXISTS: mips64el 12.2.0 C\n```\n\nIt can also create a shell script (it has been `shellcheck`ed, but would not\nqualify for best shell-style) to tests that all newly added compilers are\nbehaving. You still need to check if the results are expected as the script\ncan't really infer all prop values (in particular for binarySupports):\n`--create-api-tests tests.sh --api-test-host http://localhost:10240`. The test\nscripts also contains tests that are expected to FAIL in order to test the test\nharness. These tests are clearly identified in the result file (`test.result`).\n\nThe test script doesn't take any argumuent:\n```\n$ bash tests.sh\n```\n\nAnd the `test.result` looks like:\n\n```\nmipsel D gdcmipsel1220 ASM-------------- [OK]\nmipsel D gdcmipsel1220 ASM+BINARY------- [OK]\nmipsel FORTRAN fmipselg1220 ASM--------- [OK]\nmipsel FORTRAN fmipselg1220 ASM+BINARY-- [SKIPPED (not supported)]\nmipsel CXX mipselg1220 ASM-------------- [OK]\nmipsel CXX mipselg1220 ASM+BINARY------- [OK]\nmipsel GO gccgomipsel1220 ASM----------- [OK]\nmipsel GO gccgomipsel1220 ASM+BINARY---- [SKIPPED (not supported)]\nmipsel C cmipselg1220 ASM--------------- [OK]\nmipsel C cmipselg1220 ASM+BINARY-------- [OK]\n\n\n#### Fake tests, they should FAIL or be SKIPPED, but never PASS\n\nmipsel ADA gdcmipsel1220 ASM------------ [FAIL]\nmipsel ADA gdcmipsel1220 ASM+BINARY----- [FAIL]\n#### End of fake tests\n\nmips64el FORTRAN fmips64elg1220 ASM----- [OK]\nmips64el FORTRAN fmips64elg1220 ASM+BINARY [SKIPPED (not supported)]\nmips64el CXX mips64elg1220 ASM---------- [OK]\nmips64el CXX mips64elg1220 ASM+BINARY--- [OK]\nmips64el GO gccgomips64el1220 ASM------- [OK]\n```\n\nWhen you need to update several targets at once, you can use the following\nsample command. You currently need to clear some output files as they are\nappended by the several invocations.\n\n```\nrm -f test.result tests.sh summary.txt test.result fixups.txt;\\\n  for i in arm arm64 avr mips mips64 msp430 powerpc powerpc64 powerpc64le s390x riscv32 riscv64 mipsel mips64el;\n    do\n      ./check_and_update_conf.py -a $i --version 12.2.0 --guess-previous \\\n         --config-dir ~/git/compiler-explorer/compiler-explorer/etc/config/\\\n         --inplace  --config-todo fixups.txt --summary summary.txt --create-api-tests tests.sh\n    done\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompiler-explorer%2Fgcc-cross-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcompiler-explorer%2Fgcc-cross-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompiler-explorer%2Fgcc-cross-builder/lists"}