从 Windows 到 Linux 的 C++ 交叉编译器 [英] C++ cross-compiler from Windows to Linux

查看:50
本文介绍了从 Windows 到 Linux 的 C++ 交叉编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何用户友好的工具可以从 Windows 交叉编译到 Linux?

Are there any user friendly tools out there to cross-compile from Windows to Linux?

推荐答案

crosstool-ng 支持使用 cygwin 主机构建交叉编译器.

概述:

  • 使用开发包安装 cygwin
  • 下载crosstool-ng
  • 解压压缩包 (tar xvjf crosstool-ng*)
  • 运行./configure
  • 当 configure 提示缺少工具时,返回 cygwin setup 并安装相应的包(例如 flexlibtoolncurses-devel>) 您至少需要以下内容:
    • 开发/gperf
    • 开发/野牛
    • 开发/byacc
    • 开发/wget
    • 开发/补丁
    • 开发/制作(GNU 版本)
    • 开发/自动制作 1.10+
    • 库/libncursesw10
    • 库/libncursesw10-devel
    • Install cygwin, with development packages
    • Download crosstool-ng
    • Extract the tarball (tar xvjf crosstool-ng*)
    • Run ./configure
    • When configure complains about a missing tool, go back to cygwin setup and install the corresponding package (e.g. flex, libtool, ncurses-devel) You'll need at least the following:
      • Devel/gperf
      • Devel/bison
      • Devel/byacc
      • Devel/wget
      • Devel/patch
      • Devel/make (GNU version)
      • Devel/automake 1.10+
      • Libs/libncursesw10
      • Libs/libncursesw10-devel
      • the _libintl_gettext error as mentioned in the comments
      • the byteshift headers, and
      • the ELF headers (Thanks Duncan Calvert & osm0sis)

      当然,这不会使您能够从 Visual Studio 内部构建 linux 应用程序.(VS2010 及更高版本允许您使用其他工具链(例如 gcc)进行构建,但是除了由 crosstool-ng 构建的交叉编译器之外,您还需要适当的工具链描述).但是您将拥有一个有效的 g++-linux-gnu,您可以直接运行或使用 Makefile.

      Of course, this is NOT going to enable you to build linux applications from inside Visual Studio. (VS2010 and later let you build with other toolchains such as gcc, but you'd need an appropriate toolchain description in addition to the cross-compiler built by crosstool-ng). But you'll have a working g++-linux-gnu, which you can either run directly or using a Makefile.

      注意:构建交叉编译器需要很长时间.osm0sis 提供了这里提供了一个预构建的 gcc 4.8.1,以及他关于构建交叉编译器的笔记(用于更新此答案).

      NOTE: Building the cross-compiler takes a LONG time. osm0sis has provided a prebuilt gcc 4.8.1 here, along with his notes on building the cross-compiler (used to update this answer).

      这篇关于从 Windows 到 Linux 的 C++ 交叉编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆