是否可以在没有Cygwin或MinGW的情况下使用GCC?

时间:2021-04-30 01:52:59

GCC is a very well respected multi-language compiler (from what I've gathered). One thing I've not been able to definitively find out is: Is it possible to use GCC on windows without anything extra like Cygwin or MinGW?

GCC是一个备受推崇的多语言编译器(从我收集的内容)。我无法明确发现的一件事是:是否有可能在Windows上使用GCC而没有像Cygwin或MinGW这样的额外内容?

I've learned that if you use GCC on Cygwin, there is a dependency on a DLL. If you use GCC with MinGW, you eliminate that dependency but you still must have MinGW to use GCC.

我已经了解到,如果你在Cygwin上使用GCC,那么就会依赖于DLL。如果你使用GCC与MinGW,你消除了这种依赖,但你仍然必须让MinGW使用GCC。

Is it possible to build GCC and utilize it by itself, completely native to Windows? Like Microsoft's Compiler? After reading around, my guess is no. But I'd still like more info, if possible.

是否有可能构建GCC并单独使用它,完全原生于Windows?像微软的编译器?看完之后,我的猜测是否定的。但是如果可能的话,我仍然会想要更多信息。

If not, why does GCC require environments like Cygwin or MinGW? I understand this now. It is because GCC requires a Unix/POSIX environment. Why it does, it still beyond me.

如果没有,为什么GCC需要像Cygwin或MinGW这样的环境?我现在明白了。这是因为GCC需要Unix / POSIX环境。为什么会这样,它仍然超出我的范围。

I did find this and it helps but doesn't really answer my question: Why does GCC-Windows depend on cygwin?

我确实发现了这个并且它有所帮助,但并没有真正回答我的问题:为什么GCC-Windows依赖于cygwin?

To refine my question, I guess what I'm trying to understand why GCC can't stand on it's own -- Where I have just "GCC.exe".

为了改进我的问题,我想我正在试图理解为什么GCC不能站在它自己的位置 - 我只有“GCC.exe”。

5 个解决方案

#1


For MinGW, you need MinGW in the sense that MinGW provides the implementation of the gcc language system. I don't see how your question makes sense - it's like "Can I use VC++ without installing VC++?"

对于MinGW,您需要MinGW,因为MinGW提供了gcc语言系统的实现。我不明白你的问题是否有意义 - 就像“我可以在不安装VC ++的情况下使用VC ++吗?”

To clarify: MinGW is the GCC compiler executable(s), headers and support objects. There isn't anything else. There is a related but independant package called MSYS which provides some posix utilities, but you do not need this in any way in order to use the MinGW version of GCC.

澄清一下:MinGW是GCC编译器可执行文件,头文件和支持对象。没有别的了。有一个相关但独立的包名为MSYS,它提供了一些posix实用程序,但是你不需要这样就可以使用MinGW版本的GCC。

#2


To disable mingw's extra dependency simply don't use exceptions (-fno-exceptions), I haven't used cygwin so not sure.

要禁用mingw的额外依赖,只是不要使用异常(-fno-exceptions),我没有使用cygwin所以不确定。

#3


I don't think so. I've had to compile some command line apps for people in the past and always had to use cygwin.

我不这么认为。我不得不为过去的人编译一些命令行应用程序,并且总是不得不使用cygwin。

I think the biggest reason being posix compatibility, which is what cygwin strives to bring to Win32.

我认为最大的原因是posix兼容性,这是cygwin努力为Win32带来的。

#4


What is exactly the problem with mingw? And what is native?

mingw到底有什么问题?什么是土生土长的?

mingw used to generate pretty much standalone binaries, and maybe that is even more native than MSVC's, which require msvcrt, a component that needs to be installed sometimes.

mingw用于生成相当多的独立二进制文件,也许这比MSVC更加原生,后者需要msvcrt,这是一个有时需要安装的组件。

So maybe you could explain what you tried with mingw, and what the exact problem is.

所以也许你可以用mingw来解释你的尝试,以及确切的问题是什么。

#5


Linaro used to provide that long time ago, a GCC that runs naively on Windows without MinGW or Cygwin. I am currently using that GCC 4.9 on a Windows 10 PC to compile UEFI and it is working like charm.

Linaro过去很久以前就提供过一个在没有MinGW或Cygwin的情况下在Windows上运行的GCC。我目前正在Windows 10 PC上使用GCC 4.9来编译UEFI,它的工作方式就像魅力一样。

https://releases.linaro.org/archive/14.09/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.9-2014.09_win32.zip

#1


For MinGW, you need MinGW in the sense that MinGW provides the implementation of the gcc language system. I don't see how your question makes sense - it's like "Can I use VC++ without installing VC++?"

对于MinGW,您需要MinGW,因为MinGW提供了gcc语言系统的实现。我不明白你的问题是否有意义 - 就像“我可以在不安装VC ++的情况下使用VC ++吗?”

To clarify: MinGW is the GCC compiler executable(s), headers and support objects. There isn't anything else. There is a related but independant package called MSYS which provides some posix utilities, but you do not need this in any way in order to use the MinGW version of GCC.

澄清一下:MinGW是GCC编译器可执行文件,头文件和支持对象。没有别的了。有一个相关但独立的包名为MSYS,它提供了一些posix实用程序,但是你不需要这样就可以使用MinGW版本的GCC。

#2


To disable mingw's extra dependency simply don't use exceptions (-fno-exceptions), I haven't used cygwin so not sure.

要禁用mingw的额外依赖,只是不要使用异常(-fno-exceptions),我没有使用cygwin所以不确定。

#3


I don't think so. I've had to compile some command line apps for people in the past and always had to use cygwin.

我不这么认为。我不得不为过去的人编译一些命令行应用程序,并且总是不得不使用cygwin。

I think the biggest reason being posix compatibility, which is what cygwin strives to bring to Win32.

我认为最大的原因是posix兼容性,这是cygwin努力为Win32带来的。

#4


What is exactly the problem with mingw? And what is native?

mingw到底有什么问题?什么是土生土长的?

mingw used to generate pretty much standalone binaries, and maybe that is even more native than MSVC's, which require msvcrt, a component that needs to be installed sometimes.

mingw用于生成相当多的独立二进制文件,也许这比MSVC更加原生,后者需要msvcrt,这是一个有时需要安装的组件。

So maybe you could explain what you tried with mingw, and what the exact problem is.

所以也许你可以用mingw来解释你的尝试,以及确切的问题是什么。

#5


Linaro used to provide that long time ago, a GCC that runs naively on Windows without MinGW or Cygwin. I am currently using that GCC 4.9 on a Windows 10 PC to compile UEFI and it is working like charm.

Linaro过去很久以前就提供过一个在没有MinGW或Cygwin的情况下在Windows上运行的GCC。我目前正在Windows 10 PC上使用GCC 4.9来编译UEFI,它的工作方式就像魅力一样。

https://releases.linaro.org/archive/14.09/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.9-2014.09_win32.zip