1

My aim is to create cross-platform C++ python modules. I'm usingCyther (cross-platform The Cross-Platform Cython/Python Compiler).

Cyther uses GCC to compile modules and gives the user the ability to add GCC command-line args.

So, I need run compiler on Windows, but compile for Linux. What args I must pass to GCC to compile a module for Linux (or other platform)?

Is this possible, if so how?

Foitn
  • 604
  • 6
  • 25
Artem Selivanov
  • 1,867
  • 1
  • 27
  • 45

1 Answers1

1

Gcc must be built separately for each compilation target. It can be built for any target on any host. The target you need is i386-linux-gnu (or often i586-linux-gnu) for 32-bit and x86_64-linux-gnu for 64-bit Linux.

Note that it provides separate binaries, i386-linux-gnu-gcc, x86_64-linux-gnu-gcc etc. Parameters are then the same.

I am not sure anybody provides that, but you can build it yourself. A tool to help you with that is described in C++ cross-compiler from Windows to Linux.

Or you can go the simpler way and build on Linux (including cross-compilation to Windows). This kind of things is just so much easier on a decent Linux distribution.

Community
  • 1
  • 1
Jan Hudec
  • 73,652
  • 13
  • 125
  • 172