# 3.7 龙芯编译环境配置

1.下载龙芯提供的编译环境配置压缩包gcc-4.3-ls232.tar.gz（[http://os.cs.tsinghua.edu.cn/oscourse/project/LoongsonCsprj2018）](http://os.cs.tsinghua.edu.cn/oscourse/project/LoongsonCsprj2018%EF%BC%89)

2.输入如下指令，将其加压至根目录

sudo tar -zxvf gcc-4.3-ls232.tar.gz -C /

3.打开home目录下的bashrc文件添加路径（没找着的话就在edit处将 show hidden file开启）找到export PATH = $PATH 这行，如果没有就在文件尾部新建

在末尾加上 gcc-4.3-ls232的路径，即 :/opt/gcc-4.3-ls232/bin

也可以通过命令添加路径 echo "export PATH=/opt/gcc-4.3-ls232/bin:$PATH" >> \~/.bashrc

4.对于64位系统还需要安装lsb-core，输入如下指令

sudo apt-get install lsb-core

完成上述工作后如果可以输入 mipsel-linux-gcc -v 命令，如果可以正确查看版本号则说明配置正确，编写一个test.s文件，使用如下命令编译mispel-linux-as test.s，得到a.out，mipsel-linux-objdump -d a.out 反编译，若上述步骤都走通，则编译环境配置成功。

对于lsb-core，如果安装失败。

输入如下指令

sudo dpkg --add-architecture i386

sudo apt-get update

sudo apt-get -f install lsb-core


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://oscourse-tsinghua.gitbook.io/loongsoncsprj2020-manual/ucore/long-xin-bian-yi-huan-jing-pei-zhi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
