制作交叉工具链(龙芯)

2024-04-21 13:58
文章标签 工具 制作 龙芯 交叉

本文主要是介绍制作交叉工具链(龙芯),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

系统环境:ubuntu10.04 + gcc-4.3.3

所需软件:
Binutils 2.20: http://ftp.gnu.org/gnu/binutils/binutils-2.20.tar.bz2
GCC Core 4.4.2: http://ftp.gnu.org/gnu/gcc/gcc-4.4.2/gcc-core-4.4.2.tar.bz2 

Binutils 2.20 Loongson2f 补丁 binutils-2.20-loongson2f.zip   

设置环境变量和新建目录

$ mkdir -p /opt/loongson-cross-tools/usr/{bin, lib, share}

$ echo "PATH=$PATH:/opt/loongson-cross-tools/usr/bin" >> ~/.bashrc

编译 Binutils: 

$ tar xjf binutils-2.20.tar.bz2

$ cd binutils-2.20

$ patch -Np1 -i ../binutils-2.20-loongson2f.patch   //这步没做,没有找到patch

$ cd .. && mkdir binutils-build && cd binutils-build

$ ../binutils-2.20/configure --prefix=/opt/loongson-cross-tools/usr --target=mipsel-pc-linux-gnu --with-sysroot=/opt/loongson-cross-tools --enable-64-bit-bfd --disable-nls --enable-shared

$ make configure-host

$ make

$ make install

出错信息:

        rm -rf $backupdir; exit $rc

WARNING: `makeinfo' is missing on your system.  You should only need it if

         you modified a `.texi' or `.texinfo' file, or any other file

         indirectly affecting the aspect of the manual.  The spurious

         call might also be the consequence of using a buggy `make' (AIX,

         DU, IRIX).  You might want to install the `Texinfo' package or

         the `GNU make' package.  Grab either from any GNU archive site.

make[4]: *** [as.info] Error 1

make[4]: Leaving directory `/home/loongson/loongson-cross-tool/binutils-build/gas/doc'

make[3]: *** [install-am] Error 2

make[3]: Leaving directory `/home/loongson/loongson-cross-tool/binutils-build/gas/doc'

Making install in po

make[3]: Entering directory `/home/loongson/loongson-cross-tool/binutils-build/gas/po'

make[3]: Nothing to be done for `install'.

make[3]: Leaving directory `/home/loongson/loongson-cross-tool/binutils-build/gas/po'

make[3]: Entering directory `/home/loongson/loongson-cross-tool/binutils-build/gas'

make[4]: Entering directory `/home/loongson/loongson-cross-tool/binutils-build/gas'

/bin/bash ../../binutils-2.20/gas/../mkinstalldirs /opt/loongson-cross-tools/usr/bin

 /bin/bash ./libtool  --mode=install /usr/bin/install -c as-new /opt/loongson-cross-tools/usr/bin/mipsel-pc-linux-gnu-as

libtool: install: /usr/bin/install -c .libs/as-new /opt/loongson-cross-tools/usr/bin/mipsel-pc-linux-gnu-as

/bin/bash ../../binutils-2.20/gas/../mkinstalldirs /opt/loongson-cross-tools/usr/mipsel-pc-linux-gnu/bin

n=`echo as | sed 's&^&mipsel-pc-linux-gnu-&'`; \

        if [ "/opt/loongson-cross-tools/usr/bin/$n" != "/opt/loongson-cross-tools/usr/mipsel-pc-linux-gnu/bin/as" ]; then \

          rm -f /opt/loongson-cross-tools/usr/mipsel-pc-linux-gnu/bin/as; \

          ln /opt/loongson-cross-tools/usr/bin/$n /opt/loongson-cross-tools/usr/mipsel-pc-linux-gnu/bin/as >/dev/null 2>/dev/null \

            || /bin/bash ./libtool --mode=install /usr/bin/install -c as-new /opt/loongson-cross-tools/usr/mipsel-pc-linux-gnu/bin/as; \

        else \

          true ; \

        fi

make[4]: Nothing to be done for `install-data-am'.

make[4]: Leaving directory `/home/loongson/loongson-cross-tool/binutils-build/gas'

make[3]: Leaving directory `/home/loongson/loongson-cross-tool/binutils-build/gas'

make[2]: *** [install-recursive] Error 1

make[2]: Leaving directory `/home/loongson/loongson-cross-tool/binutils-build/gas'

make[1]: *** [install-gas] Error 2

make[1]: Leaving directory `/home/loongson/loongson-cross-tool/binutils-build'

make: *** [install] Error 2

参考解决办法:

原因是本机没有安装texinfo,安装之后版本也不够高,顾修改configure文件

$ sudo apt-get install texinfo

$ makeinfo --version

makeinfo (GNU texinfo) 4.13

$ vim ../binuitl-2.20/configure

改成:

$ make install

编译 GCC: 

$ tar xjf gcc-core-4.4.2.tar.bz2

$ mkdir gcc-build  && cd gcc-build

$ ../gcc-4.4.2/configure --prefix=/opt/loongson-cross-tools/usr --target=mipsel-pc-linux-gnu --with-sysroot=/opt/loongson-cross-tools --disable-multilib --with-newlib --disable-nls --disable-shared --disable-threads --enable-languages=c --with-abi=64

出错信息:

configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.2+.

Try the --with-gmp and/or --with-mpfr options to specify their locations.

Copies of these libraries' source code can be found at their respective

hosting sites as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/.

See also http://gcc.gnu.org/install/prerequisites.html for additional info.

If you obtained GMP and/or MPFR from a vendor distribution package, make

sure that you have installed both the libraries and the header files.

They may be located in separate packages.

参考解决办法:

http://ftp.gnu.org/gnu/gmp/   #gmp下载

http://ftp.gnu.org/gnu/mpfr/  #mpfr下载

$ tar xf tar xf gmp-5.0.1.tar.bz2

$ tar xf mpfr-3.0.0.tar.bz2

$ mv gmp-5.0.1/ gmp 

$ mv mpfr-3.0.0/ mpfr 

$ mv gmp/ mpfr/ gcc-4.4.2/

$ cd gcc-build

$ ../gcc-4.4.2/configure --prefix=/opt/loongson-cross-tools/usr --target=mipsel-pc-linux-gnu --with-sysroot=/opt/loongson-cross-tools --disable-multilib --with-newlib --disable-nls --disable-shared --disable-threads --enable-languages=c --with-abi=64

$ make all-gcc

出错信息:

checking whether stripping libraries is possible... yes

checking if libtool supports shared libraries... yes

checking whether to build shared libraries... no

checking whether to build static libraries... yes

checking whether gcc __attribute__ ((mode (XX))) works... yes

checking for recent GMP... yes

checking for gmp internal files... configure: error: header files gmp-impl.h and longlong.h not found

make: *** [configure-mpfr] Error 1

参考解决办法:

mpfr3.0mpfr2.4.2

因为mpfr3.0改了默认路径(网上如此说)

$ tar xf mpfr-2.4.2.tar.bz2

$ mv mpfr-2.4.2/ mpfr 

$ rm gcc-4.4.2/mpfr

$ mv mpfr gcc-4.4.2

$ make all-gcc

$ make all-target-libgcc

$ make install-gcc

$ make install-target-libgcc

参考资料:

https://heiher.info/916.html

http://www.linuxsir.org/bbs/showthread.php?t=338748

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44455

http://blog.sina.com.cn/s/blog_4e9da0010100dhvk.html

<script type=text/javascript charset=utf-8 src="http://static.bshare.cn/b/buttonLite.js#style=-1&uuid=&pophcol=3&lang=zh"></script> <script type=text/javascript charset=utf-8 src="http://static.bshare.cn/b/bshareC0.js"></script>
阅读(356) | 评论(0) | 转发(0) |
0

上一篇:RGB24和YUV420旋转90度的源代码

下一篇:VC调试心得

相关热门文章
  • SecureCRT破解注意
  • PHP Extension开发基础
  • 安全全面可靠
  •   研究推进政府向社会力量购...
  • 【读者报料】
  • 承接自动化测试培训、外包、实...
  • Solaris PowerTOP 1.0 发布
  • For STKMonitor
  • busybox的httpd使用CGI脚本(Bu...
  • 项目小体会
  • 修改默认端口为222,centos自...
  • 用PHP做一个ftp登录页面...
  • Toad for Oracle工具,为什么在...
  • 本地win7安装vmw9系统winserv...
  • powermt config是所什么用的...
给主人留下些什么吧!~~
评论热议

这篇关于制作交叉工具链(龙芯)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/923257

相关文章

SQLite3命令行工具最佳实践指南

《SQLite3命令行工具最佳实践指南》SQLite3是轻量级嵌入式数据库,无需服务器支持,具备ACID事务与跨平台特性,适用于小型项目和学习,sqlite3.exe作为命令行工具,支持SQL执行、数... 目录1. SQLite3简介和特点2. sqlite3.exe使用概述2.1 sqlite3.exe

基于Python实现一个Windows Tree命令工具

《基于Python实现一个WindowsTree命令工具》今天想要在Windows平台的CMD命令终端窗口中使用像Linux下的tree命令,打印一下目录结构层级树,然而还真有tree命令,但是发现... 目录引言实现代码使用说明可用选项示例用法功能特点添加到环境变量方法一:创建批处理文件并添加到PATH1

使用jenv工具管理多个JDK版本的方法步骤

《使用jenv工具管理多个JDK版本的方法步骤》jenv是一个开源的Java环境管理工具,旨在帮助开发者在同一台机器上轻松管理和切换多个Java版本,:本文主要介绍使用jenv工具管理多个JD... 目录一、jenv到底是干啥的?二、jenv的核心功能(一)管理多个Java版本(二)支持插件扩展(三)环境隔

Python使用smtplib库开发一个邮件自动发送工具

《Python使用smtplib库开发一个邮件自动发送工具》在现代软件开发中,自动化邮件发送是一个非常实用的功能,无论是系统通知、营销邮件、还是日常工作报告,Python的smtplib库都能帮助我们... 目录代码实现与知识点解析1. 导入必要的库2. 配置邮件服务器参数3. 创建邮件发送类4. 实现邮件

CnPlugin是PL/SQL Developer工具插件使用教程

《CnPlugin是PL/SQLDeveloper工具插件使用教程》:本文主要介绍CnPlugin是PL/SQLDeveloper工具插件使用教程,具有很好的参考价值,希望对大家有所帮助,如有错... 目录PL/SQL Developer工具插件使用安装拷贝文件配置总结PL/SQL Developer工具插

Python使用FFmpeg实现高效音频格式转换工具

《Python使用FFmpeg实现高效音频格式转换工具》在数字音频处理领域,音频格式转换是一项基础但至关重要的功能,本文主要为大家介绍了Python如何使用FFmpeg实现强大功能的图形化音频转换工具... 目录概述功能详解软件效果展示主界面布局转换过程截图完成提示开发步骤详解1. 环境准备2. 项目功能结

Linux系统之stress-ng测压工具的使用

《Linux系统之stress-ng测压工具的使用》:本文主要介绍Linux系统之stress-ng测压工具的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、理论1.stress工具简介与安装2.语法及参数3.具体安装二、实验1.运行8 cpu, 4 fo

Maven项目中集成数据库文档生成工具的操作步骤

《Maven项目中集成数据库文档生成工具的操作步骤》在Maven项目中,可以通过集成数据库文档生成工具来自动生成数据库文档,本文为大家整理了使用screw-maven-plugin(推荐)的完... 目录1. 添加插件配置到 pom.XML2. 配置数据库信息3. 执行生成命令4. 高级配置选项5. 注意事

Python使用pynput模拟实现键盘自动输入工具

《Python使用pynput模拟实现键盘自动输入工具》在日常办公和软件开发中,我们经常需要处理大量重复的文本输入工作,所以本文就来和大家介绍一款使用Python的PyQt5库结合pynput键盘控制... 目录概述:当自动化遇上可视化功能全景图核心功能矩阵技术栈深度效果展示使用教程四步操作指南核心代码解析

如何基于Python开发一个微信自动化工具

《如何基于Python开发一个微信自动化工具》在当今数字化办公场景中,自动化工具已成为提升工作效率的利器,本文将深入剖析一个基于Python的微信自动化工具开发全过程,有需要的小伙伴可以了解下... 目录概述功能全景1. 核心功能模块2. 特色功能效果展示1. 主界面概览2. 定时任务配置3. 操作日志演示