11 Kasım 2012 Pazar

Sourcey G++ Lite Installation for Mips-GNU-Linux and PATH Adjustment for Fedora and Ubuntu

In order to install mips cross compiler, we firstly have to find mips-4.3-51-mips-linux-gnu.bin.
Go to the directory where mips-4.3-51-mips-linux-gnu.bin is located, open a terminal and write:
$ ./mips-4.3-51-mips-linux-gnu.bin
If you do not have a customization, proceed with Next to the end of the installation through the wizard.
After the installation completes, open a terminal, write "mips" and press TAB to check whether the cross-compiler name completes automatically. If not, we shall add the compiler to PATH.

For Fedora,
$ cd /home/$USER
$ vi .bash_profile
You can also edit .bash_profile with more user friendly text editors as "Gedit".
To the bottom of the file -before #END- :
PATH=$PATH:/opt/Sourcery_G++_Lite/bin
export PATH
Restart your computer to apply the changes.

For Ubuntu
$ gedit .bashrc
To the bottom of the file add the lines below:
PATH="/home/$USER/CodeSourcery/Sourcery_G++_Lite/bin:${PATH}"
export PATH
PATH=$PATH:/opt/Sourcery_G++_Lite/bin

Restart your computer to apply the changes

Now we are able to cross-compile our projects with mips-gnu-linux.

Note: If you are using Ubuntu and encounter a problem during compilation like:
gcc version 4.3.2 (Sourcery G++ Lite 4.3-51) GCC version should be gcc version 4.3.2. please check it!!
make[1]: *** [check_gccver] Error 99 

and compilation fails, you should make some modifications:
Make sure that the symbolic link /bin/sh points to /bin/bash rather than /bin/dash (for Ubuntu 7.04+ dash is the default, check it). To change it run the following command (with root priviledge):
$ sudo rm /bin/sh
$ sudo ln -sf /bin/bash /bin/sh

$ ls -alh /bin/sh

 Try to compile again your project, everything has to be OK now!
 


 
 







2 yorum: