Cross compile Window from Unix/Mac os

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Cross compile Window from Unix/Mac os

Jean Baptiste Arnaud
 
Since the last Igor ( thank ) update it 's possible to cross compile windows VM(last version) from MacOs and Unix.

Using Mingw and cmake.

Now, i do for Cog, and for ARM9 processor.
My process imply to fix some window file cause some include are wrong, then it the cross compiler don't find some include beginning by Uppercase(cause the file isn't beginning by uppercase).
In /Platform/win32/vm/sqWin32Intel.c

#include <float.h> instead  #include <Float.h>

in /Platform/win32/plugin/SocketPlugin/sqWin32NewNet.c

#include <ws2tcpip.h> instead #include <Ws2tcpip.h>



Regard
Jean Baptiste Arnaud




Reply | Threaded
Open this post in threaded view
|

Re: Cross compile Window from Unix/Mac os

stephane ducasse-2

Jb this is a really exciting and cool news. We could use that approach to generate more vms. :)
Now it would be good that you take a breath and read your mails before sending them :)
One subject, one verb, one complement. this is basic but it works :)

Stef


On Jul 7, 2011, at 7:07 PM, Jean Baptiste Arnaud wrote:

> Since the last Igor ( thank ) update it 's possible to cross compile windows VM(last version) from MacOs and Unix.
>
> Using Mingw and cmake.
>
> Now, i do for Cog, and for ARM9 processor.
> My process imply to fix some window file cause some include are wrong, then it the cross compiler don't find some include beginning by Uppercase(cause the file isn't beginning by uppercase).
> In /Platform/win32/vm/sqWin32Intel.c
>
> #include <float.h> instead  #include <Float.h>
>
> in /Platform/win32/plugin/SocketPlugin/sqWin32NewNet.c
>
> #include <ws2tcpip.h> instead #include <Ws2tcpip.h>
>
>
>
> Regard
> Jean Baptiste Arnaud
> [hidden email]
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Cross compile Window from Unix/Mac os

Igor Stasenko
In reply to this post by Jean Baptiste Arnaud

On 7 July 2011 20:07, Jean Baptiste Arnaud <[hidden email]> wrote:

>
> Since the last Igor ( thank ) update it 's possible to cross compile windows VM(last version) from MacOs and Unix.
> Using Mingw and cmake.
> Now, i do for Cog, and for ARM9 processor.
> My process imply to fix some window file cause some include are wrong, then it the cross compiler don't find some include beginning by Uppercase(cause the file isn't beginning by uppercase).
> In /Platform/win32/vm/sqWin32Intel.c
> #include <float.h> instead  #include <Float.h>
> in /Platform/win32/plugin/SocketPlugin/sqWin32NewNet.c
> #include <ws2tcpip.h> instead #include <Ws2tcpip.h>
>
>

Yes, the cross-compilation is one of the reasons to use cmake.

And thanks for finding these glitches.



--
Best regards,
Igor Stasenko AKA sig.
Reply | Threaded
Open this post in threaded view
|

Re: Cross compile Window from Unix/Mac os

Mariano Martinez Peck
 
Should these changes be commited to blessed/svn?

On Fri, Jul 8, 2011 at 1:54 AM, Igor Stasenko <[hidden email]> wrote:

On 7 July 2011 20:07, Jean Baptiste Arnaud <[hidden email]> wrote:
>
> Since the last Igor ( thank ) update it 's possible to cross compile windows VM(last version) from MacOs and Unix.
> Using Mingw and cmake.
> Now, i do for Cog, and for ARM9 processor.
> My process imply to fix some window file cause some include are wrong, then it the cross compiler don't find some include beginning by Uppercase(cause the file isn't beginning by uppercase).
> In /Platform/win32/vm/sqWin32Intel.c
> #include <float.h> instead  #include <Float.h>
> in /Platform/win32/plugin/SocketPlugin/sqWin32NewNet.c
> #include <ws2tcpip.h> instead #include <Ws2tcpip.h>
>
>

Yes, the cross-compilation is one of the reasons to use cmake.

And thanks for finding these glitches.



--
Best regards,
Igor Stasenko AKA sig.



--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Cross compile Window from Unix/Mac os

Igor Stasenko

On 12 July 2011 10:49, Mariano Martinez Peck <[hidden email]> wrote:
>
> Should these changes be commited to blessed/svn?
of course. AFAIS Eliot already did it.

>
> On Fri, Jul 8, 2011 at 1:54 AM, Igor Stasenko <[hidden email]> wrote:
>>
>> On 7 July 2011 20:07, Jean Baptiste Arnaud <[hidden email]> wrote:
>> >
>> > Since the last Igor ( thank ) update it 's possible to cross compile windows VM(last version) from MacOs and Unix.
>> > Using Mingw and cmake.
>> > Now, i do for Cog, and for ARM9 processor.
>> > My process imply to fix some window file cause some include are wrong, then it the cross compiler don't find some include beginning by Uppercase(cause the file isn't beginning by uppercase).
>> > In /Platform/win32/vm/sqWin32Intel.c
>> > #include <float.h> instead  #include <Float.h>
>> > in /Platform/win32/plugin/SocketPlugin/sqWin32NewNet.c
>> > #include <ws2tcpip.h> instead #include <Ws2tcpip.h>
>> >
>> >
>>
>> Yes, the cross-compilation is one of the reasons to use cmake.
>>
>> And thanks for finding these glitches.
>>
>>
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
>
>



--
Best regards,
Igor Stasenko AKA sig.
Reply | Threaded
Open this post in threaded view
|

Re: Cross compile Window from Unix/Mac os

Mariano Martinez Peck
In reply to this post by Jean Baptiste Arnaud
 
Hi JB. Could you please tell me how should I run cmake to build for windows? Is there a specific generator?  because if I run:

cmake --help

at the end the only generators I see are:

Generators

The following generators are available on this platform:
  Unix Makefiles              = Generates standard UNIX makefiles.
  Xcode                       = Generate XCode project files.
  CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
  Eclipse CDT4 - Unix Makefiles
                              = Generates Eclipse CDT 4.0 project files.
  KDevelop3                   = Generates KDevelop 3 project files.
  KDevelop3 - Unix Makefiles  = Generates KDevelop 3 project files.



Thanks!

On Thu, Jul 7, 2011 at 7:07 PM, Jean Baptiste Arnaud <[hidden email]> wrote:
 
Since the last Igor ( thank ) update it 's possible to cross compile windows VM(last version) from MacOs and Unix.

Using Mingw and cmake.

Now, i do for Cog, and for ARM9 processor.
My process imply to fix some window file cause some include are wrong, then it the cross compiler don't find some include beginning by Uppercase(cause the file isn't beginning by uppercase).
In /Platform/win32/vm/sqWin32Intel.c

#include <float.h> instead  #include <Float.h>

in /Platform/win32/plugin/SocketPlugin/sqWin32NewNet.c

#include <ws2tcpip.h> instead #include <Ws2tcpip.h>



Regard
Jean Baptiste Arnaud








--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Cross compile Window from Unix/Mac os

Igor Stasenko

On 12 December 2011 16:33, Mariano Martinez Peck <[hidden email]> wrote:
>
> Hi JB. Could you please tell me how should I run cmake to build for windows? Is there a specific generator?  because if I run:
>
since you cross-compiling under unix, you use unix makefiles, which is default.
but to generate windows executable, you need different settings in cmake config.
like different compilation target (win32 executable, not ELF) etc.

JB could tell you more :)

> cmake --help
>
> at the end the only generators I see are:
>
> Generators
>
> The following generators are available on this platform:
>   Unix Makefiles              = Generates standard UNIX makefiles.
>   Xcode                       = Generate XCode project files.
>   CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
>   Eclipse CDT4 - Unix Makefiles
>                               = Generates Eclipse CDT 4.0 project files.
>   KDevelop3                   = Generates KDevelop 3 project files.
>   KDevelop3 - Unix Makefiles  = Generates KDevelop 3 project files.
>
>
>
> Thanks!
>
> On Thu, Jul 7, 2011 at 7:07 PM, Jean Baptiste Arnaud <[hidden email]> wrote:
>>
>>
>> Since the last Igor ( thank ) update it 's possible to cross compile windows VM(last version) from MacOs and Unix.
>>
>> Using Mingw and cmake.
>>
>> Now, i do for Cog, and for ARM9 processor.
>> My process imply to fix some window file cause some include are wrong, then it the cross compiler don't find some include beginning by Uppercase(cause the file isn't beginning by uppercase).
>> In /Platform/win32/vm/sqWin32Intel.c
>>
>> #include <float.h> instead  #include <Float.h>
>>
>> in /Platform/win32/plugin/SocketPlugin/sqWin32NewNet.c
>>
>> #include <ws2tcpip.h> instead #include <Ws2tcpip.h>
>>
>>
>>
>> Regard
>> Jean Baptiste Arnaud
>> [hidden email]
>>
>>
>>
>>
>>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
>



--
Best regards,
Igor Stasenko.
Reply | Threaded
Open this post in threaded view
|

Re: Cross compile Window from Unix/Mac os

Jean Baptiste Arnaud
 
Cmake is really simple but you need to generate  from a specific configuration that shouldnt get information about compilation from the system but from a toolchain :

You have choice change the File generated :  by removing the line include(CMakeDetermineSystem) "it is baaaaad"
or change the printHeader method to take care about the cross compilation in CMakeGenerator, (maybe Igor have already fix this)

CMakeGenerator>>#printHeader
self puts: '# This is automatically generated file using ', self configurationName, ' on ',
Date current asString, ' ' , Time current asString;
puts: 'cmake_minimum_required(VERSION 2.6.2)'.
self config requiresDetermineSystem ifTrue: [
self puts: 'include(CMakeDetermineSystem)'.
]

and add in CPlatformConfig

A method :
CPlatformConfig>>#requiresDetermineSystem
^true

Create a WindowConfiguration as you wish and create a method 

MyWindowConfiguration>>#requiresDetermineSystem
^false

OK here your source and CMake infrastructure is correct.
You need a cross compiler i use the mingw32
So you need to create your MyToolchain.cmake, just copy past the following code (change the compiler if needed).

"
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_C_COMPILER i386-mingw32-gcc)
SET(CMAKE_CXX_COMPILER i386-mingw32-g++)
SET(CMAKE_RC_COMPILER i386-mingw32-windres)

# It should be everything in VM platform if it is not the case uncomment all this line.
#SET(CMAKE_FIND_ROOT_PATH where you install mingw32)
#SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
#SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
#SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
"

A generate your source and do : 
cmake -DMAKE_TOOLCHAIN_FILE=MyToolchain.cmake
and make
that should work :

Possible error : 
CMAKE_RC_COMPILER maybe not automatically call, if that happen check the #extraVMSettings: in your configuration and change the
[...]
maker cmd: 'add_custom_command' params: 'OUTPUT ', res ,
'
COMMAND windres --include-dir ${targetPlatform}/misc -D_WIN32 -i ${buildDir}/Cog.rc -o ', res , '
COMMENT "Generating resource file..."
'.
[...]
Should be change in :
[...]
maker cmd: 'add_custom_command' params: 'OUTPUT ', res ,
'
COMMAND  i386-mingw32-windres --include-dir ${targetPlatform}/misc -D_WIN32 -i ${buildDir}/Cog.rc -o ', res , '
COMMENT "Generating resource file..."
'.
[...]

PS: i have a old version on my repository (JBARepo) under the CMakerVMMaker, but it is completely deprecated  CMakeVMMaker-jb.121.
PPS : I wish update this code but never spend the time
PPPS: I am available on skype if you want to discuss that.



On Dec 12, 2011, at 4:42 PM, Igor Stasenko wrote:


On 12 December 2011 16:33, Mariano Martinez Peck <[hidden email]> wrote:

Hi JB. Could you please tell me how should I run cmake to build for windows? Is there a specific generator?  because if I run:

since you cross-compiling under unix, you use unix makefiles, which is default.
but to generate windows executable, you need different settings in cmake config.
like different compilation target (win32 executable, not ELF) etc.

JB could tell you more :)

cmake --help

at the end the only generators I see are:

Generators

The following generators are available on this platform:
  Unix Makefiles              = Generates standard UNIX makefiles.
  Xcode                       = Generate XCode project files.
  CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
  Eclipse CDT4 - Unix Makefiles
                              = Generates Eclipse CDT 4.0 project files.
  KDevelop3                   = Generates KDevelop 3 project files.
  KDevelop3 - Unix Makefiles  = Generates KDevelop 3 project files.



Thanks!

On Thu, Jul 7, 2011 at 7:07 PM, Jean Baptiste Arnaud <[hidden email]> wrote:


Since the last Igor ( thank ) update it 's possible to cross compile windows VM(last version) from MacOs and Unix.

Using Mingw and cmake.

Now, i do for Cog, and for ARM9 processor.
My process imply to fix some window file cause some include are wrong, then it the cross compiler don't find some include beginning by Uppercase(cause the file isn't beginning by uppercase).
In /Platform/win32/vm/sqWin32Intel.c

#include <float.h> instead  #include <Float.h>

in /Platform/win32/plugin/SocketPlugin/sqWin32NewNet.c

#include <ws2tcpip.h> instead #include <Ws2tcpip.h>



Regard
Jean Baptiste Arnaud
[hidden email]








--
Mariano
http://marianopeck.wordpress.com





--
Best regards,
Igor Stasenko.

Regard
Jean Baptiste Arnaud




Reply | Threaded
Open this post in threaded view
|

Re: Cross compile Window from Unix/Mac os

Mariano Martinez Peck
 
Thanks JB for all your info. I soon as I have some free time I will try it :)


On Mon, Dec 12, 2011 at 9:36 PM, Jean Baptiste Arnaud <[hidden email]> wrote:
 
Cmake is really simple but you need to generate  from a specific configuration that shouldnt get information about compilation from the system but from a toolchain :

You have choice change the File generated :  by removing the line include(CMakeDetermineSystem) "it is baaaaad"
or change the printHeader method to take care about the cross compilation in CMakeGenerator, (maybe Igor have already fix this)

CMakeGenerator>>#printHeader
self puts: '# This is automatically generated file using ', self configurationName, ' on ',
Date current asString, ' ' , Time current asString;
puts: 'cmake_minimum_required(VERSION 2.6.2)'.
self config requiresDetermineSystem ifTrue: [
self puts: 'include(CMakeDetermineSystem)'.
]

and add in CPlatformConfig

A method :
CPlatformConfig>>#requiresDetermineSystem
^true

Create a WindowConfiguration as you wish and create a method 

MyWindowConfiguration>>#requiresDetermineSystem
^false

OK here your source and CMake infrastructure is correct.
You need a cross compiler i use the mingw32
So you need to create your MyToolchain.cmake, just copy past the following code (change the compiler if needed).

"
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_C_COMPILER i386-mingw32-gcc)
SET(CMAKE_CXX_COMPILER i386-mingw32-g++)
SET(CMAKE_RC_COMPILER i386-mingw32-windres)

# It should be everything in VM platform if it is not the case uncomment all this line.
#SET(CMAKE_FIND_ROOT_PATH where you install mingw32)
#SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
#SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
#SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
"

A generate your source and do : 
cmake -DMAKE_TOOLCHAIN_FILE=MyToolchain.cmake
and make
that should work :

Possible error : 
CMAKE_RC_COMPILER maybe not automatically call, if that happen check the #extraVMSettings: in your configuration and change the
[...]
maker cmd: 'add_custom_command' params: 'OUTPUT ', res ,
'
COMMAND windres --include-dir ${targetPlatform}/misc -D_WIN32 -i ${buildDir}/Cog.rc -o ', res , '
COMMENT "Generating resource file..."
'.
[...]
Should be change in :
[...]
maker cmd: 'add_custom_command' params: 'OUTPUT ', res ,
'
COMMAND  i386-mingw32-windres --include-dir ${targetPlatform}/misc -D_WIN32 -i ${buildDir}/Cog.rc -o ', res , '
COMMENT "Generating resource file..."
'.
[...]

PS: i have a old version on my repository (JBARepo) under the CMakerVMMaker, but it is completely deprecated  CMakeVMMaker-jb.121.
PPS : I wish update this code but never spend the time
PPPS: I am available on skype if you want to discuss that.



On Dec 12, 2011, at 4:42 PM, Igor Stasenko wrote:


On 12 December 2011 16:33, Mariano Martinez Peck <[hidden email]> wrote:

Hi JB. Could you please tell me how should I run cmake to build for windows? Is there a specific generator?  because if I run:

since you cross-compiling under unix, you use unix makefiles, which is default.
but to generate windows executable, you need different settings in cmake config.
like different compilation target (win32 executable, not ELF) etc.

JB could tell you more :)

cmake --help

at the end the only generators I see are:

Generators

The following generators are available on this platform:
  Unix Makefiles              = Generates standard UNIX makefiles.
  Xcode                       = Generate XCode project files.
  CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
  Eclipse CDT4 - Unix Makefiles
                              = Generates Eclipse CDT 4.0 project files.
  KDevelop3                   = Generates KDevelop 3 project files.
  KDevelop3 - Unix Makefiles  = Generates KDevelop 3 project files.



Thanks!

On Thu, Jul 7, 2011 at 7:07 PM, Jean Baptiste Arnaud <[hidden email]> wrote:


Since the last Igor ( thank ) update it 's possible to cross compile windows VM(last version) from MacOs and Unix.

Using Mingw and cmake.

Now, i do for Cog, and for ARM9 processor.
My process imply to fix some window file cause some include are wrong, then it the cross compiler don't find some include beginning by Uppercase(cause the file isn't beginning by uppercase).
In /Platform/win32/vm/sqWin32Intel.c

#include <float.h> instead  #include <Float.h>

in /Platform/win32/plugin/SocketPlugin/sqWin32NewNet.c

#include <ws2tcpip.h> instead #include <Ws2tcpip.h>



Regard
Jean Baptiste Arnaud
[hidden email]








--
Mariano
http://marianopeck.wordpress.com





--
Best regards,
Igor Stasenko.

Regard
Jean Baptiste Arnaud








--
Mariano
http://marianopeck.wordpress.com