简体   繁体   English

msys和tdm-gcc:配置错误-无法运行C编译程序

[英]msys and tdm-gcc: configure error - cannot run C compiled programs

so I'm trying to compile a preexisting C++ project with msys and tdm-gcc in Windows. 因此,我尝试在Windows中使用msys和tdm-gcc编译一个预先存在的C ++项目。 I have done this successfully by installing tdm-gcc (latest version) via the installer, editing MinGW/msys/1.0/etc/fstab to give my tdm-gcc install as the mount location, then running msys to call the configure script, and make. 通过安装程序安装tdm-gcc(最新版本),编辑MinGW / msys / 1.0 / etc / fstab,将我的tdm-gcc安装为安装位置,然后运行msys来调用configure脚本,并成功完成了此操作使。 However, for this project I need to use an old version of tdm-gcc (4.6.1-tdm64-1) for binary compatibility. 但是,对于该项目,我需要使用旧版本的tdm-gcc(4.6.1-tdm64-1)来实现二进制兼容性。 So I installed the required packages from the tdm-gcc sourceforge site (gcc core, gcc c++, binutils, mingw64-runtime, mingw32-make, libintl, libiconv, all of the version the readme says to use with 4.6.1), extracted to a new directory, and edited fstab to point to their location. 因此,我从tdm-gcc sourceforge网站(gcc核心,gcc c ++,binutils,mingw64-runtime,mingw32-make,libintl,libiconv,自述文件中所述与4.6.1一起使用的所有版本)安装了必需的软件包。到新目录,然后编辑fstab指向其位置。 Now while executing the configure I get this error: cannot run C compiled programs. 现在,在执行配置时,我收到此错误:无法运行C编译程序。 The config file reads: 配置文件显示为:

[omitted]

configure:3436: $? = 0
configure:3425: gcc -v >&5
Using built-in specs.
COLLECT_GCC=c:\TDM-GCC-4.6.1-64\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/tdm-gcc-4.6.1-64/bin/../libexec/gcc/x86_64-w64-mingw32/4.6.1/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../src/gcc-4.6.1/configure --build=x86_64-w64-mingw32 --enable- targets=all --enable-languages=c,c++,fortran,objc,obj-c++ --enable-libgomp --enable-lto --enable-libstdcxx-debug --enable-version-specific-runtime-libs --enable-fully-dynamic-string --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://tdm-gcc.tdragon.net/bugs
Thread model: win32
gcc version 4.6.1 (tdm64-1) 
configure:3436: $? = 0
configure:3425: gcc -V >&5
gcc.exe: error: unrecognized option '-V'
gcc.exe: fatal error: no input files
compilation terminated.
configure:3436: $? = 1
configure:3425: gcc -qversion >&5
gcc.exe: error: unrecognized option '-qversion'
gcc.exe: fatal error: no input files
compilation terminated.
configure:3436: $? = 1

configure:3456: checking whether the C compiler works
configure:3478: gcc    conftest.c  >&5
configure:3482: $? = 0
configure:3530: result: yes
configure:3533: checking for C compiler default output file name
configure:3535: result: a.exe
configure:3541: checking for suffix of executables
configure:3548: gcc -o conftest.exe    conftest.c  >&5
configure:3552: $? = 0
configure:3574: result: .exe
configure:3596: checking whether we are cross compiling
configure:3604: gcc -o conftest.exe    conftest.c  >&5
configure:3608: $? = 0
configure:3615: ./conftest.exe
./configure: line 3617: ./conftest.exe: Bad file number
configure:3619: $? = 126
configure:3626: error: in `/c/jagswm':
configure:3628: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

[omitted]

I've tried adding the tdm-gcc bin to my path, although I don't think that should matter if fstab is set. 我尝试将tdm-gcc bin添加到我的路径,尽管我认为如果设置了fstab也不重要。 Any advice would be greatly appreciated, thanks. 任何建议将不胜感激,谢谢。

Try to disable your antivirus. 尝试禁用您的防病毒软件。
Worked for me while compiling GStreamer, probably because Avast was deleting the a.exe file. 在编译GStreamer时为我工作,可能是因为Avast删除了a.exe文件。

Source: http://wiki.openttd.org/Compiling_on_Windows_using_MinGW#Compilation_and_installation_of_the_required_packages 资料来源: http : //wiki.openttd.org/Compiling_on_Windows_using_MinGW#Compilation_and_installation_of_the_required_pa​​ckages

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM