Install older version of gcc for Fedora? - gcc

What is the difficulty in providing an easy way to downgrade gcc 6 to version 4?
I have a project that seems not forward-compatible with gcc. Therefore I'm trying to downgrade gcc to v4 but it is impossible.

The maintenance of each piece of software in the distribution takes some efforts. Especially in cases, when there is some security vulnerability that needs to be fixed and you have many parallel versions. There is no reason to keep old versions, if there is nobody using inside of the distribution.
Currently there is GCC 7 in Fedora 26, so GCC 4 is three major versions behind. If your application does not attempt to keep up with the GCC, Fedora is not an OS for you, because it moves forward. If you strive for backward compatibility, you should consider using RHEL/CentOS 7, where is still GCC 4 and it will be supported for years.

Related

GCC toolchain for 68HC12/68HC12X

I wonder if anyone is using GCC as production stable toolchain for Freescale's 68HC12 microcontroller family. It seems to me that there aren't up-to-date toolchains other than that from Freescale itself and those from Cosmic Software (http://www.cosmic-software.com/) and IAR (http://www.iar.com/), of course.
GNU 68HC11/12 (http://savannah.gnu.org/projects/m68hc11) is based on GCC 3.1 and its latest news is 4-year old
GCC-4.6 declared (http://gcc.gnu.org/gcc-4.6/changes.html) that Motorola 68HC11 and 68HC12 architectures are obsolete
GCC-HCS12 (http://gcc-hcs12.com/) sounds promising for what I'm looking for, yet it seems unmaintained. There exists a dozing Google Group gcc-hcs12 (http://groups.google.com/group/gcc-hcs12/), though. Plus, the available zip download contains a file called gnu-68hc1x-3.1.exe dated 2007.
MegaSquirt (http://www.msextra.com/tools/) seems to offer the most maintained toolchain, packaged on 29 Oct 2010. It is built on extended versions of the SCz tools (which I don't know what it means):
binutils-2.18 with S12X and XGATE enhancements
gcc-3.3.6 with S12/S12X ldivmod and larith enhancements
newlib with 9s12x target
GNU 68HC11/12 is based on GCC 3.3.6. The GNU 68HC11/12 release 3.1 is a bundle package which contains the complete tool chain based on Gcc 3.3.6, Gdb 6.4, Binutils 2.15 and Newlib 1.12.0.
Several projects have used it as a basis for their own needs. GCC-HCS12 and MegaSquirt are examples of such projects.
Some board vendors have also shipped the GNU 68HC11/12 version with their board.
MegaSquirt did some improvements on my original port for the support of XGate and
better support for H9S12X.
The gcc 3.3.6 release is the most stable and production ready release. Despite its apparent
oldness, it is more stable than what you could get with gcc 4.x recent mainstream releases.
The obsolete announcement is sad but I don' have time to work on repairing what is broken in GCC 4.6.

Most stable gcc/g++ version to date

I want to know which gcc/g++ version released is the most stable to date? I had an impression that gcc version 2.95 was the most stable but a few peers told me that gcc 3.x versions are now the most stable.
The 2.95 branch hasn't had an update in over ten years. I certainly wouldn't be using it for anything voluntarily. Use whatever is the latest available for your system unless you have specific knowledge of a need to use something else (a vague "impression" is not specific knowledge, actual bugs and specific compatibility problems are).
Even 3.x is rapidly aging. There is no general reason not to use 4.x.
The only gcc versions that are actively worked on - i.e. debugged and stabilized are gcc-4.n where n > 3 these days. Use the gcc-4.* series. Even cygwin and mingw are off gcc-3.* these days.
GCC 4.6.2 has been released recently, on 27 Oct 2011.
And chosing a specific version of GCC is not a guarantee that your binary will work on all linux-es you want, because distributions may have different versions of the C++ standard libraries.
I'll recommend not using something older than GCC 4.5, and preferably 4.6. However, you might want to use the version used to compile your linux distribution.

GCC target specificity and binary compatibility

Initial note: The question mentions AIX because it is the initial context but the question really pertains to gcc itself, most probably regardless of the platform.
AIX is supposed to be backwards binary compatible: a C program compiled on AIX 5.1 will run as is on 5.2, 5.3, 6.1 and 7.1.
In my understanding gcc should be built to target a specific system (whether the current one or another one in the case of cross-compiling). So, gcc built on AIX 6.1 targets AIX 6.1, and produces binaries usable on both 6.1 and 7.1 thanks to binary compatibility.
Yet gcc itself built on AIX 6.1 is a 6.1 program, so it should execute on 7.1 as is. Of course if I compile a program with it on 7.1, this program might get linked or use headers specific to 7.1, thus making the resulting binary requiring 7.1. So as far as I understand it, I should be able to run gcc built on AIX 6.1 onto a 7.1 machine, and produce maybe non-optimal yet perfectly valid binaries, although they would require 7.1 as a side effect of linking.
This looks too much like rainbows and unicorns dancing in glittery skies. I smell something fishy but lack any knowledge of gcc innards. Please mighty crowd, enlighten me.
tl;dr: Can gcc built on and targeting a version N of an OS/platform be run and used on version N+1 by virtue of platform binary compatibility to produce binaries running on version N+1? If not, what mechanism would prevent it?
Here's enlightenment: your question is way too general. In order to answer it, someone would have to have knowledge of
the operating systems you care about
the OS versions you care about
the gcc versions you care about
and then research the binary compatibility in this three dimensional matrix.
Mechanisms preventing binary compatibility are too numerous and directly correlate to your OS and compiler vendor's ingenuity at breaking it. One of the more common and documented ways being official deprecation of API calls, removal of compatibility libraries shipped, and bridges being burnt, like going from a.out to ELF.

Cygwin boost comes with new g++ which seems to break my code... why?

Setup: I installed Cygwin with the GNU programming lineup (gcc, g++, make, and gdb) and successfully compiled an ran a program that I was working on. Then I decided to install boost into Cygwin because I will need to use typical boost stuff as my program develops. So, using the Cywing setup.exe, I installed boost. After this, the program that I had just successfully compiled and ran no longer worked. (And recall that it didn't depend upon boost.)
I found out that when boost installed, it also installed a new compiler, g++-4.exe, whereas previously I had been using r++-3.exe. Boost had also symbolically linked g++.exe to the new compiler. After I changed back the symbolic link my old program compiled correctly.
Is there any reason that I should be using g++-4 rather than g++-3?
g++ 3 is very old and the gcc community has long since dropped maintenance of it. (GCC 4.3 is currently the oldest maintained release series.) There have been lots of language conformance improvements in newer versions (both in accepting valid code and rejecting bad code), so you'll have an easier time going forward if you bite the bullet now. You can check the release notes for each series (e.g. for 4.0) for explanations of these improvements and the code changes they might require. Personally, I find programming much more enjoyable when I can reason about programs according to a precise language specification, and only rarely be forced to understand the quirks of a particular compiler.
Also, Boost support for g++ 3 seems to be nearing an end, as Boost 1.44 considers GCC 3(.4.6) as an "additional test compiler" on only a single platform (RHEL). Boost development is linear (not branched), so you can find yourself in a situation where you need to upgrade to get bug fixes, but then find that your platform is no longer supported.

gcc for MIPS, 3.4.4 or 4.3.2?

We've made a number of changes to gcc 3.3.2 (for MIPS) to support the vagaries of an embedded system we're working on. gcc 3.4 and later appear to have substantially improved the MIPS code generation, so I'm planning to port our changes forward. The question is which gcc version should I target: 3.4.4 or straight to 4.3.2? Its a substantial amount of work to port the changes, I don't want to do it twice and pick the better result.
The Linux-MIPS project still recommends gcc 3.4.4, and MIPS Technologies maintains a modified SDE toolchain based on gcc 3.4.4. Though my embedded system is not running Linux, I respect their expertise.
From what I've read the MIPS backend does not benefit from the higher level optimizations in 4.x, and actually produces slower code than 3.4.4. Can anyone confirm or deny this?
I haven't used MIPS since the classroom so I can't directly answer your question.
I would suggest sending an e-mail to someone on the Linux-MIPS project, and ask when they plan to upgrade. Assuming it is not soon. It looks like 3.4.4 is a worthy upgrade.

Resources