How to install older version of GCC on Windows 10 - windows

I need to install MinGW GCC 7.3 on my computer for a project. Downloaded and installed: C:\MinGW\bin\MingGW-get.exe. But when I run it, it only gives me the option to install the latest GCC v9.2.0. How do I download and install GCC v7.3 on my computer? Step-by-step directions appreciated.

Unless you specifically want the mingw.org toolchain, check out https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/. Currently there's v8.1.0, v7.3.0, v6.4.0 and v5.4.0. Other versions are available elsewhere.

Of you need to support an older C/C++ standard the -std= compiler flag may already help (e.g. -std=c99 for ISO 1999 C or -std=c++98 for ISO 1998 C++).
Note that GCC 7.3 is not the latest version of GCC 7. The latest GCC 7 release is version 7.5.0.
You can the Windows (MinGW-w64) version from: http://winlibs.com/

The online installer tool (first option on the page) allows you to do so.
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe

Related

How to install two GCC versions for cuda 5.0 on centos7

I need to install cuda 5.0 in centos7 x64. But, I have a problem with GCC, as the current version installed is (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11).
What is the supported version of GCC for Cuda 5.0 and how to install this older GCC version with my actual compiler ((GCC) 4.8.5).
Thanks in advance
#talonmies has provided a list of maximum GCC version supported by different versions of CUDA. Specifically: CUDA 5.0 supports GCC up to 4.6 - and that's what you should install.
There's an answer here on SO which explains how to get GCC 4.6(.3) installed by building from sources. Essentially you need to build some libraries with any C compiler before you can build GCC itself.
Good luck.

GLIBC_2.11' not found (required by /path_name/bin/gfortran)

I already have GCC and Gfortran installed. It is gcc version 4.1.2 20080704 (Red Hat 4.1.2-52). However, I am trying to install a more recent gfortran compiler. Here is what I did so far. From the http://gfortran.meteodat.ch/download/x86_64/ I downloaded the nightly "gcc-trunk.tar.xz" and I extracted it into the directory "opt." This created the directory "gcc-trunk". I then downloaded the "gcc-5-infrastructure.tar.xz" and extracted it into "gcc-trunk." I then input
PATH="$HOME/gcc-trunk/bin":$PATH
MANPATH="$HOME/gcc-trunk/share/man"
LD_LIBRARY_PATH="$HOME/gcc-trunk/lib64":"$HOME/gcc-trunk/lib":$LD_LIBRARY_PATH
on bash. I then tried to verify whether gfortran installed correctly with
/path_name/gfortran -v
However, I get the message GLIBC_2.11' not found (required by /path_name/bin/gfortran). I am not sure what is the problem. What should I do?
The gfortran binary you downloaded was built against a newer version of glibc than the one you have installed on your system.
You can solve this problem e.g. by
Acquiring a gfortran binary built against an older version of glibc
Building GCC from source
Upgrade to a newer distro with a newer glibc

CUDA version X complains about not supporting gcc version Y - what to do?

The question is about a specific combination of versions but is relevant more generally.
I've just dist-upgraded from Kubuntu 12.04 to 14.04. Now, when I want to compile CUDA code (with CUDA 6.5), I get:
#error -- unsupported GNU version! gcc 4.9 and up are not supported!
I installed gcc-4.8 (and 4.7), and tried to use the symlinks-in-/usr/local/cuda/bin solution suggested here:
CUDA incompatible with my gcc version
but this doesn't work. What should I do?
This solution is relevant to multiple combinations of CUDA and GCC versions.
You can tell CUDA's nvcc to use a specific version of gcc. So, suppose you want gcc 4.7 for use with CUDA 6. You run:
sudo apt-get install gcc-4.7 g++-4.7
and then add the following switch to your nvcc command-line:
nvcc --compiler-bindir /usr/bin/gcc-4.7 # rest of the command line here
If you're building with CMake, add an appropriate setting before looking for CUDA to your CMakeLists.txt, e.g.:
set(CUDA_HOST_COMPILER /usr/bin/gcc-4.7) # -> ADD THIS LINE <-
find_package(CUDA)
Also, it seems clang can compile CUDA as well, maybe that's worth experimenting with (although you would have to build it appropriately).
Note: Some Linux (or other OS) distributions don't have packages for multiple versions of gcc (in the same release of the OS distribution). I would advise against trying to install a package from another release of the distribution on an older release, and consider building gcc instead. That's not entirely trivial but it is quite doable - and of course, it's your only option if you don't have root access to your machine.
Switch back to a supported config. They are listed in the getting started document for any recent CUDA distribution.
For your particular configuration you have currently listed, you might have better luck with CUDA 7 RC, which is now available to registered developers.
I had a similar issue with CUDA Toolkit 7.5 and gcc 5.2.1.
I did modify the host_config.h file in /usr/local/cuda/include/:
Just remove the lines where it check the gcc version. It did solve my problem.
Credits goes to Darren Garvey (https://groups.google.com/forum/#!topic/torch7/WaNmWZqMnzw)
Very often you will find that CUDA has had newer releases by the time you encounter this problem. For example, the original formulation of the question was about CUDA 6 and GCC 4.9; CUDA 7 supported GCC 4.9. CUDA 8 supports GCC 5.x . And so on.

Upgrading from GCC 4.8.2 to GCC 4.9.0 without a complete rebuild

I installed the GCC 4.8.2 a couple of weeks ago. The installation process went well and I have GCC 4.8.2 at my Ubuntu system (12.04 64 bits). Now GNU just released the newer version 4.9.0.
My question is: Is there any way to upgrade my GCC to 4.9.0 without doing all process: configuration, building, checking and installation from scratch?
Also, please tell me what is the benefit/purpose of gcc-4.8.2-4.9.0.diff.gz file?
Is it like script/patch file to upgrade my compiler?
FYI, I don't have any plan to have two different versions of GCC at my system.
My question is: Is there any way to upgrade my GCC to 4.9.0 without doing all process: configuration, building, checking and installation from scratch?
Yes, if you have it already built. No, if you have only sources.
Also, please tell me what is the benefit/purpose of gcc-4.8.2-4.9.0.diff.gz file?
Read manual for patch utility how to apply it. You can convert 4.8.2 sources to 4.9.0 ones with this diff.
Is it like script/patch file to upgrade my compiler?
Yes, but for its sources. So building is still required.
Do you really need new features of 4.9 for your projects?

Does it matter that I update the gcc 4.6 to 4.7 or higher in Ubuntu 12.04(LTS)

I found that more and more open source libraries will use C++11 features, and my Ubuntu Desktop 12.04 just has gcc 4.6, I want to use the update-alternatives to change the default gcc version into 4.7 or 4.8. I wonder that, if the libraries in the /usr/local/lib compiled by gcc 4.6 will need to be recompiled by the new gcc 4.7/4.8. In my opinion, if the dependency libraries are still in the system, there is no need to recompile. But, If one dependency library compiled by the new gcc 4.7, is the dependency among libraries still right? Sorry for my poor English.
Thanks.
Just update to 13.04 (and soon 13.10). From my 13.04 development box:
edd#max:~$ ls -1 /usr/bin/g*-4.*
/usr/bin/g++-4.4
/usr/bin/g++-4.5
/usr/bin/g++-4.6
/usr/bin/g++-4.7
/usr/bin/gcc-4.4
/usr/bin/gcc-4.5
/usr/bin/gcc-4.6
/usr/bin/gcc-4.7
/usr/bin/gcc-ar-4.7
/usr/bin/gcc-nm-4.7
/usr/bin/gcc-ranlib-4.7
/usr/bin/gcov-4.4
/usr/bin/gcov-4.5
/usr/bin/gcov-4.6
/usr/bin/gcov-4.7
/usr/bin/gfortran-4.4
/usr/bin/gfortran-4.5
/usr/bin/gfortran-4.6
/usr/bin/gfortran-4.7
edd#max:~$
Make sure you upgrade one-by-one and not in jumps. It usually a very smooth process.

Resources