Windows cross compilation

classic Classic list List threaded Threaded
53 messages Options
123
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Windows cross compilation

buttim
This post was updated on .
I'm having a hard time trying to cross compile OpenSCAD under Ubuntu for Windows.
I did manage to get executables in june, but recently I get the following error:

../src/LibraryInfo.cc:27:17: fatal error: zip.h: No such file or directory

Any good soul with an advice for me?
tp3
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

tp3
On 02/14/2017 12:09 AM, buttim wrote:
> I'm having a hard time trying to cross compile OpenSCAD under Ubuntu
> for Windows.
>
Is that cross compiling using MXE (like the official binaries are
compiled)?

> I did manage tio get executables in june, but recently I get the following
> error:
>
> ../src/LibraryInfo.cc:27:17: fatal error: zip.h: No such file or directory
>
This means it did detect libzip for some reason and set ENABLE_LIBZIP
but either the include path is wrong or it's not installed.

There is currently an build issue where the MXE build does not find
libzip, but that should just disable compression support, not fail
to build.
Actually I did run the cross build for master yesterday on our build
machine and that did run though.

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

buttim
You nailed it. Disabling zip in openscad.pro by commenting away the line

CONFIG += libzip

the compilation goes on (not finished yet but seems promising anyway).
Maybe a bug in the detection logic for zip support.
Worth opening a bug report?

tp3
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

tp3
On 02/14/2017 12:34 AM, buttim wrote:
> the compilation goes on (not finished yet but seems promising anyway).
> Maybe a bug in the detection logic for zip support.
> Worth opening a bug report?
>
Hmm, can you find out why it thinks it's there? As I didn't
have this so far, it will be hard to fix without additional
information.
Unless it will go away when fixing the other issue I mentioned,
but that does not seem too likely.

Maybe it's detecting the header installed on Linux instead of
just looking in the cross compilation env?

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

buttim
I swear I have no idea of how the different build tools work but, yes, I will definitely give it a try. At worse I will be of no help but will learn something (something I should have learned quite a time ago).

In the meantime another problem showed up. As I said compilation was going at full speed. So this time is the linker complaining:

/usr/bin/ld: unrecognized option '--stack'

tp3
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

tp3
On 02/14/2017 12:53 AM, buttim wrote:
> /usr/bin/ld: unrecognized option '--stack'
>
Now that sounds like it's running the wrong linker.

So back to the first question, how exactly are you doing the
cross compilation. It might case some mix-up of system native
and cross compilation.

The build server uses essentially:

export MXEDIR=/opt/mxe
. ./scripts/setenv-mingw-xbuild.sh 64
./scripts/release-common.sh -snapshot mingw64

Which does expect full MXE environment in /opt/mxe

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

buttim
This post was updated on .
I'm using the scripts provided:

source scripts/setenv-mingw-xbuild.sh
scripts/mingw-x-build-dependencies.sh

and then running qmake and make (the way I did a few months ago)

cd mingw32.static
qmake ../openscad.pro CONFIG+=mingw-cross-env
make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

buttim
For the firs issue regarding libzip I suspect the MXE builder script simply does not specify the libzip package.
I modified it adding libzip in 4 places and now it's downlaoding libzip and compiling it.

This actually solves the problem but creates a new one (oh my!)

../src/import_amf.cc:330:66: error: cannot convert 'const value_type* {aka const wchar_t*}' to 'const char*' for argument '2' to 'zip_file* zip_fopen(zip*, const char*, zip_flags_t)'
   zipfile = zip_fopen(archive, f.filename().c_str(), ZIP_FL_NODIR);
tp3
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

tp3
In reply to this post by buttim
On 02/14/2017 01:17 AM, buttim wrote:

> I'm using the scripts provided:
>
> source scripts/setenv-mingw-xbuild.sh
> scripts mingw-x-build-dependencies.sh
>
> and then running qmake and make (the way I did a few months ago)
>
> cd mingw32.static
> qmake ../openscad.pro CONFIG+=mingw-cross-env
> make
>
I'm not sure what's going on then, the scripts should set
up the environment to the cross compilation stuff. For some
reason you are still getting the wrong linker as the error

  /usr/bin/ld: unrecognized option '--stack'

shows. I think it is supposed to run the mingw one which is

  <MXE>/usr/bin/x86_64-w64-mingw32.static-ld

Can you trace all the command line output (maybe running
qmake with -d to make it verbose) into some file and put
that to pastebin or something? Maybe this gives some clue
what's going wrong.

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

buttim
qmakelog.zip
the qmake output exceeded 512kB, so I could not upload it to pastebin
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

buttim
For completeness I tried a 64 bits build only to hit a wall of errors in GeometryEvaluator.cc.
I might have screwed up something though: it's 2AM here and I definitely need some rest!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

buttim
...stuck
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

buttim
Since there is absolutely no way to cross compile for Windows, at least on my PC, I turned to compiling for Ubuntu. After a few corrections I managed to get the editor enhancements back in the current source base.
Is it worth to extract a patch file and post it here or is my experiment doomed to fall in limbo again (so better have some TV instead)?
tp3
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

tp3
On 03/03/2017 11:46 PM, buttim wrote:
> Is it worth to extract a patch file and post it here or is
> my experiment doomed to fall in limbo again (so better have
> some TV instead)?
>
Could you put your change into a pull-request on github?
That would make it much easier to check it out on the different
platforms.

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

buttim
Sure. Since I'm a newbee can you just outline the correct sequence of actions? Should I create a new branch or something? I'll be glad to document on the details, I just need a broad idea.
Thanks
tp3
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

tp3
On 03/04/2017 12:35 AM, buttim wrote:
> Sure. Since I'm a newbee can you just outline the correct sequence
> of actions? Should I create a new branch or something? I'll be glad
> to document on the details, I just need a broad idea.
>
The help entry point on github for this would be
https://help.github.com/articles/fork-a-repo/

I think it's basically (using only command line).

- get github account if you don't have one already

- (optional, I think) upload ssh-key to github account

- clone/fork the openscad repository into your account

git clone [hidden email]:<your-account>/openscad.git

cd openscad

git checkout editor-enhancements master

patch ...

git status # to see what's new and changed

git add <new / changed files>

git commit # add short description of the change

git push # might output a warning, in that case use the command suggested

- now the branch should show up on your account in your
  openscad repo copy and github should show the option
  to create a pull request

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

nophead
>Since there is absolutely no way to cross compile for Windows, at least on my PC,

Not sure what you mean by this. Do you mean you can't make a Windows build on a non-Windows machine, which is what that literally means. Or do you have a Windows machine and can't build OpenScad for it?

I am building OpenScad on Win7 using the instructions here: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Microsoft_Windows. The resulting .exe runs on Windows via the MSYS2 shell but I can't get it to run directly from Windows. So I am not sure if it is a real Window's build or not. Is it a Linux build built on Windows using a Linux emulator? If it builds on Windows using a Linux emulator does that count as a cross compiling? It is after all a .exe. Totally confused!

On 3 March 2017 at 23:50, Torsten Paul <[hidden email]> wrote:
On 03/04/2017 12:35 AM, buttim wrote:
> Sure. Since I'm a newbee can you just outline the correct sequence
> of actions? Should I create a new branch or something? I'll be glad
> to document on the details, I just need a broad idea.
>
The help entry point on github for this would be
https://help.github.com/articles/fork-a-repo/

I think it's basically (using only command line).

- get github account if you don't have one already

- (optional, I think) upload ssh-key to github account

- clone/fork the openscad repository into your account

git clone [hidden email]:<your-account>/openscad.git

cd openscad

git checkout editor-enhancements master

patch ...

git status # to see what's new and changed

git add <new / changed files>

git commit # add short description of the change

git push # might output a warning, in that case use the command suggested

- now the branch should show up on your account in your
  openscad repo copy and github should show the option
  to create a pull request

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

kintel
Administrator

> On Mar 3, 2017, at 21:47, nop head <[hidden email]> wrote:
> […] Totally confused!
>
This was related to https://github.com/openscad/openscad/issues/1964

The official Windows build of OpenSCAD is currently built on a Linux server using MXE (http://mxe.cc/), which is capable of cross-compiling Windows binaries from a non-Windows environment. The reason for this is is mostly that we don’t have any core developers who use Windows as their primary platform so we’re lacking some of the expertise needed to maintain a stable native build. MXE has proven to be work pretty well as all the build systems for all dependencies are maintained somewhere else.

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

nophead
The MSYS2 build I am using seems to think it is cross compiling on Linux but it actually running in Cygwin.  So does that class as cross compiling or is it a native build?

The resulting .exe needs some dlls, so it is not statically linked like the official Windows build.

On 4 March 2017 at 04:37, Marius Kintel <[hidden email]> wrote:

> On Mar 3, 2017, at 21:47, nop head <[hidden email]> wrote:
> […] Totally confused!
>
This was related to https://github.com/openscad/openscad/issues/1964

The official Windows build of OpenSCAD is currently built on a Linux server using MXE (http://mxe.cc/), which is capable of cross-compiling Windows binaries from a non-Windows environment. The reason for this is is mostly that we don’t have any core developers who use Windows as their primary platform so we’re lacking some of the expertise needed to maintain a stable native build. MXE has proven to be work pretty well as all the build systems for all dependencies are maintained somewhere else.

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows cross compilation

kintel
Administrator

> On Mar 4, 2017, at 06:42, nop head <[hidden email]> wrote:
>
> The MSYS2 build I am using seems to think it is cross compiling on Linux but it actually running in Cygwin.  So does that class as cross compiling or is it a native build?
>
The MSYS2 build just uses mingw, so it’s not cross compiling.
Perhaps some of the “think it is cross compiling” is actually testing for gcc/glibc/posix vs. Microsoft’s compilers/libraries. Lots of opportunities for cleanup there : /


 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
123
Loading...