Created
February 8, 2021 21:19
-
-
Save ricardocosme/5ec8ad05b5f4adb66464a146dcc41545 to your computer and use it in GitHub Desktop.
avr-gcc 10.2 with libstdc++ using the freestanding implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This is a step-by-step guide to build the avr-gcc 10.2 with the | |
#libstdc++ using the freestanding implementation[1]. | |
# | |
#Don't expect a robust script without boilerplates or something coded | |
#to be resilient. This is only a short register of what I need to | |
#obtain the compiler in this mode. | |
# | |
#[1] https://timsong-cpp.github.io/cppwp/n4861/compliance | |
wget https://ftp.gnu.org/gnu/binutils/binutils-2.36.tar.gz | |
tar zxf binutils-2.36.tar.gz | |
cd binutils-2.36 | |
mkdir obj | |
cd obj | |
../configure --prefix=$PREFIX --target=avr --disable-nls | |
make -j16 | |
make install | |
cd ../../ | |
export PATH=$PREFIX/bin:$PATH | |
wget https://bigsearcher.com/mirrors/gcc/releases/gcc-10.2.0/gcc-10.2.0.tar.gz | |
tar zxf gcc-10.2.0.tar.gz | |
cd gcc-10.2.0 | |
mkdir obj | |
cd obj | |
../configure --prefix=$PREFIX --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2 | |
make -j16 | |
make installl | |
cd ../../ | |
wget http://download.savannah.gnu.org/releases/avr-libc/avr-libc-2.0.0.tar.bz2 | |
tar jxf avr-libc-2.0.0.tar.bz2 | |
cd avr-libc-2.0.0 | |
mkdir obj | |
cd obj | |
../configure --prefix=$PREFIX --build=`../config.guess` --host=avr | |
make -j16 | |
make install | |
cd ../../ | |
cd gcc-10.2.0 | |
cd obj | |
../configure --prefix=$PREFIX --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2 --with-newlib --disable-__cxa_atexit --disable-threads --disable-shared --disable-sjlj-exceptions --enable-libstdcxx --disable-hosted-libstdcxx --disable-bootstrap | |
make -j16 | |
make install |
Just two hints for people that in general compile gcc for the first time (like me).
You should define a $PREFIX that you have write access on for the installations to work like:
PREFIX=$HOME/local/avr
export PREFIX
PATH=$PATH:$PREFIX/bin
And you should install on your shared libs GMP,MPFR and MPC , this can be easily done after line 24(so in gcc's folder) by running the
script
./contrib/download_prerequisites
Also a question @ricarocosme ,what if we want all the headers of the stl like variant and such , would it work to just remove some of your -disable
flags?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, I know, it's confusing. It's something far from ideal.
Right. Here, I use the version of
avr-gcc
withlibstdc++
using freestanding as my main toolchain and theavr-gcc
withoutlibstdc++
only to test the support that my libraries offer when the programmer doesn't havelibstdc++
.