Is it possible to use the Intel C/C++ compiler on Linux to create object files to be linked on Windows?

Why?

Depending on your source the Intel compiler is likely or most definitely the compiler generating the fastest executables for the x86 architecture (5 to 100 % execution time improvement).

Intel offers its compilers for Linux under a non-commercial license for free (I think I read it is free somewhere on their page: Intel – Non-Commercial Software Development).
There is also a free non-commercial license for students, but this license is not applicable although tools are offered for all three major operating systems (link dropped due to reputation restriction).

Goal

I (as a non-student) would like to be able to use the Intel compilers for possible execution speed improvements under the non-commercial license to compile object files that can be linked to create executables and dynamic link libraries for Windows (and possibly OS X)

More Details:

What I inferred from this document is that the Intel compilers create object files that are compatible to the dominant compilers of the platform.

Sub-questions:

  1. What are the object file formats of gcc, g++, cl, mingw32, icc, icpc, and icl on Windows and Linux (current versions)?
  2. Could parts of the mingw32 cross-compiler toolchain be used to accomplish the goal?
  3. Am I right that the metadata in the generated object files is the main issue?

ad 2:
mingw32-objcopy seems to be able to convert the Intel compiler output on Linux (presumably ELF) to Microsoft-compatible COFF (with the possible exception of relocateable object files). Could someone confirm that this actually works (for non-trivial applications), please?

6

It is possible to create Windows executables on a Linux build machine by using a cross-compiler. But, Intel does not provide such cross compilers.

To answer the sub-questions:

What are the object file formats of gcc, g++, cl, mingw32, icc, icpc, and icl on Windows and Linux (current versions)?

The format for the object files is effectively determined by the operating system (or rather, the compiler used to build it). For Windows, this is the Portable Executable (PE) format and for Linux the ELF format.

Could parts of the mingw32 cross-compiler toolchain be used to accomplish the goal?

No. The relevant part is the code generator, which is both the part responsible for generating the right object format and the part on the Intel compilers that gives their generated code the speed edge.

Am I right that the metadata in the generated object files is the main issue?

No. It is one issue, but there are more. A more fundamental problem is the potential difference in how parameters are passed to the kernel and/or standard library. IIRC, those conventions are different between Windows and Linux.

The answer is almost certainly yes. I know that cross-compiling Windows binaries (via mingw32) on a Linux box is easily possible using gcc – obviously you won’t be able to run the program on Linux (unless it works under Wine), but I know several programs that get Windows binaries this way.

However, I don’t know if the Intel compiler has the options for this, I should think it does.

The object format for Windows is PE, whereas for Linux its ELF.

2

With C code linking to nothing (directly) that uses Microsoft’s custom calling conventions, you might stand a chance using MinGW’s objcopy. I have used it to convert an assembled object file, but then I didn’t have to worry about calling conventions.

I would just spend the time you would trying to do this instead getting GCC or clang to do exactly what you want. If such a speed up is really that important compile a Linux binary with the Intel compiler and try to see exactly what, if anything at all, it does speeding up your code. You can patch the assembly if all else fails.

I propose the following answer:

A definite maybe (leaning towards yes) with a but regarding the context.

Explanation:
Regarding the “leaning” part: It seems to not be a total waste of time to try this, but (the “put” part) taking into account this answer you likely won’t get the execution time improvements compared to an Intel-only toolchain. The relevant part being linker and runtime feedback to the compiler (whole program optimization, profile-guided optimization, link-time code generation).

Additional detail:
According to the MinGW FAQ there are possible problems with using libraries and DLLs:
“Although dlls are supposed to be fairly portable across different Windows compilers, accessing dlls through a library file (.lib or .a) is not. The library file formats are specific to particular compilers and cannot be used portably with different compilers unless the compiler provides support for it.”

To complete the answer:
sub-question 1:

What are the object file formats of gcc, g++, cl, mingw32, icc, icpc, and icl on Windows and Linux (current versions)?

The default object file format for any compiler on Windows is COFF (likely the PE variant).
The default object file format for any compiler on Linux is ELF

sub-question 2:

Could parts of the mingw32 cross-compiler toolchain be used to accomplish the goal?

Most likely yes (for the linking part), but most likely you will not get much execution time improvement.

sub-question 3:

Am I right that the metadata in the generated object files is the main issue?

Regarding linking: yes.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật