CoryC
CoryC

Reputation: 489

Compile C++ code for AIX on Ubuntu?

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.

Upvotes: 6

Views: 4292

Answers (3)

Try to compile with -maix32 or -maux64 (like g++ -m32 file.cxx), it it doesn't work it means that it's not supported by your compiller.

Upvotes: 1

karlphillip
karlphillip

Reputation: 93410

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).

Upvotes: 4

Jerry Coffin
Jerry Coffin

Reputation: 490108

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.

Upvotes: 0

Related Questions