tags:

views:

68

answers:

2

Hi All,

Question in one sentence: How can I compile code for AIX using G++ on Ubuntu? (Assuming it is possible)

I hope that it is as simple as adding an option to the make file to specify target processor. I am a novice when it comes to most things compiler related.

Thank you in advance.

+1  A: 

You'll want to download the right version of g++ (i.e., one that generates code for POWER, or whatever you're running AIX on), and compile that to run under Ubuntu.

Jerry Coffin
You'll also need to make sure that includes the various run-time libraries that you'll need, unless you want to build everything statically and watch your executable size grow by leaps and bounds.
San Jacinto
+3  A: 

What you are looking for is a cross-compiling toolchain.

A toolchain includes a cross-compiler (a compiler that runs on the current platform but builds the binary code to run on another, on your case, AIX), the C or C++ library, and some other interesting tools.

I have successfully used buildroot in the past, which is a tool that automates the process of creating a cross-compiling toolchain. I know they support several target platforms, maybe AIX is among them.

If you want to compile your toolchain by hand, take a look at the Roll-your-own section on this page.

Another approach, probably easier on your case, would be to install a AIX system inside a virtual machine on Ubuntu. This way you would have access to a complete AIX system running inside your machine, giving the opportunity to develop and test your application under real conditions (or whatever reasons you may find interesting for doing such a thing).

karlphillip