Author Topic: Build Linux and Mac executables under Windows  (Read 7411 times)

Offline S0mbre

  • Single posting newcomer
  • *
  • Posts: 5
Build Linux and Mac executables under Windows
« on: October 31, 2011, 08:05:26 am »
Hi! I am sorry if this question sounds too amateurish, but I haven't found an answer either in FAQ or in the Wiki.
What is the general workflow for building Linux and Max applications (executables) in CB under Windows?
As I understand, the MinGW compiler that comes with CB is just a g++ port for Windows, so it can compile only native Windows executables and libraries. But how can I compile native Linux and Max executables and libraries with CB under Windows? Do I need first to install any compilers, and if so, how can this be done?

Thank you!

Offline Radek

  • Multiple posting newcomer
  • *
  • Posts: 104
Re: Build Linux and Mac executables under Windows
« Reply #1 on: October 31, 2011, 04:43:49 pm »
Install a virtual machine, for example VirtualBox, install operating systems, install CodeBlocks, etc., compile.

Note that a multi-platform IDE or compiler means that the same IDE or compiler exists on more platforms. It does not mean that the compiler can compile for "foreign" operating systems and if it can, then count on serious restrictions. For example, linker: needed libraries or DLLs are nowhere in sight. Even if it can, you cannot run the "foreign" app so that you do not know what you have compiled or linked.

Offline S0mbre

  • Single posting newcomer
  • *
  • Posts: 5
Re: Build Linux and Mac executables under Windows
« Reply #2 on: November 01, 2011, 05:05:32 am »
Thanks for the quick reply! However it does seem odd, doesn't it, that there should be no easier way of compiling for 'foreign' platforms without a virtual machine and another copy of the IDE installed into that. A compiler (as far as I understand) only translates a higher-level code into the machine language (that must be similar to Assembly code); that machine code though being specific to different operating systems, it is imaginable that a 'cross-compiler' might be able to translate one higher-level code into different sets of machine-specific codes and naturally output OS-specific executables and libraries. Never mind that the resulting 'foreign' executable/lib can't be tested on the source machine - one might test it on a virtual machine or another physical OS. But it is hardly conceivable that a simple 'hello world' application should need debugging and testing.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Build Linux and Mac executables under Windows
« Reply #3 on: November 01, 2011, 05:47:27 am »
Compiling Windows or Mac binaries from a Linux machine is relatively simple (for example I'm Cross).
A Windows hosted cross-compiler... it is possible (with enough patience), but painful to setup.  Here are some slightly old instructions (they are in French, so if you want to try them, you could run it through Google translate or something if you do not read French - administrators, I hope you do not mind the non-English link).

Offline S0mbre

  • Single posting newcomer
  • *
  • Posts: 5
Re: Build Linux and Mac executables under Windows
« Reply #4 on: November 01, 2011, 07:57:24 am »
Hi! Thank you for the links! I do speak French well enough to understand.