From the appropriate bug report:

Jakub Jelinek 2017-05-13 06:52:08 UTC

The bug is on the GCC 4.8 side, so either you need to patch it, or build with -std=gnu++98 - then __GNUC_STDC_INLINE__ will not be defined and it ought to compile fine.

Please check this answer as well: https://unix.stackexchange.com/a/472713/260833

Answer from Artem S. Tashkinov on Stack Exchange
🌐
GNU
gcc.gnu.org › releases.html
GCC Releases - GNU Project
April 30, 2026 - GCC releases may be downloaded from our mirror sites.
🌐
GitHub
github.com › oddconcepts › gcc-4.8.5
GitHub - oddconcepts/gcc-4.8.5: GCC 4.8.5, with patches for newer GCC/glibc versions · GitHub
GCC 4.8.5, with patches for newer GCC/glibc versions - oddconcepts/gcc-4.8.5
Author   oddconcepts
🌐
GNU
ftp.gnu.org › gnu › gcc › gcc-4.8.5
Index of /gnu/gcc/gcc-4.8.5
Index of /gnu/gcc/gcc-4.8.5 · Apache/2.4.52 (Trisquel_GNU/Linux) Server at ftp.gnu.org Port 443
🌐
GNU
gcc.gnu.org › gcc-4.8
GCC 4.8 Release Series - GNU Project
To obtain GCC please use our mirror sites or our version control system.
🌐
Anaconda.org
anaconda.org › conda-forge › gcc › files
gcc - conda-forge | Anaconda.org
GNU C native compiler (symlinks) copied from cf-post-staging / gcc · Conda · Files · Labels · Badges · No files were selected × · Filters · Type: All · All · conda · Version: 4.8.5 · All · 15.2.0 · 15.1.0 · 14.3.0 · 14.2.0 · 14.1.0 · 13.4.0 · 13.3.0 ·
🌐
CentOS Repositories
centos.pkgs.org › 7 › centos-x86_64 › gcc-4.8.5-44.el7.x86_64.rpm.html
gcc-4.8.5-44.el7.x86_64.rpm CentOS 7 Download
April 21, 2022 - The gcc package contains the GNU Compiler Collection version 4.8. You'll need this package in order to compile C code. ... 2020-03-24 - Marek Polacek <polacek@redhat.com> 4.8.5-43 - fix wrong code emitted for movv1qi on s390x (#1784759) - fix wrong code with EH due to a bug in LRA (#1800526)
Top answer
1 of 2
1

it worked with the following:

../gcc-4.8.5/configure CC="/opt/gcc4.5/bin/gcc" --prefix=/opt/gcc4.8.5 --enable-languages=c,c++,fortran --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object

The interesting part is CC=...

The installed gcc-version is 4.4. With this version, the compiling fails.

kind regards

2 of 2
1

GCC is documented to need to be built outside of its source tree; see the configuring chapter of its installation documentation:

First, we highly recommend that GCC be built into a separate directory from the sources which does not reside within the source tree. This is how we generally build GCC; building where srcdir == objdir should still work, but doesn’t get extensive testing; building where objdir is a subdirectory of srcdir is unsupported.

So you need to build it according to that rule. Hence your GCC build:

cd gcc-4.8.5
#wrong code from the original question! Don't use that
./configure --enable-bootstrap --enable-shared \
      --enable-threads=posix --enable-checking=release \
      --with-system-zlib --enable-__cxa_atexit \
      --disable-libunwind-exceptions --enable-gnu-unique-object \
      --enable-languages=fortran,c --prefix=/opt/gcc4.8.5

is wrong; I would recommend at least:

  cd gcc-4.8.5
  mkdir ../_BuildGCC
  cd ../_BuildGCC
  ../gcc-4.8.5/configure --enable-bootstrap --enable-shared \
      --enable-threads=posix --enable-checking=release \
      --with-system-zlib --enable-__cxa_atexit \
      --disable-libunwind-exceptions --enable-gnu-unique-object \
      --enable-languages=fortran,c --prefix=/opt/gnu \
      --program-suffix=-mine

then, after the entire build, probably with

 make -j4

followed by some mkdir /opt/gnu with appropriate user and permission, then (in the same _BuildGCC)

make install DESTDIR=/tmp/gccinst

and finally cp -vr /tmp/gccinst/opt/gnu /opt/gnu to be run appropriately (perhaps as root...., and perhaps cp -va)

Then you would add /opt/gnu/bin/ to your PATH variable, and you would use gcc-mine to compile your code.

BTW, GCC is compatible for C programs since the ABI don't change. And GCC 4.8 is obsolete and unsupported. You'll better compile from source the supported versions (listed on gcc.gnu.org; in January 2018, GCC 7.2 & GCC 6.4)

Perhaps your particular Redhat system requires additional/specific CFLAGS to be appended into your configure command. You could ask your Redhat support, or try to append CFLAGS=-fPIE or CFLAGS=-fPIC at the end of your ../gcc-4.8.5/configure command.

At last, you might perhaps get such help on [email protected], but you'll better try with a recent GCC. Few GCC folks remember 4.8 ....

If you really need precisely GCC 4.8 (but I doubt that), you could buy costly support (e.g. from RedHat or AdaCore folks) if needed.

With Google I found Installing gcc 4.8 and Linuxbrew on CentOS 6

Find elsewhere
🌐
SourceForge
sourceforge.net › home › open source software › software development › build tools › mingw - minimalist gnu for windows › files
MinGW - Minimalist GNU for Windows - Browse /MinGW/Base/gcc/Version4/experimental/gcc-4.8.5-preview at SourceForge.net
Download Latest Version Other-README (646 Bytes) Home / MinGW / Base / gcc / Version4 / experimental / gcc-4.8.5-preview · Experimental builds trying to solve bug #2108: https://sourceforge.net/p/mingw/bugs/2108 Cesar Source: readme_experimental.txt, updated 2013-12-21 ·
🌐
GNU
gcc.gnu.org › onlinedocs › gcc-4.8.5 › gcc.pdf pdf
Using the GNU Compiler Collection For gcc version 4.8.5 (GCC)
See Section 3.4 [Options Controlling C Dialect], page 30. GCC does not provide the library facilities required only of hosted implementations, nor · yet all the facilities required by C99 of freestanding implementations; to use the facilities · of a hosted environment, you will need to find them elsewhere (for example, in the GNU C · library). See Section 11.5 ...
Top answer
1 of 2
121

Is GCC-4.8 available for 12.04 Precise now?

Update: As of 6/05/2013, there is currently a release of gcc 4.8.1 for 12.04(precise) available at https://launchpad.net/~ubuntu-toolchain-r/+archive/test.

The short answer is: gcc-4.8 is currently available for 12.04(Precise) via the toolchain PPA or by compiling the source(see below for details).

Release Announcement

The announcement for the release of gcc-4.8 was made on March 22nd, so you probably won't be seeing this in an official repository just yet.

However, it appears that Launchpad does have a PPA available for the toolchain test builds that does include gcc-4.8, here: https://launchpad.net/~ubuntu-toolchain-r/+archive/test

According to the changelog and package list, there are debs for i386, amd64, arm, and powerpc and were built against raring 13.04.

The latest available version of gcc, for 12.04, is 4.8.1 and is available in the toolchain PPA.

Adding the toolchain/test PPA:

To add the PPA to your system, open a terminal(Ctrl+Alt+t) and run the following commands:

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50

You will also be prompted to install a number of suggested packages. These packages are recommended, but optional, for the installation of gcc-4.8.

  • What are PPAs and how do I use them?
  • Are PPA's safe to add to my system and what are some "red flags" to watch out for?

What C++ features are available in gcc-4.8 that are not available in gcc-4.7.2?

  • According to GNU.ORG, gcc-4.7, supports a number of C++11 features.
  • As of the gcc-4.8 release, gcc-4.7 does not support 8 out of 64 features (See C++0x/C++11 Support in GCC)

  • These features are:

    Language Features
    - Rvalue references for *this
    - Generalized attributes
    - Alignment support
    - Inheriting constructors
    Concurreny
    - Bidirectional Fences
    - Memory model
    - Abandoning a process and at_quick_exit
    - Thread-local storage 
    
  • For a full list of changes in gcc-4.8, see the Changelist

I need these gcc features on 12.04 Precise, now. How can I get them?

Building GCC-4.8 from source:

If you need gcc-4.8 on 12.04 now, your only option is to build it from source.

Please read the GCC installation FAQ prior to installation.

You can download gcc-4.8 from one of gnu.org's mirror sites or directly from their SVN server.

Here is an example of steps to compile from source (see here for additional details.) Note that these may vary depending on your system and preferences.

  1. Download the source code

    • Make a build directory ( mkdir gcc-build && cd gcc-build)
    • Download the source file: wget http://www.netgull.com/gcc/releases/gcc-4.8.0/gcc-4.8.0.tar.bz2 (adjust this command to use an appropriate mirror site.
    • Unzip the file (tar -xvjf <file name>)
  2. Install some additional libraries (sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev libc6-dev)

  3. Compile the source: ./gcc-4.8.0/configure --prefix=/app/gcc/4.8.0
  4. Run make (This will take some time to complete. Go make some coffee, or bake some cookies. ;-))
  5. Install the code: sudo make install

Once this process has completed, run the command gcc --version to verify that the installation has completed successfully. You should see something similar to the following output:

maggotbrain@foucault:~$ gcc --version
gcc (Linaro 4.8.0) 4.8.0
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The bottom line: Thank all those folks who provide easy to install Ubuntu backports for you. Give them some of the cookies that you baked while running make. ;-)

2 of 2
1

So answer above works, at least for manual install. Though even after sudo make install, running gcc still just runs the stock version 4.6.3. Even trying gcc-4.8 or gcc-4.8.0 doesn't work. Running /app/gcc/4.8.0/bin/gcc appears to be the only thing that works for me. I mean it is kind of lame but at least it works.

🌐
CentOS Repositories
centos.pkgs.org › 7 › centos-x86_64 › gcc-4.8.5-39.el7.x86_64.rpm.html
gcc-4.8.5-39.el7.x86_64.rpm CentOS 7 Download
The gcc package contains the GNU Compiler Collection version 4.8. You'll need this package in order to compile C code. ... 2019-02-25 - Marek Polacek <polacek@redhat.com> 4.8.5-38 - fix mode mismatch in prepare_cmp_insn (#1641329, PR target/63442) - allow libitm to use HTM (#1659698) - fix up memset handling in DSE (#1640805, PR rtl-optimization/69891) - fix bits/bytes confusion in set_noop_p (#1594975, PR rtl-optimization/68814) - enable initializing statics with COMPOUND_LITERAL_EXPR in C99 (#1672652, PR c/63567) - fix PIC_OFFSET_TABLE_REGNUM (#1614326) - quash spurious -Wmissing-field-initializers warnings (#1633716, PR c/60784) - fix ICE with alias template (#1648161, PR c++/53658)
🌐
Red Hat
access.redhat.com › discussions › 6100931
Using GCC-4.8.5
June 6, 2021 - Hi All, I am running RHEL8.1 and see it only has GCC8+ available in the repos. Is there a way to get gcc-4.8.5 installed on the system to be used optionally to GCC8? I have some applications that need testing with GCC4.
🌐
Miraclelinux
tsn.miraclelinux.com › en › node › 10696
gcc-4.8.5-39.el7 | MIRACLE LINUX
gcc-4.8.5-39.el7 · Affected Channels: Asianux Server 7 for x86_64 · Severity: N/A · Solution: Update packages. Additional Info: N/A · Download: SRPMS · gcc-4.8.5-39.el7.src.rpm MD5: 234a50fa6424c9db75ae27feaa9935e1 SHA-256: 06e20ada35160ba65e6e8c4de8f3161823319f50a9615e1ac49cb24f3f24943c Size: 75.63 MB ·
🌐
Ubuntu
launchpad.net › ubuntu › +source › gcc-4.8
gcc-4.8 package : Ubuntu
The following unsupported and untrusted Personal Archives (PPAs) provide packages of 'gcc-4.8': Toolchain builds owned by PPA for Ubuntu Toolchain Uploads (restricted) ... Versions: Lucid (4.8.1-2ubuntu1~10.04.1), Raring (4.8.1-2ubuntu1~13.04), Quantal (4.8.1-2ubuntu1~12.10.3), Saucy (4.8.2-1ubuntu1), Xenial (4.8.5-4ubuntu8~16.04.1), Trusty (4.8.5-4ubuntu8~14.04.2), Precise (4.8.4-1ubuntu15~12.04.1)
🌐
GNU
ftp.gnu.org › gnu › gcc › gcc-4.8.1
Index of /gnu/gcc/gcc-4.8.1
Index of /gnu/gcc/gcc-4.8.1 · Apache/2.4.52 (Trisquel_GNU/Linux) Server at ftp.gnu.org Port 443
🌐
GNU
gcc.gnu.org › onlinedocs › gcc-4.8.5 › gcc › index.html
Using the GNU Compiler Collection (GCC)
This manual documents how to use the GNU compilers, as well as their features and incompatibilities, and how to report bugs. It corresponds to the compilers (GCC) version 4.8.5. The internals of the GNU compilers, including how to port them to new targets and some information about how to write ...