配置期间出错:C编译器无法创建可执行文件(Concorde TSP)

oyjwcjzk  于 2023-05-28  发布在  其他
关注(0)|答案(1)|浏览(196)

我目前遇到一个问题,而试图安装和配置软件包(协和TSP求解器)在我的Windows机器上使用Cygwin。我已经按照提供的安装说明进行了安装,但我一直遇到以下错误:

$ 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.

我已经用Cygwin安装了这个依赖项:gcc-core、gcc-g++。我还设置了必要的环境变量CC和CFLAGS,如安装说明中所述。
$ CC=“gcc”CFLAGS="-g -O3”./configure
然而,问题依然存在。
我已经检查过gcc编译器确实安装了,但是在配置过程中它似乎无法创建可执行文件。我怀疑可能是主机系统类型或其他一些配置设置有问题。

  • Cygwin版本:cygcheck(cygwin)3.4.6-1.x86_64
  • gcc版本:gcc(GCC)11.3.0
    配置日志消息:
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);}
guykilcj

guykilcj1#

在我的系统上,在下载了日期为2003年12月19日的最新版本后,它构建得很好
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'

它似乎已经建立了所有的程序

$ 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

消息Invalid configuration x86_64-pc-cygwin并不奇怪,因为在2003年没有Cygwin 64位。
它似乎只需要香草包

$ 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

相关问题