Install the package Sourcery Codebench Lite for MIPS (cross-compilation environment) on Ubuntu that compiles MIPS instructions

Source: Internet
Author: User
Tags hash

In order to compile the program on the computer composition and design-hardware/software interface, however, GCC on UbuntuX86 can only be compiled into the X86 assembly.

Sourcery codebench out a gcc toolchain for compiling to the MIPS assembler.

Our usual compilation, called Local compilation, is compiled into a compilation under the current platform. Instead, cross-compilation can be compiled into other platforms (the platform of the compiled platform is not the same as that of the compiled program)

Sourcery Codebench has paid version and free version, I use the free version.


Find here to download the latest version.

Available in two versions: Gnu/linux version and Elf version

I downloaded the

Reference Document: Https://

Two version differences see bottom note 1.

Right-click on the executable permission.

Command line execution


But it can't be done. Ask for a variety of documents and questions. Find a solution:

Since 12.04 Ubuntu introduced Multi Arch ( and removed ia32-libs ia32-libs-gtk pack Ages from the repository. To install 32-bit Libs your need the run the following command line

Ubuntu removed the 32-bit library after 12.04, so we had to install

The command line is as follows:

$ sudo dpkg--add-architecture i386
$ sudo apt-get update
$ sudo apt-get install libgtk2.0-0:i386 libxtst6:i386 GT k2-engines-murrine:i386 lib32stdc++6 libxt6:i386 libdbus-glib-1-2:i386 libasound2:i386

If it is not possible to install, "Hash checksum does not match" or "failure occurs, this may be the reason that a package is required to maintain the status quo." , skip to the last note, 2.

After installing the 32-bit library, we can open the file to the bin.

Then follow the instructions to install it. Ubuntu words, cancel the build icon on the desktop.

If you fail to quit, run again, and install in the same directory.

After installation, restart, command line input mips-linux-gnu-gcc-v can see the results.

mips-parameters are visible

#include <stdio.h>

int main () {
	printf ("Hello");

	. File	1 "hello.c"
	. Section. mdebug.abi32
	. Previous
	. Nan	legacy
	. module	fp=32
	. Module	oddspreg
	. abicalls.
	option	pic0
	. Rdata
	. Align	2
$LC 0:
	. ASCII	"hello\000"
	. Text
	. Align	2
	. Globl	main
	. Set	nomips16
	. Set	nomicromips
	ent	main
	. Type	Main, @function
	. Frame	$fp, 32,$31		# vars= 0, regs= 2/0, args=, gp= 8
	. Mask	0xc0000000,-4
	. Fmask	0x00000000,0
	. Set	noreorder
	. Set	nomacro
	addiu	$sp, $SP, -32
	SW	$31,28 ($SP)
	SW	$fp, ($SP)
	move	$fp, $sp
	lui	$2,%hi ($LC 0)
	addiu	$4,$2,%lo ($LC 0)
	Jal	printf

	Move	$2,$0
	move	$sp, $fp
	LW	$31,28 ($sp)
	LW	$fp, ($SP)
	Addiu	$sp, $sp,
	J	$31

	. Set	macro
	. Set	reorder
	. End	Main
	. Size	Main,.-main
	. Ident	"GCC: (sourcery codebench Lite 2015.11-32) 5.2.0"





Note one:

Note 2: This happens because of the wall. Re-select the new source and refer to this second

Finally, he gave me the choice of a Hong Kong source. I don't know if it's the reason I modified the hosts.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.