cross-compiling to Linux?

Larry Hall (Cygwin)
Tue Sep 2 01:21:00 GMT 2014

On 08/31/2014 07:03 AM, Juhász Ádám wrote:
> Hi everyone,
> When I was developing one of my program, I've tried to compile it under
> Cygwin, and for some reason Cygwin's g++ always compiled it without
> extension (and maybe an ELF executable?), so I had to create an explicit
> rule to compile it with the EXE extension.
> However just before I also installed MinGW so I can see what libraries does
> that includes, I've noticed that Cygwin created an ELF executable (utterly
> useless in Windows) however I deleted it without a second thought and just
> then I've realized that I should've tried whether it runs on a Linux
> machine. (My assumption was that it possibly was a PE executable with an ELF
> header.) Now I've installed MinGW, and right after that, Cygwin also
> generates proper PE executables for Windows, and can't seem to force it to
> compile it as ELF executable despite all it took was to omit the EXE
> extension.
> Was this the proper behavior for Cygwin that MinGW changed?
> What could possibly have MinGW did to change this behavior?
> Is it *really* possible to cross-compile to Linux with Cygwin-Not that it
> isn't possible, but whether is it possible by a basic setup or does Cygwin
> provides a special package for that (or neither)?

I can't speak to what you saw initially but interpreting the results you
got as an ELF executable is incorrect.  Cygwin's build tools target Windows/
PE executables.

As for cross-compiling with Cygwin, see the gcc FAQ on the subject:




A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list