bernedef
bernedef

Reputation: 707

Compile Linux application for Windows (C)

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

Upvotes: 2

Views: 1864

Answers (2)

karlphillip
karlphillip

Reputation: 93478

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:

MSYS is a collection of GNU utilities such as bash, make, gawk and grep to allow building of applications and programs which depend on traditionally UNIX tools to be present. It is intended to supplement MinGW and the deficiencies of the cmd shell.

Upvotes: 1

Chris Stratton
Chris Stratton

Reputation: 40407

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.

Upvotes: 4

Related Questions