为 Windows 编译 Linux 应用程序 (C)
我可以使用仅限 Linux 的可用库为 Windows 编译 Linux 应用程序吗?
我知道 nginx Web 服务器的作者使用一些 Wine 工具来让他的基于 Linux 的项目在 win32 上运行,但他是如何做到的呢?
MinGW 是否支持创建与 Linux 特定的库/标头链接的 Windows 二进制文件?
PS:我不想使用cygwin,因为性能损失很大......
can I compile a linux application, with Linux-only available libraries, for Windows ?
I know the author of nginx web server uses some Wine tools to get his Linux-based project working on win32, natively, but how does he do that ?
Is MinGW support to create Windows binaries linked with Linux-specific libraries/headers ?
PS: I do not want to use cygwin due to big lost about performance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用诸如 mingw32 环境之类的东西,您必须自己找到或构建您想要构建的项目所依赖的所有库(以及这些库所依赖的所有库)。
您最终可能不得不实现该平台上缺少的一些功能。 cygwin 速度慢的原因之一是它必须跳过一些环节来模拟 windows 上缺少的 unix-y 东西。
Using something like mingw32 environment, you would have to find or build yourself all libraries on which the project you want to build depends (and all libraries on which those libraries depend).
You might end up having to implement some functionality which is missing on that platform. One of the reasons cygwin is slow is the hoops it has to jump through to simulate unix-y things that are missing on windows.
只要项目使用Linux上的标准库并且不依赖于任何特定于Linux平台的东西,GCC的Mingw端口就可以在Windows上编译它。
如果您熟悉 Linux 工具但不熟悉 Cygwin,您可能需要看看 MSYS:
As long as the project uses the standard libraries on Linux and do not depend on anything specific to the Linux platform, the Mingw port of GCC can compile it on Windows.
If you are familiar with Linux tools and you don't Cygwin, you might want to take a look at MSYS: