Broken build when cross-compiling for Windows 32 bits

*nix specific usage questions
Wat_00
New Cone
New Cone
Posts: 3
Joined: 24 Mar 2014 02:20

Broken build when cross-compiling for Windows 32 bits

Postby Wat_00 » 24 Mar 2014 02:46

When trying to build VLC media player against the latest master git, the build aborts with an error.

Host OS: Ubuntu 13.10 64 bits
Target OS: Windows 32 bits

Steps to reproduce issue:

Download dev tools with:

Code: Select all

sudo apt-get -y install lua5.2 libtool automake autoconf autopoint make gettext pkg-config qt4-dev-tools git subversion yasm cmake cvs g++ ragel zip p7zip nsis bzip2 wine1.4-dev
Install latest mingw-w64 (MinGW-w64 3.1.0 and GCC 4.8.2) with Zeranoe's script (http://ffmpeg.zeranoe.com/blog/?p=269)

Code: Select all

sudo apt-get -y install texinfo flex bison ./mingw-w64-build-3.5.8 export PATH=${PATH}:/home/<user>/mingw-w64-i686/bin
Download sources with:

Code: Select all

git clone git://git.videolan.org/vlc.git vlc
Execute contrib build:

Code: Select all

cd vlc mkdir -p contrib/win32 cd contrib/win32 ../bootstrap --host=i686-w64-mingw32 make fetch make
Execute main build:

Code: Select all

cd cd vlc ./bootstrap mkdir win32 && cd win32 ../extras/package/win32/configure.sh --host=i686-w64-mingw32 make
The build aborts with the error:

Code: Select all

make[5]: Entering directory `/home/user/vlc/win32/modules/video_output' CCLD libgl_plugin.la /home/user/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lGL /home/user/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld: cannot find -ldl /home/user/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld: cannot find -ldrm /home/user/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lXdamage /home/user/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lX11-xcb /home/user/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lxcb-glx /home/user/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lxcb-dri2 /home/user/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lXxf86vm /home/user/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lXfixes /home/user/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lXext /home/user/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lX11 /home/user/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lxcb /home/user/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lXau /home/user/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lXdmcp collect2: error: ld returned 1 exit status make[5]: *** [libgl_plugin.la] Error 1 make[5]: Leaving directory `/home/user/vlc/win32/modules/video_output' make[4]: *** [all] Error 2 make[4]: Leaving directory `/home/user/vlc/win32/modules/video_output' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/home/user/vlc/win32/modules' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/user/vlc/win32/modules' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/user/vlc/win32' make: *** [all] Error 2
The main build can't find some contrib libraries, although the contrib build executed to the end without throwing any errors.

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

Re: Broken build when cross-compiling for Windows 32 bits

Postby Rémi Denis-Courmont » 24 Mar 2014 17:44

libdrm does not exist on Windows. It looks rather like you have configured the build to use your build system's native OpenGL.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Wat_00
New Cone
New Cone
Posts: 3
Joined: 24 Mar 2014 02:20

Re: Broken build when cross-compiling for Windows 32 bits

Postby Wat_00 » 24 Mar 2014 22:36

libdrm does not exist on Windows. It looks rather like you have configured the build to use your build system's native OpenGL.
I didn´t, the build script did. Regardless of how --host parameter was set.

Looks like a cross-compilation bug. I can report it as a bug.

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

Re: Broken build when cross-compiling for Windows 32 bits

Postby Rémi Denis-Courmont » 25 Mar 2014 18:04

Setting up the build environment is your job, not the build script's.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Wat_00
New Cone
New Cone
Posts: 3
Joined: 24 Mar 2014 02:20

Re: Broken build when cross-compiling for Windows 32 bits

Postby Wat_00 » 26 Mar 2014 01:30

Setting up the build environment is your job, not the build script's.
The same build environment works perfectly when building the stable 2.1.4 tag.

Roiy
New Cone
New Cone
Posts: 4
Joined: 29 Mar 2014 00:01

Re: Broken build when cross-compiling for Windows 32 bits

Postby Roiy » 01 Apr 2014 05:40

I had similar issues with the latest branch:

Code: Select all

make[7]: Entering directory `/media/sf_temp/dev/vlc/win32/modules/gui/qt4' CXXLD libqt4_plugin.la /usr/bin/x86_64-w64-mingw32-ld: cannot find -laudio /usr/bin/x86_64-w64-mingw32-ld: cannot find -lXt /usr/bin/x86_64-w64-mingw32-ld: cannot find -lgobject-2.0 /usr/bin/x86_64-w64-mingw32-ld: cannot find -lSM /usr/bin/x86_64-w64-mingw32-ld: cannot find -lICE /usr/bin/x86_64-w64-mingw32-ld: cannot find -lXi /usr/bin/x86_64-w64-mingw32-ld: cannot find -lXrender /usr/bin/x86_64-w64-mingw32-ld: cannot find -lXext /usr/bin/x86_64-w64-mingw32-ld: cannot find -lX11 /usr/bin/x86_64-w64-mingw32-ld: cannot find -ldl /usr/bin/x86_64-w64-mingw32-ld: cannot find -lgthread-2.0 /usr/bin/x86_64-w64-mingw32-ld: cannot find -lglib-2.0 /usr/bin/x86_64-w64-mingw32-ld: cannot find -lrt collect2: error: ld returned 1 exit status
I saw that these libraries are added as a result of the pkg-config check:

Code: Select all

/usr/bin/x86_64-w64-mingw32-pkg-config --libs --static QtGui -pthread -L/usr/X11R6/lib -lQtGui -laudio -lXt -lpng -lgobject-2.0 -lSM -lICE -lXi -lXrender -lfreetype -lXext -lX11 -lQtCore -lfontconfig -lpthread -lz -lm -ldl -lgthread-2.0 -lglib-2.0 -lrt
This is the wrong QtGui, and i suspect it was caused by the change to configure.ac in "configure: unbreak cross-pkg-config support with contrib":

Code: Select all

- AS_IF([test "$build" = "$host" -o "$PKG_CONFIG_LIBDIR"], [ - export PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH" - ], [ - export PKG_CONFIG_LIBDIR="${CONTRIB_DIR}/lib/pkgconfig" - ]) + export PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH"

I set the PKG_CONFIG_LIBDIR and the problem was solved. The question is if this is the behavior that we want, I think more developers are likely to encounter this problem.

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

Re: Broken build when cross-compiling for Windows 32 bits

Postby Rémi Denis-Courmont » 01 Apr 2014 21:03

This is the documented behaviour in VLC and in pkg-config.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

kc7bfi
Blank Cone
Blank Cone
Posts: 10
Joined: 23 Apr 2013 22:33

Re: Broken build when cross-compiling for Windows 32 bits

Postby kc7bfi » 23 Jul 2014 15:44

What did you set PKG_CONFIG_LIBDIR to to get it to work? David

erwan10
Developer
Developer
Posts: 415
Joined: 02 Nov 2008 23:16

Re: Broken build when cross-compiling for Windows 32 bits

Postby erwan10 » 25 Jul 2014 15:30

For some time, I have also met these problems when cross compiling the latest git for Windows from Ubuntu14.04.

Here are the two patches I use as a workaround

Code: Select all

diff --git a/configure.ac b/configure.ac index b847f57..d149698 100644 --- a/configure.ac +++ b/configure.ac @@ -392,6 +392,7 @@ AS_IF([test -n "${CONTRIB_DIR}"], [ CXXFLAGS="${CXXFLAGS} -I${CONTRIB_DIR}/include" OBJCFLAGS="${OBJCFLAGS} -I${CONTRIB_DIR}/include" export PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH" + export PKG_CONFIG_LIBDIR="${CONTRIB_DIR}/lib/pkgconfig" LDFLAGS="${LDFLAGS} -L${CONTRIB_DIR}/lib" AS_IF([test "${SYS}" = "darwin"], [ diff --git a/extras/package/npapi.am b/extras/package/npapi.am index e778f7d..3b33608 100644 --- a/extras/package/npapi.am +++ b/extras/package/npapi.am @@ -37,7 +37,7 @@ npapi-vlc/Makefile: npapi-vlc/configure CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" \ LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ SHELL="$(SHELL)" \ - PKG_CONFIG_PATH="$(libdir)/pkgconfig:$(CONTRIB_DIR)/lib/pkgconfig" + PKG_CONFIG_LIBDIR="$(libdir)/pkgconfig:$(CONTRIB_DIR)/lib/pkgconfig" touch $@ npapi-vlc/npapi/npvlc.la: npapi-vlc/Makefile -- 1.9.1

Code: Select all

diff --git a/extras/package/win32/package.mak b/extras/package/win32/package.mak index 0b7abf8..7aac71b 100644 --- a/extras/package/win32/package.mak +++ b/extras/package/win32/package.mak @@ -25,7 +25,7 @@ package-win-install: touch $@ -package-win-common: package-win-install build-npapi +package-win-common: package-win-install mkdir -p "$(win32_destdir)"/ # Executables, major libs+manifests @@ -54,10 +54,10 @@ if BUILD_SKINS cp -r $(prefix)/share/vlc/skins2 $(win32_destdir)/skins endif - cp "$(top_builddir)/npapi-vlc/activex/axvlc.dll.manifest" "$(win32_destdir)/" - cp "$(top_builddir)/npapi-vlc/installed/lib/axvlc.dll" "$(win32_destdir)/" - cp "$(top_builddir)/npapi-vlc/npapi/package/npvlc.dll.manifest" "$(win32_destdir)/" - cp "$(top_builddir)/npapi-vlc/installed/lib/npvlc.dll" "$(win32_destdir)/" +#cp "$(top_builddir)/npapi-vlc/activex/axvlc.dll.manifest" "$(win32_destdir)/" +#cp "$(top_builddir)/npapi-vlc/installed/lib/axvlc.dll" "$(win32_destdir)/" +#cp "$(top_builddir)/npapi-vlc/npapi/package/npvlc.dll.manifest" "$(win32_destdir)/" +#cp "$(top_builddir)/npapi-vlc/installed/lib/npvlc.dll" "$(win32_destdir)/" # Compiler shared DLLs, when using compilers built with --enable-shared # The shared DLLs may not necessarily be in the first LIBRARY_PATH, we
It amounts to adding the PKG_CONFIG_LIBDIR variable in configure.ac and disabling both npapi and activex.


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 6 guests