[英]How I can get a cross compiler under Ubuntu for sparc target?
How I can get a cross compiler under Ubuntu for sparc target? 如何在Ubuntu下为sparc目标获取交叉编译器?
I want to compile my c and c++ program, working in Ubuntu, for sparc architecture? 我想编译我的c和c ++程序,在Ubuntu中工作,用于sparc架构? How i can do this? 我怎么能这样做? Can I use mingw32 cross compiler? 我可以使用mingw32交叉编译器吗?
You need to compile a gcc cross compiler. 您需要编译gcc交叉编译器。 The first step is to download the source code for gcc, bin-utils (gnu as, ld, etc), and the standard library for the platform. 第一步是下载gcc,bin-utils(gnu as,ld等)的源代码,以及该平台的标准库。
Once you have the necessary source code(s) you need to configure, make, and then install the cross compiler without clobbering your host gcc. 获得必要的源代码后,您需要配置,制作,然后安装交叉编译器,而无需破坏主机gcc。
./configure --target=$TARGET --prefix=$PREFIX
make
make install
Rinse and repeat for bin-utils. 冲洗并重复使用bin-utils。 I believe you'll have to pass in the location of the source for the standard library to configure, but I don't know what the argument is. 我相信你必须传递标准库的源位置来配置,但我不知道参数是什么。 I've just done this for OS dev where you don't really need it. 我刚刚为OS开发人员做了这个,你真的不需要它。 Look into newlib if you're having trouble with this. 如果你遇到麻烦,请查看newlib。
$TARGET is obviously the target platform, for you it'll be a string like sparc-elf or sparc64-elf, but it depends. $ TARGET显然是目标平台,对你而言,它将是一个像sparc-elf或sparc64-elf这样的字符串,但它取决于它。
$PREFIX is where your cross compiler will be located. $ PREFIX是您的交叉编译器所在的位置。 It will be named something like $TARGET-gcc. 它将被命名为$ TARGET-gcc。 So this is optional, just make sure it ends up on your path. 所以这是可选的,只要确保它最终在您的路径上。
http://www.netgull.com/gcc/releases/gcc-4.6.2/ http://www.netgull.com/gcc/releases/gcc-4.6.2/
http://ftp.gnu.org/gnu/binutils/ http://ftp.gnu.org/gnu/binutils/
One of the simplest ways of obtaining a working cross compiler for Sparc V8 is to use Buildroot. 获取Sparc V8的工作交叉编译器的最简单方法之一是使用Buildroot。 Here's a small tutorial on installing the cross compiler and testing the executables on Qemu emulator. 这是一个关于在Qemu仿真器上安装交叉编译器和测试可执行文件的小教程 。
You should be able to use one of the cross compilers from emdebian . 您应该可以使用emdebian的交叉编译器之一 。
If you get strange errors about missing includes, then you stumbled over a version where the dependency on the kernel headers is missing, in this case you need to manually install linux-libc-dev-sparc-cross
as well. 如果你得到关于缺失包含的奇怪错误,那么你偶然发现缺少对内核头文件的依赖的版本,在这种情况下你需要手动安装linux-libc-dev-sparc-cross
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.