xpra icon
Bug tracker and wiki

Opened 4 years ago

Closed 3 months ago

#300 closed task (duplicate)

setup a proper build infrastructure for win32 builds

Reported by: Antoine Martin Owned by: Smo
Priority: major Milestone: 2.0
Component: platforms Version:
Keywords: win32 Cc:

Description (last modified by Antoine Martin)

Developing on win32 is a nightmare and we rely on far too many sources for all the DLLs we need.
We should setup a cross compile environment based on mingw so that anyone can just follow some simple (?) steps and obtain all the components, built from source, with or without debugging symbols, etc
Including:

  • gtk
  • gstreamer
  • x264
  • libav
  • webp

etc..
Then we can also automate the build and include that from the buildbot.

This should make the code more reliable/maintainable and may well help in solving a number of ugly win32 tickets:

Attachments (1)

Python-2.7.6-1_mingw.diff (142.8 KB) - added by Antoine Martin 3 years ago.
patch for cross compiling Python 2.7.6 with mingw

Download all attachments as: .zip

Change History (18)

comment:1 Changed 4 years ago by Antoine Martin

Milestone: 0.100.11
Owner: set to Antoine Martin
Status: newassigned

comment:2 Changed 4 years ago by Antoine Martin

Description: modified (diff)

comment:3 Changed 3 years ago by Antoine Martin

Milestone: 0.11future

no time - re-scheduling

comment:4 Changed 3 years ago by Antoine Martin

Milestone: future1.0

This is becoming more important so we can ensure that we don't ship vulnerable media libraries (see #544)

comment:5 Changed 3 years ago by Antoine Martin

Here are some of the mingw packages we will need, available on Fedora 20:

  • base stuff: mingw32-winpthreads, mingw32-xz, mingw32-xz-libs
  • libraries: mingw32-orc, mingw32-mpfr, mingw32-liboil, mingw32-gmp
  • gtk: mingw32-gtk2, mingw32-gtkglext (no pygtkglext...)
  • gstreamer: mingw32-gstreamer, mingw32-gstreamer-plugins-bad-free, mingw32-gstreamer-plugins-good
  • media libraries: mingw32-wavpack, mingw32-flac, mingw32-libvorbis}, mingw32-libwebp

Things we should be able to compile from the mingw shell:

  • x264
  • ffmpeg
  • lame, libmad, aac

Potential problems:

Maybe we can mix cross-compilation and native versions?
Or maybe we should start considering moving to Python 3 + native clients?, as this may well be easier to build with a cross compiler (see python-mingw)

Last edited 3 years ago by Antoine Martin (previous) (diff)

comment:6 Changed 3 years ago by Antoine Martin

OK, here are a few things that do build. Loosely based on the list of dependencies found here for OSX builds.
Unless otherwise stated, just run mingw32-configure && make && make install in the source:

  • yasm (needed by ffmpeg)
  • x264: add --enable-shared --enable-static --enable-win32thread
  • lame
  • libmad: remove --fforce-mem from the CFLAGS in the Makefile to avoid: unrecognized command line option '-fforce-mem'
  • faac: add --without-mp4v2
  • speex
  • gst-plugins-ugly
  • gst-plugins-bad: add --disable-dccp --disable-librfb
  • ffmpeg:
    wget http://www.ffmpeg.org/releases/ffmpeg-2.2.1.tar.bz2
    tar -jxf ffmpeg-2.2.1.tar.bz2
    cd ffmpeg-2.2.1
    ./configure \
        --prefix=/usr/i686-w64-mingw32/sys-root/mingw
        --arch=x86 --target-os=mingw32 --enable-cross-compile \
        --enable-runtime-cpudetect --enable-memalign-hack --enable-gpl \
        --disable-everything \
        --enable-swscale --enable-libx264 --enable-decoder=h264 \
        --enable-libvpx --enable-decoder=vp8 --enable-decoder=vp9 \
        --enable-decoder=hevc \
        --disable-protocol=tcp --disable-protocol=rtp \
        --disable-filter=aformat --disable-filter=crop --disable-filter=setpts \
        --disable-filter=anull --disable-filter=format --disable-filter=trim \
        --disable-filter=atrim --disable-filter=null \
        --disable-programs --disable-avfilter
    make && make install
    

Things that do not build (yet?):

Changed 3 years ago by Antoine Martin

Attachment: Python-2.7.6-1_mingw.diff added

patch for cross compiling Python 2.7.6 with mingw

comment:7 Changed 3 years ago by Antoine Martin

With the patch above (found here - see also: cross compiling python for windows with mingw32), I can compile Python 2.7.6! (only it didn't find windres so I edited the Makefile to point it to /usr/bin/i686-w64-mingw32-windres)
Then we Configure wine to be able to run the new Python.exe. We can then install setuptools:

sudo /usr/i686-w64-mingw32/sys-root/mingw/bin/python.exe ./setup.py install

Find out that Python has been built without SSL support ("unknown url type: https") and install mingw32-openssl to rebuild it with https support...

Then we can proceed with the python dependencies using the newly installed /opt/i686-w64-mingw32/sys-root/mingw/bin/easy_install.exe and add: pyasn1, lz4. (the others need more work..)

Last edited 3 years ago by Antoine Martin (previous) (diff)

comment:8 Changed 3 years ago by Antoine Martin

Trying (and failing) to build a simple extension (netifaces):

  • we need to patch this header:
    --- /opt/i686-w64-mingw32/sys-root/mingw/include/python2.7/pyconfig.h
    +++ /opt/i686-w64-mingw32/sys-root/mingw/include/python2.7/pyconfig.h
    @@ -1256,7 +1256,7 @@
     /* #undef size_t */
     
     /* Define to `int' if <sys/socket.h> does not define. */
    -#define socklen_t int
    +// #define socklen_t int
     
     /* Define to `int' if <sys/types.h> doesn't define. */
     #define uid_t int
    
  • tell setuptools where to find the compiler:
    CC=/usr/bin/i686-w64-mingw32-gcc
    

Then I can try to run the build:

/opt/i686-w64-mingw32/sys-root/mingw/bin/python.exe ./setup.py build --compiler=mingw32

Which fails to find Python.h... and adding it by hand for now only fails a little bit later... Copying all the headers to the source directory is easier than fighting wine / unix paths, but it eventually still fails.

Last edited 3 years ago by Antoine Martin (previous) (diff)

comment:9 Changed 3 years ago by Antoine Martin

This is such a pain that maybe #90 is a better way forward?

One problem with this solution is that GTK3 binaries for MS Windows are almost as out of date as the GTK2 version (over 2 years without update..), see GTK Download for Windows:

  • GTK+ 3.6.4 (current release is 3.12)
  • libpng 1.5.14 (see #544 for why this is a very bad thing for us)

So even with this one, we will have to try to rebuild a fair amount of stuff.
There are some newer builds here: http://win32builder.gnome.org/, but no idea how well they work and how official they are... what a mess.

Last edited 3 years ago by Antoine Martin (previous) (diff)

comment:10 Changed 3 years ago by Antoine Martin

Resolution: wontfix
Status: assignedclosed

I think building pygtk2 from source will just be too hard (cross compiling is a no go because of all the extensions that need to be compiled - already hard enough even without the cross compiling part), especially if we need to update some of the libraries for security reasons (ie: libpng.

So I am closing this as WONTFIX for now, hoping that we can move win32 clients to GTK3 (#90).

Last edited 3 years ago by Antoine Martin (previous) (diff)

comment:11 Changed 11 months ago by Antoine Martin

Milestone: 1.00.18
Resolution: wontfix
Status: closedreopened

Re-opening, GTK3 is going nowhere fast.

comment:12 Changed 11 months ago by Antoine Martin

Owner: changed from Antoine Martin to Smo
Status: reopenednew

@smo: hexchat build?

comment:13 Changed 11 months ago by Antoine Martin

Should probably be merged / closed as duplicate of #678

comment:14 Changed 10 months ago by Antoine Martin

There are 3 tickets that should be consolidated into one: #917, #678 and #300

comment:15 Changed 9 months ago by Antoine Martin

Milestone: 0.181.0

Milestone renamed

comment:16 Changed 7 months ago by Antoine Martin

Milestone: 1.02.0

comment:17 Changed 3 months ago by Antoine Martin

Resolution: duplicate
Status: newclosed

Will follow up in #678.

Note: See TracTickets for help on using tickets.