<div dir="ltr">On Mon, Jun 10, 2013 at 2:06 PM, Matthew Woehlke <span dir="ltr"><<a href="mailto:matthew.woehlke@kitware.com" target="_blank">matthew.woehlke@kitware.com</a>></span> wrote:<br><div class="gmail_extra">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">On 2013-06-10 04:52, setareh S wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Now, I want to build my code for Linux platform(GNU/Linux) on a Win32<br>
platform. I tried doing the above procedure using CMake combined with<br>
Cygwin and using gcc and g++ as compilers. It built fine, created<br>
makefiles, and when I issued "make" in Cygwin terminal, the generated<br>
makefiles were "made". Now I have got an executable which I was hoping<br>
would run on Linux platform. But on Linux I get the error: bash cannot<br>
execute binary file.<br>
<br>
Using command file executablename, I realized the executable which is made<br>
by the above procedure is of type PE32 which is only for Windows.<br>
</blockquote>
<br>
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.<br></blockquote><div><br></div><div style="font-family:arial,sans-serif;font-size:13px">
DISCLAIMER: I'm not that familiar with cross-compiling BUT...</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">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. </div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">If you really want to do it then take a look here:</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px"><a href="http://stackoverflow.com/questions/4769968/c-cross-compiler-from-windows-to-linux" target="_blank">http://stackoverflow.com/questions/4769968/c-cross-compiler-from-windows-to-linux</a></div>
<div><img class="" src="https://mail.google.com/mail/ca/u/0/images/cleardot.gif" style="line-height: 6px; font-family: arial, sans-serif; font-size: 13px;"></div><div style>Richard</div></div></div></div>