用英特尔编译器进行跨平台编译

来源:互联网 发布:单片机有哪些类型 编辑:程序博客网 时间:2024/06/06 08:56

最近,有些工程师使用英特尔C/C++编译器在64位机器上编译32位的应用程序时,遇到了一些问题;例如:安装完32位和64位编译器后,使用 -m32编译选项无法工作;另外,有些人想知道是否在32位机器上能编译64位应用程序?等等相关问题。

 

为了方便,我将有关信息总结如下:

 

首先,还是让我们看看用户手册上是如何定义和说明有关 m32 m64选项的吧!

 

m32, m64

Tells the compiler to generate code for a specific architecture.

通知编译器生成用户说明的特殊架构的机器代码

IDE Equivalent

相应的IDE环境

None

Architectures

目前支持的架构

IA-32, Intel® 64 architectures

IA-32Intel® 64架构

Syntax

语法说明

Linux and Mac OS X:

-m32

-m64

 

Windows:

None(无)

Arguments

参数

None (无)

Default

缺省值

OFF

The compiler's behavior depends on the host system.

编译器的行为依赖主机系统的架构

Description

详细描述

These options tell the compiler to generate code for a specific architecture.

以下这些编译选项通知编译器生成一种说明的特殊架构的机器代码

Option

编译选项

Description

详细描述

-m32

Tells the compiler to generate code for IA-32 architecture.

通知编译器生成IA-32架构的代码

-m64

Tells the compiler to generate code for Intel® 64 architecture.

通知编译器生成Intel®-64架构的代码

The -m32 and -m64 options are the same as Mac OS* X options -arch i386 and -arch x86_64, respectively. Note that these options are provided for compatibility with gcc. They are not related to the Intel® C++ compiler option arch.

-m32-m64选项分别对应Mac OS* X系统里编译器选项的–arch i386 –arch x86_64。需要说明的是这些选项与gcc相兼容。他们和Intel® C++编译器选项中的arch无关。

 

如果你想使用上述特性开发自己的项目,你需要检查一下你的开发系统是否满足下面的要求(请参考Intel® C++ Compiler Professional Edition 11.1 for Linux Installation Guide and Release ntoes.pdf获取更详细的信息)

 

Requirements to development IA-32 architecture applications

开发IA-32架构应用程序的要求

l  A PC based on an IA-32 or Intel® 64 architecture processor supporting the Intel® Streaming SIMD Extensions 2(Intel® SSE2) instructions;

一台IA-32Intel® 64架构处理器的PC机,并且支持INTEL® Straming SIMD Extensions 2Intel®SSE2)指令集

l 

l  If developing on an Intel ®64 architecture system, some Linux distributions may require installation of one or more of the following additional Linux components: ia32-libs, lib32gcc1, lib32stdc++6, libc6-dev-i386, gcc-multilib

如果在Intel® 64架构系统上开发Linux程序,一些Linux包需要事先安装:ia32-libs, lib32gcc1, lib32stdc++6, libc6-dev-i386, gcc-multilib

 

Requirements to Develop Intel® 64 Architecture Applications

开发Intel® 64架构应用程序的要求

 

l  A PC based on an Intel® 64 architecture processor

一台Intel® 64架构处理器的PC

l 

l  Linux component containing 32-bit libraries(may be called is32-libs)

包含32-bit开发包的Linux组件(开发包是ia32-libs

 

MSVS2008MSVS2005上如何编译

 

我们看到相关的编译选项 –m32 –m64是在LinuxMac OS系统上的使用的,微软视窗系统开发环境并没有相关的说明。当我们使用MSVS2005MSVS2008开发相关系统时,在项目的配置管理员属性对话框里,通过设置当前结果平台参数完成是否生成Win32Win64的目标代码。

从上面的说明我们可以看到,到目前为止,系统并不支持在一台32位系统上编译64位的目标代码。这也是一些开发人员经常问到的问题。所以但我们计划开发相关块平台的项目时,尤其是不同架构的系统时,我们需要认真地检查一下我们开发的系统配置是否支持相关工作的开发。

 

希望上述总结能方便相关信息的查找和说明!

原创粉丝点击