简体   繁体   English

如何从Windows为Amazon的EC2 CentOS 5编译c ++应用程序?

[英]How to compile c++ apps from Windows for Amazon's EC2 CentOS 5?

I want to compile c++ apps (x32 and x64) from scripts in Windows for executing in Amazon EC2 Linux AMI. 我想从Windows中的脚本编译c ++应用程序(x32和x64),以便在Amazon EC2 Linux AMI中执行。 Linux AMI is based on CentOS 5. So i need toolchain for CentOS in Windows. Linux AMI基于CentOS5。因此,我需要Windows中CentOS的工具链。 I never compile apps for Linux from Windows so i am needed little help. 我从不从Windows编译Linux的应用程序,所以我几乎不需要帮助。 What i need to do? 我需要做什么? What is best for me: MinGW or Cygwin? 最适合我的是:MinGW或Cygwin? Do i need to copy include folders of devel packages for standard libs (libstdc++, glibc or other)? 我是否需要为标准库(libstdc ++,glibc或其他)复制devel软件包的include文件夹? I already copied include folders of compiled Qt 4.7.x (i compiled it inside running EC2 instance). 我已经复制了已编译Qt 4.7.x的包含文件夹(我在运行的EC2实例中对其进行了编译)。 What options i need to specify inside .pro files for compile qt apps in Windows for Linux? 我需要在.pro文件中指定哪些选项才能在Windows for Linux中编译qt应用程序? I am using only qt-core and qt-network. 我只使用qt-core和qt-network。 All apps are command line apps 所有应用都是命令行应用

I strongly recommend installing Linux (a distribution similar to what Amazon gives you) inside a virtual machine on your Windows machine. 强烈建议在Windows机器上的虚拟机中安装Linux (类似于Amazon提供的发行版)。 It is probably much simpler and quicker than trying to build a cross-compiler, cross-compile a GNU libc, cross-compile a Qt, etc... 它可能比尝试构建交叉编译器,交叉编译GNU libc,交叉编译Qt等更加简单快捷。

MinGW (or Cygwin) is not a cross-compiler on Windows targeting Linux, it is a native compiler (with a sort of Posix emulator library). MinGW(或Cygwin)不是针对Linux的Windows上的交叉编译器,它是本机编译器(带有某种Posix仿真器库)。 It is not able to produce Linux ELF executables on Windows. 它无法在Windows上生成Linux ELF可执行文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM