Cygwin, choose between different GCC versions - gcc

I already had Cygwin installed, but I just ran the installer to get a later version of GCC.
Previously I was running GCC 4.9, I am now running 9.3. However, my code now runs approximately 20% slower.
To confirm the GCC version is the cause I would like to be able to compile it with GCC 4.9 again.
How do I do switch between using GCC 4.9 and 9.3?

you can try to install a older Cygwin with the older GCC
from the Cygwin Time Machine
http://www.crouchingtigerhiddenfruitbat.org/Cygwin/timemachine.html
I suggest you to make a parallel installation if you want to compare the results

Related

how to remedy mno cygwin error?

I'm working on compiling a library in windows with GCC and Make.
When I run make, I get the following error:
unrecognized command line option '-mno-cygwin'
I saw this post on SO, but it doesn't necessarily seem like the same issue, and I don't understand how to downgrade my system to a version of GCC (or Make) that supports the flag I need to use in order to compile.
Could someone please try to point me in the right direction, or if you've run into this problem offer a solution?
I'm running Windows 8.1 pro, GCC 5.4.0, make 4.2.1.
I can post more info if it is necessary to help me.
The current cygwin gcc compiles only for cygwin itself.
-mno-cygwin is an obsolete flag from gcc 3.x time that allowed the cygwin compiler to compile mingw (not cygwin) programs.
The switch was removed long time ago and true cross compilers
mingw64-x86_64-gcc-core
mingw64-i686-gcc-core
cygwin-mingw
were made available
Latest update:
https://sourceware.org/ml/cygwin-announce/2016-11/msg00020.html

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.

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.

Compiling with different GCC versions

This is a follow up Q to CUDA incompatible with my gcc version.
I've recently updated to Ubuntu 12.04 as well as grabbing the latest CUDA toolkit. My nvcc --version is showing: Cuda compilation tools, release 5.0 (My driver ver is 304.43.)
I'm trying to fix my build environment. I get errs about using GCC 4.6. I can probably fix this w/ the help of the above link. I'm wondering about the other 8 packages in this large project. Should I be concerned with building other pieces with one version of GCC-4.6 and my cuda stuff with GCC-4.5? I figure they should all be compatible, but I've never run into this before. Is this anything I need to be concerned with?
I have run into incompatibility issues with different versions of GCC.
Specifically, GCC 4.7 and 4.6. My Qt applications wouldn't compile for me, because I was using GCC 4.7, and the library was compiled against GCC 4.6. They compiled fine, and there seemed to be no problem at first. But then I ran into trouble actually running them.
I would recommend against using different versions of GCC in the same project.

newer gcc for cygwin

I use cygwin to compile my C++ programs but it uses gcc 3.4.4, is there a newer version of it for cygwin, or at least a port of newer versions of gcc to windows?
Install the "gcc4" package (not "gcc") to get GCC 4.5.3 or (optionally) an even later one.
Kind of hard to find! This confused me for a while too.

Resources