I have a MinGW compiler installed under Windows 7. How can I cross compile, i.e. compile binary file for linux. What compiler options do I need to set? And is it possible at all?

  • And why do you need such a perversion, let me ask? Put in Linux virtual machine, make shared folders and compile for health. - skegg

1 answer 1

MinGW is designed for the exact opposite of the problem, when the code is built on Linux and executed on Windows, so it is unlikely that this is possible at all. As stated directly on the MinGW website

MS-Windows applications

For cross-compiling from Windows to Linux, Cygwin is needed.

  • Well, now I'm trying to build the compiler of the required version under Cygwin ... I spend the whole day: ( - G71
  • 2
    Let's dot all i's. Both Cygwin and MinGW have the same goal — to provide the ability to compile and execute Unix-written code on Windows, with all Unix-specific system calls, library functions, compiler extensions, etc. Those. for compatibility at the level of program code, and not at the binary level, so that a program written for Unix can be compiled and run on Windows without modifying the code. This creates windows-binaries. - skegg
  • one
    1. More detail, please: what is the cross-compiler, etc. 2. Why not try it yourself? - skegg
  • one
    1) gcc compiler gcc-3.4.3-glibc-2.3.4 from here kegel.com/crosstool/crosstool-0.43/doc/… 2) I have already tried it, it does not start, I thought I should do it somehow, but then I stopped to Cygwin and read there: Cygwin is not: a way to run native Linux apps on Windows. If you want it to run on Windows. - G71
  • one
    What was required to prove - skegg