Harry
Harry

Reputation: 3937

Cross-compile on a Linux host for various targets

I have a set of more or less portable C/C++ sources sitting on a Linux development host that I would like to be able to:

  1. compile for 32- and 64-bit Linux targets
  2. cross-compile for 32- and 64-bit Windows targets
  3. cross-compile for 32- and 64-bit Mac targets
  4. and, ideally, without any runtime dependencies on other emulation DLL's like cygwin1.dll, MinGW, etc though I could use them if there's no other choice. If I have to use them, I'd prefer statically linking their functionality to my code.

The target binary that is desired is:

  1. a shared library (.so) for Linux and Mac targets, and

  2. a DLL for Windows.

I have no idea how to build a cross-compiler (and the associated toolchain) from scratch. I'm hearing that pre-built cross-compiler toolchains are available for various host-and-target combinations, but I don't know where to find them, or even how to use them without running into runtime crashes/coredumps later due to pointer model subtleties (LP64, LLP64, etc), specifying wrong or inadequate compiler switches, other misconfiguration, etc.

I've so far been unable to find the relevant and complete information on the above, and whatever little I've managed to find is scattered all over the place in so many bits and pieces that I'm not even sure if all that I've read is complete or even correct (applies fully, no more no less to my case).

I'm not a compilers expert, just their regular user. Would appreciate information achieving the above compilation goals.

Upvotes: 3

Views: 270

Answers (1)

Jekyll
Jekyll

Reputation: 1434

I would like to cross compile a library for Mac OsX on Linux and I am considering imcross. The instructions in the site are simple, but everytime you setup a crosscompiling environment you have to fix a lot of things, so I won't expect that it will be straightforward. You can check in the website that there are some limitations to this project but it is the best I came across.

Not being a priority for me now (I have other stuff to do before performing this task) I didn't setup the crossenvironment yet. I am going to do that in few days time.

Upvotes: 1

Related Questions