Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can get a cross compiler under Ubuntu for sparc target?

How I can get a cross compiler under Ubuntu for sparc target?

I want to compile my c and c++ program, working in Ubuntu, for sparc architecture? How i can do this? Can I use mingw32 cross compiler?

like image 553
G-71 Avatar asked Jan 17 '23 13:01

G-71


1 Answers

You need to compile a gcc cross compiler. The first step is to download the source code for gcc, bin-utils (gnu as, ld, etc), and the standard library for the platform.

Once you have the necessary source code(s) you need to configure, make, and then install the cross compiler without clobbering your host gcc.

./configure  --target=$TARGET --prefix=$PREFIX
make
make install

Rinse and repeat for 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. Look into newlib if you're having trouble with this.

$TARGET is obviously the target platform, for you it'll be a string like sparc-elf or sparc64-elf, but it depends.

$PREFIX is where your cross compiler will be located. It will be named something like $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://ftp.gnu.org/gnu/binutils/

http://sourceware.org/newlib/

like image 86
mamidon Avatar answered Jan 20 '23 03:01

mamidon