cross compilation for windows from ubuntu

*nix specific usage questions
bendanan
Blank Cone
Blank Cone
Posts: 13
Joined: 02 Aug 2011 02:59
VLC version: vlc-2.1.0-git
Operating System: Linux, Windows
Location: Modi'in - Israël

cross compilation for windows from ubuntu

Postby bendanan » 20 Aug 2012 10:56

Hi all,

I would like to cross compile VLC for windows 32 bits from Ubuntu 64 bits desktop and does not succeed using the following wiki:
http://wiki.videolan.org/Win32Compile

My Ubuntu desktop :
# uname -a
Linux pcneslog4 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

I use the HostTriplet="i686-w64-mingw32"

I have installed:
sudo apt-get install git subversion cvs yasm cmake
sudo apt-get install gcc-mingw-w64 g++-mingw-w64
sudo apt-get install lua5.1 libtool automake autoconf autopoint make gettext zip p7zip nsis bzip2
sudo apt-get install g++
sudo apt-get install qt4-dev-tools

Everything is going well until the step "Building VLC".

I got the following errors:

CCLD liblibass_plugin.la
Creating library file: .libs/liblibass_plugin.dll.a/home/share/projets/vlc/workspace/vlc_pcneslog4_git_buildconfig/contrib/i686-w64-mingw32/lib/libharfbuzz.a(libharfbuzz_la-hb-uniscribe.o):hb-uniscribe.cc:(.text+0x253): undefined reference to `__imp__AddFontMemResourceEx@16'
/home/share/projets/vlc/workspace/vlc_pcneslog4_git_buildconfig/contrib/i686-w64-mingw32/lib/libharfbuzz.a(libharfbuzz_la-hb-uniscribe.o):hb-uniscribe.cc:(.text+0x2d6): undefined reference to `__imp__RemoveFontMemResourceEx@4'
/home/share/projets/vlc/workspace/vlc_pcneslog4_git_buildconfig/contrib/i686-w64-mingw32/lib/libharfbuzz.a(libharfbuzz_la-hb-uniscribe.o):hb-uniscribe.cc:(.text+0x5aa): undefined reference to `__imp__CreateFontIndirectW@4'
/home/share/projets/vlc/workspace/vlc_pcneslog4_git_buildconfig/contrib/i686-w64-mingw32/lib/libharfbuzz.a(libharfbuzz_la-hb-uniscribe.o):hb-uniscribe.cc:(.text+0x623): undefined reference to `__imp__SelectObject@8'
/home/share/projets/vlc/workspace/vlc_pcneslog4_git_buildconfig/contrib/i686-w64-mingw32/lib/libharfbuzz.a(libharfbuzz_la-hb-uniscribe.o):hb-uniscribe.cc:(.text+0x6c4): undefined reference to `__imp__DeleteObject@4'
/home/share/projets/vlc/workspace/vlc_pcneslog4_git_buildconfig/contrib/i686-w64-mingw32/lib/libharfbuzz.a(libharfbuzz_la-hb-uniscribe.o):hb-uniscribe.cc:(.text+0x6e1): undefined reference to `_ScriptFreeCache@4'
/home/share/projets/vlc/workspace/vlc_pcneslog4_git_buildconfig/contrib/i686-w64-mingw32/lib/libharfbuzz.a(libharfbuzz_la-hb-uniscribe.o):hb-uniscribe.cc:(.text+0xa50): undefined reference to `_ScriptItemizeOpenType@32'
/home/share/projets/vlc/workspace/vlc_pcneslog4_git_buildconfig/contrib/i686-w64-mingw32/lib/libharfbuzz.a(libharfbuzz_la-hb-uniscribe.o):hb-uniscribe.cc:(.text+0xc87): undefined reference to `_ScriptShapeOpenType@64'
/home/share/projets/vlc/workspace/vlc_pcneslog4_git_buildconfig/contrib/i686-w64-mingw32/lib/libharfbuzz.a(libharfbuzz_la-hb-uniscribe.o):hb-uniscribe.cc:(.text+0xfd9): undefined reference to `_ScriptPlaceOpenType@72'
collect2: ld returned 1 exit status



AddFontMemResourceEx come from Gdi32.dll according to:
http://msdn.microsoft.com/en-us/library ... 85%29.aspx

It seams that the gdi32 lib is missing or is not found.

I can find it there:
# locate gdi32
/usr/i686-w64-mingw32/lib/libgdi32.a
/usr/x86_64-w64-mingw32/lib/libgdi32.a

I tried to add the gdi32 to libass in the configure.ac file:
if test "${SYS}" = "mingw32"; then
VLC_ADD_LIBS([libass],[-lgdi32])
fi

then bootstrap, configure and make, but still does not work :(

somebody can help me?

Thanks

bendanan
Blank Cone
Blank Cone
Posts: 13
Joined: 02 Aug 2011 02:59
VLC version: vlc-2.1.0-git
Operating System: Linux, Windows
Location: Modi'in - Israël

Re: cross compilation for windows from ubuntu

Postby bendanan » 21 Aug 2012 11:49

ok, no answer :(
Perhaps I didn't give enough informations?
or, this is not the right forum?

bendanan
Blank Cone
Blank Cone
Posts: 13
Joined: 02 Aug 2011 02:59
VLC version: vlc-2.1.0-git
Operating System: Linux, Windows
Location: Modi'in - Israël

Re: cross compilation for windows from ubuntu

Postby bendanan » 21 Aug 2012 12:00

To go further, I have disabled libass, which does not link here, with --disable-libass in the configure of VLC.
make
make package-win32

I got a binary.

When I launch vlc.exe -H, I got an exception 'unhandled vlc exception'.

Here is the log :

Usage: vlc [options] [stream] ...
You can specify multiple streams on the commandline.
They will be enqueued in the playlist.
The first item specified will be played first.

Options-styles:
--option A global option that is set for the duration of the program.
-option A single letter version of a global --option.
:option An option that only applies to the stream directly before it
and that overrides previous settings.

Stream MRL syntax:
[[access][/demux]://]URL[#[title][:chapter][-[title][:chapter]]]
[:option=value ...]

Many of the global --options can also be used as MRL specific :options.
Multiple :option=value pairs can be specified.

URL syntax:
...............

No matching module found. Use --list or --list-verbose to list available modules.

Qt interface
--qt-minimal-view, --no-qt-minimal-view
Start in minimal view (without menus)
(default disabled)
Start in minimal view (without menus) (default disabled)
--qt-system-tray, --no-qt-system-tray
Systray icon (default enabled)
Show an icon in the systray allowing you to control VLC media player
for basic actions. (default enabled)
--qt-notification={0 (Never), 1 (When minimized), 2 (Always)}
Show notification popup on track change
Show a notification popup with the artist and track name when the
current playlist item changes, when VLC is minimized or hidden.
--qt-start-minimized, --no-qt-start-minimized
Start VLC with only a systray icon (default
disabled)
VLC will start with just an icon in your taskbar (default disabled)
--qt-pause-minimized, --no-qt-pause-minimized
Pause the video playback when minimized
(default disabled)
With this option enabled, the playback will be automatically paused
when minimizing the window. (default disabled)
--qt-opacity=<float [0.100000 .. 1.000000]>
Windows opacity between 0.1 and 1
Sets the windows opacity between 0.1 and 1 for main interface,
playlist and extended panel. This option only works with Windows and
X11 with composite extensions.
--qt-fs-opacity=<float [0.100000 .. 1.000000]>
Fullscreen controller opacity between 0.1 and
1
Sets the fullscreen controller opacity between 0.1 and 1 for main
interface, playlist and extended panel. This option only works with
Windows and X11 with composite extensions.
--qt-video-autoresize, --no-qt-video-autoresize
Resize interface to the native video size
(default enabled)
You have two choices:
- The interface will resize to the native
video size
- The video will fit to the interface size
By default,
interface resize to the native video size. (default enabled)
--qt-name-in-title, --no-qt-name-in-title
Show playing item name in window title
(default enabled)
Show the name of the song or video in the controller window title.
(default enabled)
--qt-fs-controller, --no-qt-fs-controller
Show a controller in fullscreen mode (default
enabled)
Show a controller in fullscreen mode (default enabled)
--qt-recentplay, --no-qt-recentplay
Save the recently played items in the menu
(default enabled)
Save the recently played items in the menu (default enabled)
unhandled vlc exception

error while opening file

nkoriyama
Cone that earned his stripes
Cone that earned his stripes
Posts: 338
Joined: 01 Sep 2011 20:50
VLC version: git
Operating System: Windows / Mac OS X
Location: Japan

Re: cross compilation for windows from ubuntu

Postby nkoriyama » 21 Aug 2012 18:14

I don't know why these references (AddFontMemResourceEx etc) are missing.
On my build environment, it works...

Anyway you can disable HarfBuzz when you build libass.
In contrib/src/ass/rules.mak, change "WITH_HARFBUZZ = 1" to "WITH_HARFBUZZ = 0".
How To Ask Questions The Smart Way http://www.catb.org/~esr/faqs/smart-questions.html
My hack for ISDB-T http://sdrv.ms/126weue

bendanan
Blank Cone
Blank Cone
Posts: 13
Joined: 02 Aug 2011 02:59
VLC version: vlc-2.1.0-git
Operating System: Linux, Windows
Location: Modi'in - Israël

Re: cross compilation for windows from ubuntu

Postby bendanan » 22 Aug 2012 22:31

Thanks nkoriyama for your answer.
With this modification, the compilation and link of VLC seams perfect and goes to the end.
I still have the problem of vlc.exe -H which raises the same exception and error message but this time it goes much further. I don’t know if this can help, but here are the last output lines:
--sout-x264-psy, --no-sout-x264-psy
Use Psy-optimizations (default enabled)
Use all visual optimizations that can worsen both PSNR and SSIM
(default enabled)
--sout-x264-level=<string> H.264 level
Specify H.264 level (as defined by Annex A of the standard). Levels
are not enforced; it's up to the user to select a level compatible
with the rest of the encoding options. Range 1 to 5.1 (10 to 51 is
also allowed). Set to 0 for letting x264 set level.
unhandled vlc exception
error while opening file

Apart from this error, when I open the preferences Window, all tabs are working but when I select the ‘Input / Codecs’ tab, the application exits. I don’t know if this is related.

Can you help me a little bit further?
What kind of information can I provide?

bendanan
Blank Cone
Blank Cone
Posts: 13
Joined: 02 Aug 2011 02:59
VLC version: vlc-2.1.0-git
Operating System: Linux, Windows
Location: Modi'in - Israël

Re: cross compilation for windows from ubuntu

Postby bendanan » 02 Sep 2012 16:52

Hi nkoriyama,

The compile problem of HARFBUZZ is only with the git version.
With stable version 2.0.3, this compile problem does not occurs, nor the -H option crash, nor the sound problem.

The git version has the following 2 problems:

1/ crash
--------
With the help of drmemory (http://code.google.com/p/drmemory), I found the crash problem of vlc -H.

contrib/win32/x264/x264.h define:
static const char * const x264_profile_names[] = { "baseline", "main", "high", "high10", "high422", "high444", 0 };
The last item is here 0. This is not the only case where a list is 0 terminated.

modules/codec/x264.c calls:
change_string_list( x264_profile_names, x264_profile_names )
which compute the size of the list with:
(size_t)(sizeof (list) / sizeof (char *))
Here the size of the list (p_item->list_count) is one more than needed because of the NULL item at the end of the x264_profile_names list.

src/config/help.c use for CONFIG_ITEM_STRING:
for( i = 0; i < p_item->list_count; i++ )
{
if( i ) strcat( psz_buffer, "," );
strcat( psz_buffer, p_item->list.psz );
}
The strcat fail for the last NULL item.

We have to add the following in the loop:
if( p_item->list.psz == NULL ) break;

For CONFIG_ITEM_INTEGER, it can be:
if( p_item->list_text == NULL ) break;

I will email a patch in the devel mail list.

2/ sound
--------
Still remains a problem with some video files for which Git version does not play any sound.
No sound is played for a file that I have and which use the codec:Windows Media Audio 2(WMA2).

nkoriyama
Cone that earned his stripes
Cone that earned his stripes
Posts: 338
Joined: 01 Sep 2011 20:50
VLC version: git
Operating System: Windows / Mac OS X
Location: Japan

Re: cross compilation for windows from ubuntu

Postby nkoriyama » 03 Sep 2012 06:10

The compile problem of HARFBUZZ is only with the git version.
With stable version 2.0.3, this compile problem does not occurs, nor the -H option crash, nor the sound problem.
Because HarfBuzz doesn't exist on vlc-2.0.git.
Anyway I will see if the compilation fail will occur on Ubuntu.
At the moment, I build win32/64 build (VLC and contribs) with mingw-w64 on OS X, and I have no trouble.
How To Ask Questions The Smart Way http://www.catb.org/~esr/faqs/smart-questions.html
My hack for ISDB-T http://sdrv.ms/126weue

nkoriyama
Cone that earned his stripes
Cone that earned his stripes
Posts: 338
Joined: 01 Sep 2011 20:50
VLC version: git
Operating System: Windows / Mac OS X
Location: Japan

Re: cross compilation for windows from ubuntu

Postby nkoriyama » 03 Sep 2012 17:34

I tried to add the gdi32 to libass in the configure.ac file:
if test "${SYS}" = "mingw32"; then
VLC_ADD_LIBS([libass],[-lgdi32])
fi
On Ubuntu, I confirm that libass plugin cannot be built.

gdi32 and usp10 are required. And these libraries must be placed after harfbuzz in modules/codec/Makefile, like:

Code: Select all

LIBASS_LIBS = -L/home/nkoriyama/src/vlc/contrib/i686-w64-mingw32/lib -lass -lm -lharfbuzz -lgdi32 -lusp10 -lfontconfig -lxml2 -liconv -lfribidi -lfreetype -lz
If "-lgdi32 -lusp10" is before "-lharfbuzz", linking fails.

So, modify contrib/i686-w64-mingw32/lib/pkgconfig/harfbuzz.pc:

Code: Select all

Libs: -L${libdir} -lharfbuzz -lgdi32 -lusp10
I'll submit a patch later.
How To Ask Questions The Smart Way http://www.catb.org/~esr/faqs/smart-questions.html
My hack for ISDB-T http://sdrv.ms/126weue

dreamerZM
New Cone
New Cone
Posts: 8
Joined: 15 Aug 2012 16:02

Re: cross compilation for windows from ubuntu

Postby dreamerZM » 13 Sep 2012 09:52

Hi bendanan
I have meet the same problem , have you solved this problem?

also i meet this problem:

CCLD libpostproc_plugin.la
Creating library file: .libs/libpostproc_plugin.dll.a
.libs/libpostproc_plugin_la-postproc.o: In function `ClosePostproc':
/home/shrek/vlc/win32/modules/video_filter/../../../extras/package/win32/../../../modules/video_filter/postproc.c:272: undefined reference to `_pp_free_context'
/home/shrek/vlc/win32/modules/video_filter/../../../extras/package/win32/../../../modules/video_filter/postproc.c:273: undefined reference to `_pp_free_mode'
.libs/libpostproc_plugin_la-postproc.o: In function `PPChangeMode':
/home/shrek/vlc/win32/modules/video_filter/../../../extras/package/win32/../../../modules/video_filter/postproc.c:348: undefined reference to `_pp_get_mode_by_name_and_quality'
/home/shrek/vlc/win32/modules/video_filter/../../../extras/package/win32/../../../modules/video_filter/postproc.c:354: undefined reference to `_pp_free_mode'
/home/shrek/vlc/win32/modules/video_filter/../../../extras/package/win32/../../../modules/video_filter/postproc.c:363: undefined reference to `_pp_free_mode'
.libs/libpostproc_plugin_la-postproc.o: In function `PostprocPict':
/home/shrek/vlc/win32/modules/video_filter/../../../extras/package/win32/../../../modules/video_filter/postproc.c:327: undefined reference to `_pp_postprocess'
.libs/libpostproc_plugin_la-postproc.o: In function `OpenPostproc':
/home/shrek/vlc/win32/modules/video_filter/../../../extras/package/win32/../../../modules/video_filter/postproc.c:180: undefined reference to `_pp_get_context'
/home/shrek/vlc/win32/modules/video_filter/../../../extras/package/win32/../../../modules/video_filter/postproc.c:205: undefined reference to `_pp_get_mode_by_name_and_quality'
/home/shrek/vlc/win32/modules/video_filter/../../../extras/package/win32/../../../modules/video_filter/postproc.c:214: undefined reference to `_pp_free_context'
collect2: ld returned 1 exit status
make[4]: *** [libpostproc_plugin.la] Error 1
make[4]: Leaving directory `/home/shrek/vlc/win32/modules/video_filter'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/shrek/vlc/win32/modules/video_filter'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/shrek/vlc/win32/modules'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/shrek/vlc/win32'
make: *** [all] Error 2

thanks

bendanan
Blank Cone
Blank Cone
Posts: 13
Joined: 02 Aug 2011 02:59
VLC version: vlc-2.1.0-git
Operating System: Linux, Windows
Location: Modi'in - Israël

Re: cross compilation for windows from ubuntu

Postby bendanan » 14 Sep 2012 16:02

I'll submit a patch later.
Yes, your patch works.

bendanan
Blank Cone
Blank Cone
Posts: 13
Joined: 02 Aug 2011 02:59
VLC version: vlc-2.1.0-git
Operating System: Linux, Windows
Location: Modi'in - Israël

Re: cross compilation for windows from ubuntu

Postby bendanan » 14 Sep 2012 16:16

Hi bendanan
I have meet the same problem , have you solved this problem?

also i meet this problem:

CCLD libpostproc_plugin.la
Creating library file: .libs/libpostproc_plugin.dll.a
thanks
Hi dreamerZM,
Yes, it works. I don't have any problem with libpostproc.
It seams that the sources that are in the git repository don't compile from time to time ...
At least for me, the current sources don't compile with the following error:

Code: Select all

../../../extras/package/win32/../../../modules/codec/avcodec/dxva2.c:80:20: fatal error: dxva.h: No such file or directory compilation terminated. make[4]: *** [libavcodec_plugin_la-dxva2.lo] Error 1 make[4]: Leaving directory ` ... /win64/modules/codec'
This compil error is *before* libpostproc, but going in modules/video_filter, and doing make, libpostproc compile.
Sorry to not being more helpful :?

bendanan
Blank Cone
Blank Cone
Posts: 13
Joined: 02 Aug 2011 02:59
VLC version: vlc-2.1.0-git
Operating System: Linux, Windows
Location: Modi'in - Israël

Re: cross compilation for windows from ubuntu

Postby bendanan » 14 Sep 2012 16:29

the following patch works for me:

Code: Select all

diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index b22b248..178f5a2 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -76,8 +76,6 @@ # undef MS_GUID # define MS_GUID DEFINE_GUID /* dxva2api.h fails to declare those, redefine as static */ # define DXVA2_E_NEW_VIDEO_DEVICE MAKE_HRESULT(1, 4, 4097) -# else -# include <dxva.h> # endif #endif /* __MINGW32__ */

JohnPeterson
New Cone
New Cone
Posts: 4
Joined: 26 Mar 2012 08:10

Re: cross compilation for windows from ubuntu

Postby JohnPeterson » 17 Sep 2012 10:23

The file was added 2012-06-28 svn log https://mingw-w64.svn.sourceforge.net/svnroot/mingw-w64 -v --diff -r5149|colordiff to match the Windows header names.

The latest .deb are too old.

But it only has content that dxva2api.h had previously, an empty dxva.h will therefore suffice touch /usr/i686-w64-mingw32/include/dxva.h.

bendanan
Blank Cone
Blank Cone
Posts: 13
Joined: 02 Aug 2011 02:59
VLC version: vlc-2.1.0-git
Operating System: Linux, Windows
Location: Modi'in - Israël

Re: cross compilation for windows from ubuntu

Postby bendanan » 19 Sep 2012 12:31

Thanks a lot.
It's working


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

Who is online

Users browsing this forum: No registered users and 11 guests