3

I am trying to install GCC on my local system.

I am referring this

I have successfully completed the following steps:

  1. Install Cygwin
  2. Install Required Cygwin Packages

     C:\cygwin64>setup-x86_64.exe -q -P wget -P gcc-g++ -P make -P diffutils -P libmpfr-devel -P libgmp-devel -P libmpc-devel
    
  3. Download, Build and Install the Latest GCC

    $ wget http://ftpmirror.gnu.org/gcc/gcc-9.2.0/gcc-9.2.0.tar.gz
    $ tar xf gcc-9.2.0.tar.gz
    $ mkdir build-gcc
    $ cd build-gcc
    

After this while configuring the gcc-9.2.0 using the below command I am facing the following error:

    $ ../gcc-9.2.0/configure --enable-languages=c,c++ --disable-bootstrap --disable-shared
error:
    configure: creating ./config.status
    ./config.status: line 470: syntax error near unexpected token `)'
    ./config.status: line 470: `    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;'

Any solution for this or alternate website link for downloading latest gcc binaries for windows will be highly appreciated.

Ranjan
  • 71
  • 3
  • 9
  • 1
    Do you need to use Cygwin? Unless you really need the POSIX compatibility layer it provides, I've found Cygwin to be more trouble than it's worth. – user4581301 Dec 04 '19 at 04:46
  • Agreed, if at all possible I would use the windows 10 Linux For Windows subsystem. – SoronelHaetir Dec 04 '19 at 05:13
  • I just want use latest gcc compiler for c++ and debugging capability. I found the MinGW builds are supporting old gcc releases, which does not provide latest C++ code support – Ranjan Dec 04 '19 at 09:08
  • The really well-known mingw distributions, or at least the ones google dumps you at, are mostly antiques that barely support C++11. To gett an up-to-date toolchain the instructions I would give are too close to [this answer](https://stackoverflow.com/a/30071634/4581301) to be worth rewriting. I add on a few extra packages like ssl and curl. Msys and the surrounding environment are good at keeping things up to date as well. – user4581301 Dec 04 '19 at 17:55
  • I just tried it myself, admittedly on an existing Cygwin installation rather than a new one, and was not able to reproduce the problem. After running `configure` I got a `config.status` with the exact same line 470: `*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;`. It's conceivable the problem is with your shell. Although `configure` is supposed to produce shell-agnostic code, this may not always succeed. So what shell are you using? Just the standard bash shell or something else? – Iguananaut Dec 06 '19 at 10:20
  • FWIW I have `$ bash --version` `GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)` – Iguananaut Dec 06 '19 at 10:21
  • @Iguananaut as I'm using windows 10, so it is command prompt actually. – Ranjan Dec 16 '19 at 19:30
  • You should run the bash shell that comes with Cygwin instead. – Iguananaut Dec 17 '19 at 11:05

1 Answers1

3

Personally I try to avoid Cygwin as it has a compatibility layer, so the resulting executables are not 100% native. With MinGW or the newer MinGW-w64 you do get 100% native Windows .exe and .dll files.

If you're looking for the latest GCC version with MinGW-w64 check out: http://winlibs.com

At the time of this writing GCC 9.3.0 is the latest version, but http://winlibs.com already has Windows builds of snapshots of the upcoming GCC 10.

Brecht Sanders
  • 6,215
  • 1
  • 16
  • 40