{"id":13580255,"url":"https://github.com/franzflasch/gcc-build-tools","last_synced_at":"2026-01-22T20:03:17.325Z","repository":{"id":73659129,"uuid":"363936523","full_name":"franzflasch/gcc-build-tools","owner":"franzflasch","description":"Scripts to ease building gcc (cross) toolchains.","archived":false,"fork":false,"pushed_at":"2025-01-26T10:51:24.000Z","size":399,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-26T11:26:50.672Z","etag":null,"topics":["cross-compiler","crosstool-ng","gcc","gcc-arm-toolchain","gcc-complier","gcc-cross-compiler","linux","riscv-toolchain","toolchain"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/franzflasch.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":"2021-05-03T13:20:32.000Z","updated_at":"2025-01-26T10:51:27.000Z","dependencies_parsed_at":"2024-02-21T09:44:46.042Z","dependency_job_id":"22663f4c-daac-44d5-bbae-14c9a269f96d","html_url":"https://github.com/franzflasch/gcc-build-tools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franzflasch%2Fgcc-build-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franzflasch%2Fgcc-build-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franzflasch%2Fgcc-build-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franzflasch%2Fgcc-build-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/franzflasch","download_url":"https://codeload.github.com/franzflasch/gcc-build-tools/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247425894,"owners_count":20937034,"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":["cross-compiler","crosstool-ng","gcc","gcc-arm-toolchain","gcc-complier","gcc-cross-compiler","linux","riscv-toolchain","toolchain"],"created_at":"2024-08-01T15:01:49.166Z","updated_at":"2026-01-22T20:03:17.316Z","avatar_url":"https://github.com/franzflasch.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# GCC crosstoolchain build script\n\nThis is a simple script to build gcc based (cross) toolchains for various platforms. It is much like crosstool-ng, just simpler.  \n\nThe buildscript is able to build toolchains and cross-toolchains for Linux hosts and targets Linux, Windows (mingw) as well as baremetal targets.\n\nSpecifically these target architectures are currently supported:\n\n    - arm \n    - arm64 \n    - avr8\n    - cortex-m0 \n    - cortex-m3 \n    - cortex-m4 \n    - riscv32 \n    - riscv32-baremetal \n    - riscv64 \n    - riscv64-baremetal\n    - riscv64-uclibc \n    - x86 \n    - x86_64 \n    - x86_64_mingw \n    - x86_mingw \n\nSupported GCC versions:\n- GCC-latest\n- GCC-14\n- GCC-13\n- GCC-12\n- GCC-11\n\nPlease be aware that some target/version combinations might not work.\n\n## Prebuilt toolchains can be downloaded here (note: links are only valid 90 days after the last successful github ci runner)\n\nhttps://nightly.link/franzflasch/gcc-build-tools/workflows/arm/main/toolchain_built_from_tar  \nhttps://nightly.link/franzflasch/gcc-build-tools/workflows/arm64/main/toolchain_built_from_tar  \nhttps://nightly.link/franzflasch/gcc-build-tools/workflows/avr8/main/toolchain_built_from_tar  \nhttps://nightly.link/franzflasch/gcc-build-tools/workflows/cortex-m0/main/toolchain_built_from_tar  \nhttps://nightly.link/franzflasch/gcc-build-tools/workflows/cortex-m3/main/toolchain_built_from_tar  \nhttps://nightly.link/franzflasch/gcc-build-tools/workflows/cortex-m4/main/toolchain_built_from_tar  \nhttps://nightly.link/franzflasch/gcc-build-tools/workflows/riscv32/main/toolchain_built_from_tar  \nhttps://nightly.link/franzflasch/gcc-build-tools/workflows/riscv32-baremetal/main/toolchain_built_from_tar  \nhttps://nightly.link/franzflasch/gcc-build-tools/workflows/riscv64/main/toolchain_built_from_tar  \nhttps://nightly.link/franzflasch/gcc-build-tools/workflows/riscv64-baremetal/main/toolchain_built_from_tar  \nhttps://nightly.link/franzflasch/gcc-build-tools/workflows/riscv64-uclibc/main/toolchain_built_from_tar  \nhttps://nightly.link/franzflasch/gcc-build-tools/workflows/x86/main/toolchain_built_from_tar  \nhttps://nightly.link/franzflasch/gcc-build-tools/workflows/x86_64/main/toolchain_built_from_tar  \nhttps://nightly.link/franzflasch/gcc-build-tools/workflows/x86_64_mingw/main/toolchain_built_from_tar  \nhttps://nightly.link/franzflasch/gcc-build-tools/workflows/x86_mingw/main/toolchain_built_from_tar  \n\n\u003e **_NOTE:_** Make sure to extract the prebuilt toolchains to ```/opt/local/``` otherwise there might be issues for certain builds.\n\n## Prerequisites\n\nTo build a toolchain, you need to do the following:\n\nA Linux distribution (the script has been tested on Ubuntu 22.04)  \nCore developer packages\n+ For Ubuntu 22.04:  \n```bash\nsudo apt install -y wget build-essential make gawk git subversion texinfo autoconf autopoint pkg-config gettext txt2man liblzma-dev libssl-dev libz-dev flex bison libexpat1-dev rsync file\n```\n\nIn case you want to build a baremetal target you also need to install:\n+ For picolibc:\n```bash\nsudo apt install -y python3-pip\nsudo pip3 install meson ninja\n```\n\n### Install directory\n\n\u003e **_IMPORTANT:_**  Create the folder ```/opt/local/``` and ensure that you have write permissions otherwise the script wont work!!\n\n## Using the script\n\nOnce you have set up your environment, you can use the script like this:\n\n1. Clone the repository\n```bash\ngit clone https://github.com/franzflasch/gcc-build-tools\n```\n\n2. Add the script to your path\n```bash\ncd gcc-build-tools\nexport PATH=$PWD:$PATH\n```\n\n3. Create a work directory for your build\n```bash\nmkdir ~/gcc-builds\ncd ~/gcc-builds\n```\n\n4. Use it!\n```bash\nbuild-gcc -h\n```\n\nThe printout will show you how to run the script.\n\nExample commands:\n\n```bash\n# build a riscv64-uclibc toolchain, stripping binaries, verbose mode\nbuild-gcc -a riscv64-uclibc -v 14 -s -V\n\n# Build a toolchain for x86_64\n./build-gcc -a x86_64 -v 14\n\n# Build a toolchain for arm64\n./build-gcc -a arm64 -v 14\n\n# Build a toolchain for arm\n./build-gcc -a arm -v 14\n\n# Build a toolchain for riscv linux\n./build-gcc -a riscv64 -v 14\n\n# Build a toolchain for avr microcontrollers\n./build-gcc -a avr8 -v 14 -t\n\n# Build a toolchain for arm cortex m3/m4 microcontrollers\n./build-gcc -a cortex-m3 -v 14 -t\n\n# Build a toolchain for riscv baremetal (sifive hifive1)\n./build-gcc -a riscv32-baremetal -v 14\n```\n\n### After compilation\n\nThe end result will be placed into ```/opt/local/``` e.g. ```/opt/local/cross-tool-riscv64-uclibc-gcc14/```.  \n\nTo use the toolchain just add ```/opt/local/cross-tool-riscv64-uclibc-gcc14/bin``` to your $PATH and thats it.\n\n\n## Notes on using the toolchain\n\nBuilding a fully static linked executable:\n```bash\n\u003ctarget-triple\u003e-gcc -o hello -static hello.c\n```\n\nWith OpenMP:\n```bash\n\u003ctarget-triple\u003e-gcc -o omp_helloc -static -fopenmp omp_hello.c\n```\n\nFor shared libraries ensure that you are building using the internal toolchain libs instead of ones already installed on the host linux - here for x86_64 openmp example:\n```bash\nx86_64-linux-gnu-gcc -o omp_helloc -Wl,--rpath=toolchain/lib64 -Wl,--rpath=toolchain/x86_64-linux-gnu/lib/ -Wl,--dynamic-linker=toolchain/x86_64-linux-gnu/lib/ld-linux-x86-64.so.2 -fopenmp omp_hello.c\n```\nFor crosscompile targets it is probably necessary to install those libs into the target rootfs.\n\n# For developers\n\nAdding a new target should be rather easy:\n- Add a new target file in ```configs/targets```. Look at the existing targets to get an idea how to add your own.\n- There are default configs defined in ```configs/targets_config.sh``` that should be used as a base if possible.\n- SRC URLs for the various open source packages (gcc, binutils etc.) are handled in ```configs/common.sh```.\n- SRC VERSIONs are handled either in ```configs/git_source_config.sh``` and ```configs/tar_source_config.sh```. \n    - ```git_source_config.sh``` defines SRC URLs for git repositories.\n    - ```tar_source_config.sh``` defines SRC URLs for tarballs.\n\n## Pull requests/issues\n\nFeel free to open an issue!\n\nPull requests are more than welcome as well!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranzflasch%2Fgcc-build-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffranzflasch%2Fgcc-build-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranzflasch%2Fgcc-build-tools/lists"}