Cross-compile Gstreamer-1.0 from Fedora Linux 64-bit to Windows 64-bit

Update. Windows binaries of GTK+-3.14.0, Gstreamer-1.4.4, Python3, pygtk3 gobject-introspection PyGObject (aka PyGI) are available from here, so this guide is not necessary (unless the latest version of Gstreamer without PyGI is desired)

This handy little guide catalogues the adventures of building a minimal Windows version of GStreamer-1.0 on Linux, (without PyGI, which can only be built on Windows). GStreamer-0.10 is end-of-life, so we won't be discussing that. For those who need the Python stuff, but do not want to download the above binaries, Start with building Python3 on Windows. Visual Studio 2010 Professional Edition and Python 2.7-ish is required to build 64-bit Python3. Express Edition can do 32 bit. Now away, go!

The rest of this guide is for Fedora Linux. What good is a Windows version of Gstreamer on Fedora? We can use the comfortable Linux desktop and cross-build system to buid apps for both Windows and Linux, that's why. And then we can test our apps in the wine windows emulator, and make sure everything works the same without needing to use a separate Windows machine.

Fedora Packages

Geting mingw64. This is not the most exhaustive, nor the most minimal install of Mingw64. It's simply what we had on our system.

yum -y install mingw64-binutils mingw64-bzip2 mingw64-cairo mingw64-cpp mingw64-crt \
mingw64-expat mingw64-fftw mingw64-flac mingw64-flac-tools mingw64-fontconfig \
mingw64-freetype mingw64-gcc mingw64-gcc-c++ mingw64-gdb mingw64-gdk-pixbuf \
mingw64-gettext mingw64-glib2 mingw64-gtk2 mingw64-harfbuzz mingw64-headers mingw64-icu \
mingw64-jasper mingw64-libffi mingw64-libjpeg-turbo mingw64-libpng mingw64-libsoup \
mingw64-libtiff mingw64-libxml2 mingw64-orc mingw64-pango mingw64-pixman \
mingw64-pkg-config mingw64-sqlite mingw64-termcap mingw64-win-iconv mingw64-winpthreads \
mingw64-zlib mingw-binutils-generic mingw-w64-tools mingw64-libgcrypt mingw64-curl \

Notice: Do not use root or sudo administrator permissions for any of the make install steps. This howto installs them to the default .wine folder in the user's $HOME directory, which should not require any special permissions. Do not use root or sudo to run wine, nor to do any tests. That's now how any of this works. As a matter of fact, it would be better to log in as an unpriviliged dev user, or chroot sandbox.

This is just a temporary test build walkthrough. Of course there are no guarantees, but if followed correctly, no changes should happen to anything on the Linux development platform. For something more permanant, you could go ahead and re-compile some of these dependencies into Linux's Mingw64 itself from a different shell, and using mingw64-make but that is beyond the scope of this particular agenda.

This will set up a "safe" cross-build environment.

export PREFIX="$HOME/.wine/drive_c/gst64"
export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig"
export GST_PLUGIN_PATH_1_0="$PREFIX/lib/gstreamer-1.0"
export LDFLAGS=-L"$PREFIX/lib -lpthread"
export CFLAGS="-mthreads -pthread -D_WIN32_WINNT=0x0501 -DWINVER=0x0501 -I$PREFIX/include"
export PYTHON=$HOME/.wine/drive_c/Python27/python.exe
export CFLAGS="$CFLAGS -I$HOME/.wine/drive_c/Python27/include"
export LDFLAGS="$LDFLAGS -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib"
export LIBS=-L$HOME/.wine/drive_c/Python27/libs
export SWIG=$HOME/.wine/drive_c/swigwin-3.0.2/swig.exe

export OPTS="--build=x86_64 --host=x86_64-w64-mingw32 --sysconfdir="$PREFIX/etc" --prefix="$PREFIX" \
--exec-prefix="$EPREFIX"  --bindir="$EPREFIX/bin" --libdir="$EPREFIX/lib" --libexecdir="$EPREFIX/libexec" \
--sbindir="$EPREFIX/sbin" --sharedstatedir="$EPREFIX/lib" --datarootdir="$EPREFIX/share" \
--datadir="$PREFIX/share" --includedir="$PREFIX/include" --infodir="$PREFIX/share/info" \
--mandir="$PREFIX/share/man" --localstatedir="$PREFIX/var""

mkdir -p $HOME/dev/win
cd $HOME/dev/win

common build commands

make distclean
./ $OPTS
./configure $OPTS
make -j16
make install

Download to $HOME/dev/win and build in order.

Fixing Errors Hints

Some projects require cmake. yum -y install cmake

x265: use cmake Create a toolchain file for mingw64 development

rm -rf CMakeCache.txt CMakeFiles/
mingw64-make -j16
mingw64-make install

opencv: deps

ld: cannot find -lRunTmChk ref:

rerun cmake -DWITH_IPP=OFF


libtheora: problems .libs/libtheoradec-1.dll.def: file format not recognized; treating as linker script

sed -i 's/\(1q \\$export_symbols\)/\1|tr -d \\\\\\\"\\r\\\\\\\"/' libtool

png2theora.c:467: undefined reference to png_sizeof

Change png_sizeof to sizeof

xorg-macros doesn't install pkg-config

cp *pc ../prefix/lib/pkgconfig/

Mesa: no package glproto, x11 xorg-macros, etc.

Build mesa with scons

scons platform=windows toolchain=crossmingw machine=x86_64 mesagdi libgl-gdi

gst-plugins-base: error: unknown conversion type character 'l' in format - scaning long long

patch -p0 < gst-plugins-base.patch

patch -p0 < gst-plugins-bad.patch

If you get "cannot find -ldl" remove -ldl from the offending file


Add --disable-twolame to ./configure options


Update .wine/system.reg

\system32\\wbem;%GTKDIR%\\bin;%GSTREAMER_SDK_ROOT_X86_64%\\bin;/usr/x86_64-w64-mingw32/sys-root/mi ngw/bin"

Try it out.

cd $HOME/.wine/drive_c/gst64/bin
wine gst-inspect-1.0.exe


Q. How do you know where to download source packages from?

A. Get "rinfo" for Fedora Linux. Append to .bashrc to make it permanent.

alias rinfo='rpm -qi --nodigest --nosignature'

Usage: rinfo [package name]


CCBY Copyright © 2024 Henry Kroll III, This web page is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.