Search code examples
cwindowsgcccygwin

Error during configuration: C compiler cannot create executables (Concorde TSP)


I'm currently experiencing an issue while trying to install and configure a software package (Concorde TSP solver) on my Windows machine using Cygwin. I've followed the installation instructions provided, but I keep encountering the following error:

$ CC="gcc" CFLAGS="-g -O3" ./configure --host="x86_64-pc-Cygwin"

loading cache ./config.cache
checking host system type... Invalid configuration `x86_64-pc-Cygwin': machine `x86_64-pc' not recognized

checking for prespecified compiler options... yes
    Using default CC:       gcc
    Using default CPPFLAGS: -ansi -pedantic -Wall -W -Wtraditional -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs
    Using default CFLAGS:   -g -O3
    Using default LDFLAGS:
checking for gcc... gcc
checking whether the C compiler (gcc -g -O3) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.

I have installed the this dependencies with Cygwin: gcc-core, gcc-g++. I've also set the necessary environment variables, CC and CFLAGS, as mentioned in the installation instructions.

$ CC="gcc" CFLAGS="-g -O3" ./configure

However, the issue persists.

I have checked that the gcc compiler is indeed installed, but it seems to be failing to create executables during the configuration process. I suspect that there might be an issue with the host system type or some other configuration setting.

  • Cygwin version: cygcheck (cygwin) 3.4.6-1.x86_64
  • gcc version: gcc (GCC) 11.3.0

config.log message:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

configure:593: checking host system type
configure:619: checking for prespecified compiler options
configure:716: checking for gcc
configure:829: checking whether the C compiler (gcc -g -O3 ) works
configure:845: gcc -o conftest -g -O3 -ansi -pedantic -Wall -W -Wtraditional -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs  conftest.c  1>&5
configure: failed program was:

#line 840 "configure"
#include "confdefs.h"

main(){return(0);}

Solution

  • On my system, it builds fine after downloading the last version dated Dec 19, 2003
    https://www.math.uwaterloo.ca/tsp/concorde/downloads/downloads.htm

    $ tar -xf co031219.tgz
    
    $ cd concorde
    
    $ ./configure --host=x86_64-pc-cygwin
    checking host system type... Invalid configuration `x86_64-pc-cygwin': machine `x86_64-pc' not recognized
    
    checking for prespecified compiler options... no
    checking for gcc... gcc
    ..
    creating VERIFY/Makefile
    creating INCLUDE/config.h
    
    $ make
    cat ./INCLUDE/config.h ..
    ..
    make[2]: Leaving directory '/pub/tmp/concorde/COMBS'
    gcc -g -O2  -o concorde concorde.o tsp.a ../PQ/pq.a             ../VERIFY/verify.a ../LOCALCUT/localcut.a   ../TINY/tiny.a ../LINKERN/linkern.a   ../EDGEGEN/edgegen.a ../KDTREE/kdtree.a     ../FMATCH/fmatch.a ../UTIL/util.a ../BIGGUY/bigguy.a     ../CUT/cut.a ../HELDKARP/heldkarp.a ../LP/lp.a ../COMBS/combs.a  -liberty -lm
    make[1]: Leaving directory '/pub/tmp/concorde/TSP'
    make[1]: Entering directory '/pub/tmp/concorde/UTIL'
    make[1]: Nothing to be done for 'all'.
    make[1]: Leaving directory '/pub/tmp/concorde/UTIL'
    make[1]: Entering directory '/pub/tmp/concorde/VERIFY'
    make[1]: Nothing to be done for 'all'.
    make[1]: Leaving directory '/pub/tmp/concorde/VERIFY'
    

    and it seems to have built all programs

    $ find . -name "*.exe"
    ./CUT/mincut.exe
    ./EDGEGEN/edgegen.exe
    ./FMATCH/fmatch.exe
    ./LINKERN/linkern.exe
    ./LOCALCUT/localcut.exe
    ./TOOLS/edg2len.exe
    ./TOOLS/edgunion.exe
    ./TOOLS/fconvert.exe
    ./TOOLS/prob2tsp.exe
    ./TOOLS/showres.exe
    ./TOOLS/tourchk.exe
    ./TOOLS/tourlen.exe
    ./TSP/concorde.exe
    

    the message Invalid configuration x86_64-pc-cygwin is not a surprise as in 2003 there was no Cygwin 64 bit.

    It seems to require just vanilla packages

    $ cygcheck -c gcc-core make cygwin-devel
    Cygwin Package Information
    Package              Version        Status
    cygwin-devel         3.4.6-1        OK
    gcc-core             11.3.0-1       OK
    make                 4.4.1-2        OK