ubuntu下mingw32交叉编译环境搭建

一、安装 mingw32c++

      sudo gedit /etc/apt/sources.listgit

      //在sources.list末尾添加,保存ubuntu

      deb http://us.archive.ubuntu.com/ubuntutrusty main universe工具

      sudo apt-get updateflex

      sudo apt-get install mingw32es5

 

二、安装 准备环境debug

   apt-get install mingw32 dpkg-dev pkg-config wget libglib2.0-dev unziplibtool automake autoconf m4 gettext cvs flex bison wine git-core subversionpatchip

 

三、安装64位支持库get

   sudo apt install libc6:i386编译器

   sudo apt install libstdc++6:i386

    或者直接安装gcc-multilib解决问题(推荐使用此方法)

   sudo apt install gcc-multilib

 

四、安装库

    问题:安装好交叉编译器后,输入命令却出现 “没有那个文件或目录”

      缘由是交叉编译器通常是32位的,而64位系统缺乏一些32位库的支持,因此须要安装32位库。

    解决方法:

   sudo  apt-get installlib32ncurses5 lib32z1

 

五、安装编译软件autotools系列工具

sudo apt-getinstall autoconf

 

六、安装libtool

sudo apt-getinstall libtool

 

七、装对应平台gcc

sudo apt-getinstall  i686-w64-mingw32-gcc

 

八、安装库

      sudo apt-get install gawk

      sudo apt-get install bison

      apt-get update 或者加上--fix-missing

      sudo apt-get install byacc

      sudo apt-get install flex

 

九、编译configure

   autoscan (可选)

   aclocal

   autoconf

   autoheader(可选)

   libtoolize --automake --copy --debug --force(可选)

   automake --add-missing

   autoreconf –f –i –Wall,no–obsolete(可选)

./configure