在Ubuntu上编译AIX的C ++代码?

时间:2021-04-21 16:58:35

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

一句话的问题:如何在Ubuntu上使用G ++编译AIX代码? (假设有可能)

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.

我希望它就像在make文件中添加一个选项来指定目标处理器一样简单。对于编译器相关的大多数事情我都是新手。

Thank you in advance.

先谢谢你。

3 个解决方案

#1


4  

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.

工具链包括交叉编译器(在当前平台上运行的编译器,但构建二进制代码以在另一个上运行,在您的情况下,在AIX上运行),C或C ++库以及一些其他有趣的工具。

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.

我过去成功使用过buildroot,这是一个自动创建交叉编译工具链的工具。我知道他们支持几个目标平台,也许AIX就是其中之一。

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

如果您想手动编译工具链,请查看此页面上的Roll-your-own部分。

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

另一种方法,可能更容易在您的情况下,在Ubuntu上的虚拟机内安装AIX系统。通过这种方式,您可以访问在您的计算机内运行的完整AIX系统,从而有机会在真实条件下(或者您可能感兴趣的任何原因)开发和测试您的应用程序。

#2


1  

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.

您将要下载正确版本的g ++(即,为POWER生成代码,或者您正在运行AIX的任何代码),并编译它以在Ubuntu下运行。

#3


1  

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.

尝试使用-maix32或-maux64(如g ++ -m32 file.cxx)进行编译,它不起作用意味着你的编译器不支持它。

#1


4  

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.

工具链包括交叉编译器(在当前平台上运行的编译器,但构建二进制代码以在另一个上运行,在您的情况下,在AIX上运行),C或C ++库以及一些其他有趣的工具。

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.

我过去成功使用过buildroot,这是一个自动创建交叉编译工具链的工具。我知道他们支持几个目标平台,也许AIX就是其中之一。

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

如果您想手动编译工具链,请查看此页面上的Roll-your-own部分。

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

另一种方法,可能更容易在您的情况下,在Ubuntu上的虚拟机内安装AIX系统。通过这种方式,您可以访问在您的计算机内运行的完整AIX系统,从而有机会在真实条件下(或者您可能感兴趣的任何原因)开发和测试您的应用程序。

#2


1  

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.

您将要下载正确版本的g ++(即,为POWER生成代码,或者您正在运行AIX的任何代码),并编译它以在Ubuntu下运行。

#3


1  

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.

尝试使用-maix32或-maux64(如g ++ -m32 file.cxx)进行编译,它不起作用意味着你的编译器不支持它。