I have two gcc's installed in cygwin right now: i686-w64-mingw32-gcc-4.5.3.exe and the cygwin gcc. Ill show you what I did for the sake of clarity:
我现在有两个gcc安装在cygwin中:i686-w64-mingw32-gcc-4.5.3。exe和cygwin gcc。我会给你看我为了清楚起见做了什么:
$ ls -al /usr/bin/gcc* lrwxrwxrwx 1 User None 21 Aug 16 13:15 /usr/bin/gcc.exe -> /etc/alternatives/gcc -rwxr-xr-x 2 User None 94741 Feb 25 2009 /usr/bin/gcc-3.exe $ ls -al /etc/alternatives/gcc* lrwxrwxrwx 1 User None 18 Aug 16 13:15 /etc/alternatives/gcc -> /usr/bin/gcc-3.exe $ rm /etc/alternatives/gcc $ ln -S /usr/bin/i686-w64-mingw32-gcc-4.5.3.exe /etc/alternatives/gcc $ gcc -v Using built-in specs. COLLECT_GCC=gcc Target: i686-w64-mingw32 Configured with: /cygdrive/i/szsz/tmpp/32gcc/mingw64-i686-gcc-4.5.3-6/src/gcc-4.5.3/configure --srcdir=/cygdrive/i/szsz/tmpp/32gcc/mingw64-i686-gcc-4.5.3-6/src/gcc-4.5.3 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --datarootdir=/usr/share --docdir=/usr/share/doc/mingw64-i686-gcc -C --build=i686-pc-cygwin --host=i686-pc-cygwin --target=i686-w64-mingw32 --with-sysroot=/usr/i686-w64-mingw32/sys-root --with-build-sysroot=/usr/i686-w64-mingw32/sys-root --disable-multilib --disable-win32-registry --enable-languages=c,ada,c++,fortran,objc,obj-c++ --enable-fully-dynamic-string --enable-libgomp --enable-sjlj-exceptions --enable-version-specific-runtime-libs --with-dwarf2 --enable-decimal-float=bid --enable-lto Thread model: win32 gcc version 4.5.3 (GCC) $ gcc -o test test.c gcc: error trying to exec 'cc1': execvp: No such file or directory $ /usr/bin/i686-w64-mingw32-gcc.exe -o test test.c $
How do I get gcc to work?
如何让gcc工作?
2 个解决方案
#1
-3
If you need a native MinGW-w64 GCC, use a native Windows version of the compiler and call it from cmd or if you must MSYS. If not, use the Cygwin to Windows cross-compiler and encode the prefix in a Makefile/CMakeLists.txt/configure script.
如果您需要一个本地的MinGW-w64 GCC,请使用编译器的本地Windows版本,并从cmd调用它,或者您必须使用MSYS。如果没有,请将Cygwin应用于Windows交叉编译器,并在Makefile/CMakeLists中对前缀进行编码。txt / configure脚本。
Remember Cygwin != Windows, and what you are doing is cross-compiling, which in GCC land is done by calling prefixed binaries.
记住Cygwin != Windows,你所做的是交叉编译,在GCC中,通过调用前缀二进制文件来完成。
#2
-1
I think you need to change the gcc symlink in /usr/bin
to point to your correct version of GCC. Alternatively, you can edit your PATH
to have /etc/alternatives
come before /usr/bin
, but that may have unintended side effects, depending on your setup.
我认为您需要更改/usr/bin中的gcc symlink来指向正确版本的gcc。或者,您可以编辑您的路径以在/usr/bin之前使用/etc/替代品,但这可能会产生意外的副作用,这取决于您的设置。
#1
-3
If you need a native MinGW-w64 GCC, use a native Windows version of the compiler and call it from cmd or if you must MSYS. If not, use the Cygwin to Windows cross-compiler and encode the prefix in a Makefile/CMakeLists.txt/configure script.
如果您需要一个本地的MinGW-w64 GCC,请使用编译器的本地Windows版本,并从cmd调用它,或者您必须使用MSYS。如果没有,请将Cygwin应用于Windows交叉编译器,并在Makefile/CMakeLists中对前缀进行编码。txt / configure脚本。
Remember Cygwin != Windows, and what you are doing is cross-compiling, which in GCC land is done by calling prefixed binaries.
记住Cygwin != Windows,你所做的是交叉编译,在GCC中,通过调用前缀二进制文件来完成。
#2
-1
I think you need to change the gcc symlink in /usr/bin
to point to your correct version of GCC. Alternatively, you can edit your PATH
to have /etc/alternatives
come before /usr/bin
, but that may have unintended side effects, depending on your setup.
我认为您需要更改/usr/bin中的gcc symlink来指向正确版本的gcc。或者,您可以编辑您的路径以在/usr/bin之前使用/etc/替代品,但这可能会产生意外的副作用,这取决于您的设置。