Win32Compile in Ubuntu/Debian

This forum is about all development around libVLC.
masticover
New Cone
New Cone
Posts: 7
Joined: 23 Jan 2018 10:40

Win32Compile in Ubuntu/Debian

Postby masticover » 23 Jan 2018 14:43

Hello everyone,

The cross-compilation of VLC in Ubuntu/Debian is being really frustrating and discouraging. Let's me explain.

Following the guide from https://wiki.videolan.org/Win32Compile/:
Ubuntu 14.04 is too old to compile VLC
...

Ok, I will use Ubuntu 16.04.

After installing Mingw-w64 toolchain, development tools, cloning the repository, prebuild the 3rd party libraries, etc. Let's configure (https://wiki.videolan.org/Win32Compile#Configure)

Error, Mingw > 5.0 needed! Ubuntu 16.04 installs Mingw-w64 version 4...

Ok, after uninstall the current version of Mingw and install Mingw 5.3, when configuring the project again:

Code: Select all

configure: error: You need 32-bits luac when using using lua from contrib.
OMG! I have installed lua (following the guide
apt-get install lua5.2
)

Ok, lets go and disable lua (--disable-lua) and get rid of this.

Code: Select all

configure: error: libavutil versions 55 and later are not supported.
Both, in Ubuntu 16.04 and Debian 9, for VLC 2.x.

Let's try vlc-3.0 (https://github.com/videolan/vlc-3.0)

Code: Select all

configure: error: You need 32-bits luac when using using lua from contrib.
Ok, sh**t, I will disable lua for this one too:

../extras/package/win32/configure.sh --host=i686-w64-mingw32 --build=x86_64-pc-linux-gnu --disable-lua

Code: Select all

configure: error: cannot find FAAD library
No kidding!

# ../extras/package/win32/configure.sh --host=i686-w64-mingw32 --build=x86_64-pc-linux-gnu --disable-lua --disable-faad

Configuration Ok! Ou yeah! Let's compile:

Code: Select all

fatal: Not a git repository: '../../extras/package/win32/../../../.git/' cat: ../../extras/package/win32/../../../src/revision.txt: No such file or directory Makefile:3241: recipe for target 'stamp-revision' failed Makefile:1522: recipe for target 'all-recursive' failed Makefile:1407: recipe for target 'all' failed make: *** [all] Error 2
Wait! I will try to configure it manually: ../configure --host=i686-w64-mingw32 --build=x86_64-pc-linux-gnu --disable-lua --disable-faad

Code: Select all

Configuration finished ok! Well, let's compile: fatal: Not a git repository: '../../.git/' cat: ../../src/revision.txt: No such file or directory
Could someone help me with this? I just want to compile VLC for Windows 32 bits. And I don't know what else to do. Is there any other tutorial or something I could follow to get this work?

Thanks folks!

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Win32Compile in Ubuntu/Debian

Postby Jean-Baptiste Kempf » 23 Jan 2018 23:08

Just use our docker image for that. Or run extras/package/win32/build.sh -a i686 on the 3.0 branch.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

masticover
New Cone
New Cone
Posts: 7
Joined: 23 Jan 2018 10:40

Re: Win32Compile in Ubuntu/Debian

Postby masticover » 24 Jan 2018 13:28

Hi,

Thanks for the answer Jean-Baptiste.

1. With the docker image, trying to build the container (in "vlc-debian-win32" folder):
docker build -t vlc_win32 .

This gives me the following error (after almost an hour of compilation):

Code: Select all

make[1]: *** [s-attrtab] Killed make[1]: *** Waiting for unfinished jobs.... Makefile:2203: recipe for target 's-attrtab' failed /bin/bash ../../gcc/../move-if-change tmp-automata.c insn-automata.c echo timestamp > s-automata rm gcc.pod make[1]: Leaving directory '/build/gcc-6.4.0/build/gcc' Makefile:4139: recipe for target 'all-gcc' failed make: *** [all-gcc] Error 2 The command '/bin/sh -c set -x && apt-get update -qq && apt-get install -qqy git wget bzip2 file libwine-dev unzip libtool pkg-config cmake build-essential automake texinfo ragel yasm p7zip-full autopoint gettext dos2unix zip wine nsis curl gperf flex bison libcurl4-gnutls-dev python3 python3-requests && dpkg --add-architecture i386 && apt-get update && apt-get -y install wine32 && echo "deb http://deb.debian.org/debian experimental main" > /etc/apt/sources.list.d/experimental.list && apt-get update && apt-get -y -t experimental install nsis && rm -f /etc/apt/sources.list.d/experimental.list && apt-get clean -y && rm -rf /var/lib/apt/lists/* && TARGET_TUPLE=i686-w64-mingw32 TOOLCHAIN_PREFIX=/opt/gcc-$TARGET_TUPLE MINGW_PREFIX=$TOOLCHAIN_PREFIX/$TARGET_TUPLE PATH=$TOOLCHAIN_PREFIX/bin:$PATH GCC_VERSION=6.4.0 BINUTILS_VERSION=2.27 MPFR_VERSION=3.1.6 GMP_VERSION=6.1.1 MPC_VERSION=1.0.3 && mkdir /build && cd /build && mkdir $TOOLCHAIN_PREFIX && mkdir $MINGW_PREFIX && ln -s $MINGW_PREFIX $TOOLCHAIN_PREFIX/mingw && wget -q http://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VERSION.tar.bz2 && wget -q ftp://ftp.uvsq.fr/pub/gcc/releases/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz && git config --global user.name "VideoLAN Buildbot" && git config --global user.email buildbot@videolan.org && git clone --depth=1 --branch v5.0.3 git://git.code.sf.net/p/mingw-w64/mingw-w64 && tar xf gcc-$GCC_VERSION.tar.xz && tar xf binutils-$BINUTILS_VERSION.tar.bz2 && cd binutils-$BINUTILS_VERSION && mkdir build && cd build && ../configure --prefix=$TOOLCHAIN_PREFIX --target=$TARGET_TUPLE --disable-werror --disable-multilib && make -j4 && make install && cd /build/mingw-w64/mingw-w64-headers && mkdir build && cd build && ../configure --prefix=$MINGW_PREFIX --host=$TARGET_TUPLE --enable-secure-api && make install && cd /build && wget -q https://ftp.gnu.org/gnu/mpfr/mpfr-$MPFR_VERSION.tar.gz && wget -q https://gmplib.org/download/gmp/gmp-$GMP_VERSION.tar.xz && wget -q ftp://ftp.gnu.org/gnu/mpc/mpc-$MPC_VERSION.tar.gz && tar xf mpfr-$MPFR_VERSION.tar.gz && tar xf gmp-$GMP_VERSION.tar.xz && tar xf mpc-$MPC_VERSION.tar.gz && ln -s /build/mpfr-$MPFR_VERSION gcc-$GCC_VERSION/mpfr && ln -s /build/gmp-$GMP_VERSION gcc-$GCC_VERSION/gmp && ln -s /build/mpc-$MPC_VERSION gcc-$GCC_VERSION/mpc && cd gcc-$GCC_VERSION && mkdir build && cd build && ../configure --prefix=$TOOLCHAIN_PREFIX --target=$TARGET_TUPLE --enable-languages=c,c++ --enable-lto --disable-shared --disable-multilib && make -j4 all-gcc && make install-gcc && cd /build/mingw-w64/mingw-w64-crt && mkdir build && cd build && ../configure --prefix=$MINGW_PREFIX --host=$TARGET_TUPLE && make -j4 && make install && cd /build/gcc-$GCC_VERSION/build && make -j4 && make install && cd /build/mingw-w64/mingw-w64-tools/widl && mkdir build && cd build && ../configure --prefix=$TOOLCHAIN_PREFIX --target=$TARGET_TUPLE && make -j4 && make install && cd /build/ && git clone --recursive https://code.videolan.org/videolan/breakpad.git && cd breakpad && autoreconf -vif && mkdir build && cd build && ../configure --enable-tools --disable-processor --prefix=/opt/breakpad && make -j4 && make install && cd / && rm -rf /build' returned a non-zero code: 2

2. Running extras/package/win32/build.sh -a i686 on the 3.0 branch (after one hour or so of compilation too):

Code: Select all

Makefile:905: fallo en las instrucciones para el objetivo 'fcobjshash.h' make[3]: *** [fcobjshash.h] Error 1 make[3]: se sale del directorio '/home/debdev/vlc/contrib/contrib-win32/fontconfig/src' Makefile:580: fallo en las instrucciones para el objetivo 'all-recursive' make[2]: *** [all-recursive] Error 1 make[2]: se sale del directorio '/home/debdev/vlc/contrib/contrib-win32/fontconfig' Makefile:464: fallo en las instrucciones para el objetivo 'all' make[1]: *** [all] Error 2 make[1]: se sale del directorio '/home/debdev/vlc/contrib/contrib-win32/fontconfig' ../../contrib/src/fontconfig/rules.mak:55: fallo en las instrucciones para el objetivo '.fontconfig' make: *** [.fontconfig] Error 2

I'm using a VM (VirtualBox) Debian 9 Stretch for the compilation. Don't know what else to do...

Thanks again for your help. I'm planning to develop an addon for VLC and I hope this step won't take me too much time :(

masticover
New Cone
New Cone
Posts: 7
Joined: 23 Jan 2018 10:40

Re: Win32Compile in Ubuntu/Debian

Postby masticover » 13 Feb 2018 13:50

Hi,

Finally, I managed to compile VLC on the 3.0 branch, as follow:

1. Cloning 3.0.0 branch.
2. Modifying files "rules.mak" in vlc/contrib/src/d3d9 and vlc/contrib/src/d3d11: change "wine" to "wine-development" inside them.
3. Execute build scritp: ./extras/package/win32/build.sh -a i686

The problem now, after creating an Out of tree module as stream filter, is that VLC does NOT found my plugin, giving me the following message when launching it:

Code: Select all

... main debug: recursively browsing `C:\Users\myuser\Documents\vlc-3.0.0\plugins' main warning: cannot load module `C:\Users\myuser\Documents\vlc-3.0.0\plugins\stream_filter\libmydemofilter_plugin.dll' (No se puede encontrar el módulo especificado. (error 126)) main debug: plug-ins loaded: 488 modules ...
I'm using CMake, the plugin es properly compiled, but VLC does't recognize it. Any help?

Thanks.

masticover
New Cone
New Cone
Posts: 7
Joined: 23 Jan 2018 10:40

Re: Win32Compile in Ubuntu/Debian

Postby masticover » 16 Feb 2018 09:17

This is really weird :S

Creating a sample Out of tree module, Vlc loads it if it's created in one file, but not if it uses another file/library. I mean:

- Vlc loads the module if I have a single file:
mydemofilter_plugin.cpp

- Vlc does NOT load the module if I use a function from another library/file:
mydemofilter_plugin.cpp
|---> utils.cpp

What is really strange here is that if I include the header (#include utils.h in mydemo_plugin.cpp) the module is loaded, but when I use a function from utils.h, Vlc does NOT found my module, giving me the error:
... main debug: recursively browsing `C:\Users\myuser\Documents\vlc-3.0.0\plugins' main warning: cannot load module `C:\Users\myuser\Documents\vlc-3.0.0\plugins\stream_filter\libmydemofilter_plugin.dll' (No se puede encontrar el módulo especificado. (error 126)) main debug: plug-ins loaded: 488 modules ...

Does anyone know what might be happening? :/

Thanks.

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Win32Compile in Ubuntu/Debian

Postby Rémi Denis-Courmont » 16 Feb 2018 10:07

Win32 LoadLibrary() cannot load your module.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

masticover
New Cone
New Cone
Posts: 7
Joined: 23 Jan 2018 10:40

Re: Win32Compile in Ubuntu/Debian

Postby masticover » 20 Feb 2018 11:51

Hi Rémi,

Yes, we both agree about that ;)

The question is why Vlc (ie, Win32 LoadLibrary()) does not load the module when using a dummy function from a dummy class?

For example, here is the code of the class Utils:
Utils.h

#include <cstdio>
#include <string>
#include <stdlib.h>

bool checkLoad();


Utils.cpp

#include "Utils.h"

bool checkLoad()
{
return true;
}


That's all. If I only include this class in my demo module, the compilation is Ok and Vlc (ie, Win32 LoadLibrary()) load the module perfectly.
If I call "checkLoad()", the compilation is Ok but the module is not loaded.

But what could be the problem? This is driving me crazy :/

masticover
New Cone
New Cone
Posts: 7
Joined: 23 Jan 2018 10:40

Re: Win32Compile in Ubuntu/Debian

Postby masticover » 07 Mar 2018 12:30

Any help here?

Thanks.

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Win32Compile in Ubuntu/Debian

Postby Rémi Denis-Courmont » 07 Mar 2018 16:47

VLC does not load because the Win32 run-time loader does not load.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 3 guests