On Mon, Jun 10, 2013 at 2:06 PM, Matthew Woehlke <
[email protected]> wrote:

> On 2013-06-10 04:52, setareh S wrote:
>
>> Now, I want to build my code for Linux platform(GNU/Linux) on a Win32
>> platform. I tried doing the above procedure using CMake combined with
>> Cygwin and using gcc and g++ as compilers. It built fine, created
>> makefiles, and when I issued "make" in Cygwin terminal, the generated
>> makefiles were "made". Now I have got an executable which I was hoping
>> would run on Linux platform. But on Linux I get the error: bash cannot
>> execute binary file.
>>
>> Using command file executablename, I realized the executable which is made
>> by the above procedure is of type PE32 which is only for Windows.
>>
>
> Are the compilers you are using cross-compilers, or the ones that came
> with cygwin? The normal cygwin gcc/g++ compilers target cygwin on win32 and
> are not cross-compilers.
>

DISCLAIMER: I'm not that familiar with cross-compiling BUT...

I think in general cross compiling from windows to linux is a bad idea.
Most distro's prefer to use the system installed libraries to build with
and link to, which you will not be able to do which pretty much leaves a
100% static build.

If you really want to do it then take a look here:

http://stackoverflow.com/questions/4769968/c-cross-compiler-from-windows-to-linux
Richard
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to