I was able to compile 32 bit version, but faced relocation errors with 64 bit version. There is a bug in the default gcc-mingw-w64-x86-64 ubuntu package version, which is fixed in later versions ->
http://trac.ffmpeg.org/ticket/5895
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85298
You can obviously use the docker image suggested in this forum, but i decided to build the cross-compiler for 64 bit on my system.
This is for vlc 3.0.8. Should work on others as well.
Start by installing the deps.
Only
mingw-w64-tools and not
gcc-mingw-w64-x86-64 and
g++-mingw-w64-x86-64.
Leave out qt, protobuf. It is there is vlc contribs or tools.
Code: Select all
# apt-get install mingw-w64-tools
# apt-get install lua5.2 libtool automake autoconf autopoint make gettext pkg-config
# apt-get install git subversion cmake cvs
# apt-get install wine64-development-tools libwine-dev zip p7zip nsis bzip2
# apt-get install yasm ragel ant default-jdk dos2unix
To build the toolchain, the steps are given in the mingw docs, but i will list it out ->
VERSION:
binutils : 2.28
gcc : 8.3.0
mingw64 : 7.0.0
Binutils
download from -> https://mirror.freedif.org/GNU/binutils/
Code: Select all
mkdir build && cd build
../configure --target=x86_64-w64-mingw32 --disable-multilib
make -j4
make install
Headers
Download mingw -> https://sourceforge.net/p/mingw-w64/
Code: Select all
cd mingw-w64/mingw-w64-headers
mkdir build && cd build
../configure --build=x86_64-pc-linux-gnu --host=x86_64-w64-mingw32 --prefix=/usr/local/x86_64-w64-mingw32
make install
ln -s /usr/local/x86_64-w64-mingw32 /usr/local/mingw
mkdir -p /usr/local/x86_64-w64-mingw32/lib
ln -s /usr/local/x86_64-w64-mingw32/lib /usr/local/x86_64-w64-mingw32/lib64
GCC core
Download -> https://mirror.ossplanet.net/gnu/gcc/gcc-8.3.0/
Code: Select all
./contrib/download_prerequisites
mkdir build && cd build
../configure --target=x86_64-w64-mingw32 --disable-multilib --disable-shared
make all-gcc -j4
make install-gcc
Mingw crt
Code: Select all
cd mingw-w64/mingw-w64-crt
mkdir build && cd build
../configure --host=x86_64-w64-mingw32 --prefix=/usr/local/x86_64-w64-mingw32
make -j4
make install
Make sure you have the following directories in the directory you have installed the mingw-w64 toolchain to:
Code: Select all
<root>/x86_64-w64-mingw32
<root>/x86_64-w64-mingw32/include
<root>/x86_64-w64-mingw32/lib
<root>/x86_64-w64-mingw32/lib32
<root>/x86_64-w64-mingw32/lib64 [link to lib]
<root>/mingw [link to x86_64-w64-mingw32]
<root>/mingw/include
<root>/mingw/lib
<root>/mingw/lib32
<root>/mingw/lib64 [link to lib]
go back to gcc folder ...
GCC main
Code: Select all
cd gcc/build
make -j4
make install
Now that your cross-compiler is built, you can start building VLC ->
WIN 64 compile:
Tools:
Contribs:
Code: Select all
mkdir -p contrib/win64
cd contrib/win64
../bootstrap --host=x86_64-w64-mingw32
make fetch && make
rm -f ../i686-w64-mingw32/bin/moc ../i686-w64-mingw32/bin/uic ../i686-w64-mingw32/bin/rcc
ln -sf 'x86_64-w64-mingw32' ../i686-w64-mingw32
VLC main:
Code: Select all
cd ../../
./bootstrap
mkdir win64 && cd win64
export PKG_CONFIG_LIBDIR=<path-to-vlc-dir>/contrib/x86_64-w64-mingw32/lib/pkgconfig/
export PKG_CONFIG_PATH_CUSTOM=$PKG_CONFIG_LIBDIR
../extras/package/win32/configure.sh --host=x86_64-w64-mingw32 --build=x86_64-pc-linux-gnu
make -j4
now build packages ->
This worked for me. Hope this helps you and others.
Some other errors i faced. If you need ->
1. update glew 2.1.0 in rules.mk
Code: Select all
make[1]: recipe for target '.glew' failed
make: *** [.glew] Error 2
2. Dll plugin not found
https://forum.videolan.org/viewtopic.php?t=145409
https://forum.videolan.org/viewtopic.php?t=108669
Code: Select all
I modified contrib/src/d3d11/rules.mak and contrib/src/d3d9/rules.mak.
====================================================
ifdef HAVE_CROSS_COMPILE
IDL_INC_PATH = /usr/include/wine/windows/
else
#ugly way to get the default location of standard idl files
IDL_INC_PATH = /`echo $(MSYSTEM) | tr A-Z a-z`/$(BUILD)/include
endif
+IDL_INC_PATH = /usr/include/wine-development/windows/