All Projects → jwt27 → build-gcc

jwt27 / build-gcc

Licence: GPL-3.0 license
Shell scripts to build various gcc cross-compilers (primarily djgpp)

Projects that are alternatives of or similar to build-gcc

bleeding-edge-toolchain
All-in-one script to build bleeding-edge-toolchain for ARM microcontrollers
Stars: ✭ 60 (+76.47%)
Mutual labels:  gcc, newlib
xcross
"Zero Setup" cross-compilation for C/C++. Supports numerous architectures, build systems, C standard libraries, vcpkg, and Conan.
Stars: ✭ 29 (-14.71%)
Mutual labels:  gcc, cross-compiler
ewxb-gcc-cross-compiler-builder
A script for building a full GCC + glibc toolchain from scratch (with Go support via gccgo) in multiple stages.
Stars: ✭ 18 (-47.06%)
Mutual labels:  gcc, cross-compiler
Nos
RTOS for microcontrollers
Stars: ✭ 160 (+370.59%)
Mutual labels:  avr, gcc
Beelzebub
The Lord of Flies - A hobby operating system
Stars: ✭ 24 (-29.41%)
Mutual labels:  gcc, cross-compiler
Raspberry Pi Cross Compilers
Latest GCC Cross Compiler & Native (ARM & ARM64) CI generated precompiled standalone toolchains for all Raspberry Pis. 🍇
Stars: ✭ 261 (+667.65%)
Mutual labels:  gcc, cross-compiler
homebrew-i386-elf-toolchain
Homebrew formulas for buildling a valid GCC toolchain for the i386-elf target.
Stars: ✭ 62 (+82.35%)
Mutual labels:  gcc, cross-compiler
Musl Cross Make
Simple makefile-based build for musl cross compiler
Stars: ✭ 646 (+1800%)
Mutual labels:  gcc, cross-compiler
xForth
Experimental Forth cross compiler for tiny devices
Stars: ✭ 53 (+55.88%)
Mutual labels:  avr, cross-compiler
Xpcc
DEPRECATED, use our successor library https://modm.io instead
Stars: ✭ 177 (+420.59%)
Mutual labels:  avr, gcc
Helios
The free embedded operating system.
Stars: ✭ 223 (+555.88%)
Mutual labels:  avr
Piconomix Fwlib
open source bare-metal C firmware and documentation for microcontrollers
Stars: ✭ 226 (+564.71%)
Mutual labels:  avr
docker-darling
Experimental docker container with Darling for macOS runtime
Stars: ✭ 38 (+11.76%)
Mutual labels:  cross-compiler
3d printed keyboard
A fully 3D printed computer keyboard
Stars: ✭ 31 (-8.82%)
Mutual labels:  avr
Llvm
[MERGED UPSTREAM] AVR backend for the LLVM compiler library
Stars: ✭ 222 (+552.94%)
Mutual labels:  avr
CorePartition
Universal Cooperative Multithread Lib with real time Scheduler that was designed to work, virtually, into any modern micro controller or Microchip and, also, for user space applications for modern OS (Mac, Linux, Windows) or on FreeRTOS as well. Supports C and C++
Stars: ✭ 18 (-47.06%)
Mutual labels:  avr
Avr Hal
embedded-hal abstractions for AVR microcontrollers
Stars: ✭ 217 (+538.24%)
Mutual labels:  avr
Megacore
Arduino hardware package for ATmega64, ATmega128, ATmega640, ATmega1280, ATmega1281, ATmega2560, ATmega2561, AT90CAN32, AT90CAN64 and AT90CAN128
Stars: ✭ 206 (+505.88%)
Mutual labels:  avr
perses
Language-agnostic program reducer.
Stars: ✭ 57 (+67.65%)
Mutual labels:  gcc
FrameOfReference
C++ library to pack and unpack vectors of integers having a small range of values using a technique called Frame of Reference
Stars: ✭ 36 (+5.88%)
Mutual labels:  gcc

Build gcc cross compiler on Windows, Mac OSX, Linux and FreeBSD.

Upgrade notes:

  • 2020-02-13: default target for djgpp has changed to i386-pc-msdosdjgpp.
    If you require compatibility with distributions that use i586, you can either:
    • run sudo i386-pc-msdosdjgpp-link-i586 after installing, or
    • build with ./build-djgpp.sh --target=i586-pc-msdosdjgpp.
  • 2020-02-07: setenv script is now installed to $PREFIX/bin/$TARGET-setenv.
  • 2019-06-06: master is now the default branch again.

Current package versions, as of 2022-08-23:

  • gcc 12.2.0
  • binutils 2.39
  • gdb 12.1
  • djgpp 2.05 / cvs
  • watt-32 git
  • newlib 4.1.0
  • avr-libc 2.1.0
  • avrdude 6.4
  • avarice 2.14
  • simulavr git

Tested targets:

  • i386-pc-msdosdjgpp
  • ia16
  • arm-eabi
  • avr

See the Actions tab on Github for a detailed status of individual targets.

Requirements

Before running this script, you need to install these programs first:

  • g++
  • gcc
  • unzip
  • tar
  • bzip2
  • gzip
  • xz
  • bison
  • flex
  • make (or gmake for FreeBSD)
  • makeinfo
  • patch
  • zlib header/library
  • curl or wget
  • bash (for FreeBSD)
  • python2 headers (for gdb)
  • python3 headers (for gdb >= 9.0)
  • m4
  • dos2unix

Depending on your system, installation procedure maybe different.

On Debian/Ubuntu, you can install these programs by :

$ sudo apt-get update
$ sudo apt-get install bison flex curl gcc g++ make texinfo zlib1g-dev tar bzip2 gzip xz-utils unzip python{2,3}-dev m4 dos2unix

Fedora :

$ sudo yum install gcc-c++ bison flex texinfo patch zlib-devel tar bzip2 gzip xz unzip python-devel m4 dos2unix

mingw-w64 (msys2) :

$ pacman -Syuu base-devel mingw-w64-x86_64-{toolchain,curl,zlib,python{2,3}} compression m4 dos2unix

Configuration

The following command line options are recognized:

  --prefix=...              # Install location (default: /usr/local/cross)
  --target=...              # Target name
  --enable-languages=...    # Comma-separated list of languages to build compilers for (default: c,c++)
  --no-download             # Do not download any files
  --only-download           # Download source files, then exit
  --ignore-dependencies     # Do not check package dependencies
  --batch                   # Run in batch mode (will not prompt or delay to confirm settings)

Several environment variables also control the build process:

GCC_CONFIGURE_OPTIONS=      # Extra options to pass to gcc's ./configure
BINUTILS_CONFIGURE_OPTIONS= # Same, for binutils
GDB_CONFIGURE_OPTIONS=      # Same, for gdb
NEWLIB_CONFIGURE_OPTIONS=   # Same, for newlib
AVRLIBC_CONFIGURE_OPTIONS=  # Same, for avr-libc
GLOBAL_CONFIGURE_OPTIONS=   # Extra options added to all variables listed above
MAKE_JOBS=                  # Number of parallel build threads (auto-detected)
CFLAGS_FOR_TARGET=          # CFLAGS used to build target libraries
HOST=                       # The platform you are building for, when building a cross-cross compiler
BUILD=                      # The platform you are building on (auto-detected)
MAKE_CHECK=                 # Run test suites on built programs.
MAKE_CHECK_GCC=             # Run gcc test suites.

Building

Pick the script you want to use:

build-djgpp.sh      # builds a toolchain targeting djgpp (default TARGET: i386-pc-msdosdjgpp)
build-newlib.sh     # builds a toolchain with the newlib C library
build-ia16.sh       # builds a toolchain targeting 8086 processors, with the newlib C library (fixed TARGET: ia16-elf)
build-avr.sh        # builds a toolchain targeting AVR microcontrollers (fixed TARGET: avr)

To build DJGPP, just run:

$ ./build-djgpp.sh [options...] [packages...]

Run with no arguments to see a list of supported packages and versions.

For example, to build gcc 9.2.0 with the latest djgpp C library from CVS and latest binutils:

$ ./build-djgpp.sh --prefix=/usr/local djgpp-cvs binutils gcc-9.2.0

To install or upgrade all packages:

$ ./build-djgpp.sh --prefix=/usr/local all

It will download all necessary files, build DJGPP compiler, binutils, and gdb, and install it.

Using

(In the following examples, it is assumed that you built the toolchain with options --prefix=/home/me/.local and --target=i386-pc-msdosdjgpp. Substitute as necessary for your configuration.)

To use your new compiler, you must add its bin directory to your PATH. You can then access the toolchain through its target-prefixed name:

$ PATH="/home/me/.local/bin:$PATH"
$ i386-pc-msdosdjgpp-g++ hello.cpp

A setenv script will also be installed. This sets up environment variables so that you can use the toolchain as if you were working on the target machine. The toolchain utilities are then accessible through their short names (gcc, ld, etc), and you can access target-specific documentation and locate target libraries (via man/info and pkg-config, respectively).

This script can be used either with no arguments, to start a new shell:

$ i386-pc-msdosdjgpp-setenv
Entering new shell for target environment: i386-pc-msdosdjgpp
$ which gcc
/home/me/.local/i386-pc-msdosdjgpp/bin//gcc
$ gcc -v 2>&1 | grep 'Target'
Target: i386-pc-msdosdjgpp

With a single command:

$ i386-pc-msdosdjgpp-setenv info libc
  # (shows documentation for djgpp's C library)

Or sourced into the current shell: (Bash only)

$ which gcc
/usr/bin/gcc
$ source i386-pc-msdosdjgpp-setenv
Environment variables set up for target: i386-pc-msdosdjgpp
$ which gcc
/home/me/.local/i386-pc-msdosdjgpp/bin/gcc

Supported DJGPP utilities

  • dxe3gen
  • dxe3res
  • dxegen
  • exe2coff
  • stubedit
  • stubify
  • djasm

Supported AVR utilities

  • avrdude
  • avarice
  • simulavr

Thanks

These scripts are based on Andrew Wu's build-djgpp script:
https://github.com/andrewwutw/build-djgpp
Which in turn is based on spec file from DJGPP source rpm files by Andris Pavenis:
http://ap1.pp.fi/djgpp/index.html

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].