How to compile Xuggle-Xuggler in Windows 7 (32bit)

News: March 16 2012 – Great news folks… Xuggle Xuggler can now be compiled for win 64 through cross-compilation. Please check my new post here.

Note: This is still some work in progress since I’m using latest MinGW with gcc 4.6.1. Any help would be appreciated! After this I’ll try to build it in 64 bits.

Xuggle has some nice instructions on how to build the library. Still, Paul Gregoire has an even better and highly detailed guide on how to compile Xuggle on Windows (at the time, it was XP). Unfortunately that did not work on my Windows 7 system.

After digging in the issue at hand I’ve noticed that the ant ‘unix-pathconvert’ macro was not working correctly. To fix it just edit the file:

…\trunk\java\xuggle-xuggler\mk\buildtools\buildhelper.xml

and convert all ‘unix-pathconvert’ entries to ‘pathconvert’.

E.g. convert from:

<unix-pathconvert property="xuggle.dir" path="${xuggle.dir.native}"/>

to:

<path id="windows.path">
  <pathelement location="${xuggle.dir.native}"/>
</path>
<pathconvert targetos="unix" property="xuggle.dir" refid="windows.path">
  <map from="c:" to="/c"/>
</pathconvert>

This will allow ant to initiate the compilation process.

If you are using Paul Gregoire pre-packaged MinGW/MSYS version then this should be all you need to have Xuggle compiled.

If you’re using latest MinGW with GCC 4.6.1 then you’ll notice that GCC 4.6.1 will end-up complaining with a “can’t create executables” message. This is because automake configurations are passing the “-mno-cygwin” flag to the compiler which has been removed from the most recent compiler versions. To fix this edit the following files and change them so that no longer includes the referred compiler flag:

…\trunk\java\xuggle-xuggler\configure

#  CC="gcc -mno-cygwin "
  CC="gcc "
#  CXX="g++ -mno-cygwin "
  CXX="g++ "

…\trunk\java\xuggle-xuggler\captive\configure

#  CC="gcc -mno-cygwin "
#  CXX="g++ -mno-cygwin "
  CC="gcc "
  CXX="g++ "

Then under all …\trunk\java\xuggle-xuggler\captive\lib* directories, look for a file named incarcerate.in and remove that same flag from any environment variable:

#  CC="${CC} -mno-cygwin"
#  LDFLAGS="$LDFLAGS -mno-cygwin"
  CC="${CC}"
  LDFLAGS="$LDFLAGS"

This should allow for the compilation of all captives to succeed with the exception of FFmpeg. In addition to the previous -mno-cygwin flag, you’ll also have to remove or comment the –out-implib compiler flag from …\trunk\java\xuggle-xuggler\captive\ffmpeg\incarcerate.in file:

case $HOST_TYPE in
  Windows)
#  FFMPEG_OPTIONS="$FFMPEG_OPTIONS --extra-cflags=-mno-cygwin"
  FFMPEG_OPTIONS="$FFMPEG_OPTIONS"
  FFMPEG_OPTIONS="$FFMPEG_OPTIONS --extra-cflags=-fno-common"
#  FFMPEG_OPTIONS="$FFMPEG_OPTIONS --extra-ldflags=-mno-cygwin"
  FFMPEG_OPTIONS="$FFMPEG_OPTIONS"
#  FFMPEG_OPTIONS="$FFMPEG_OPTIONS --extra-ldflags=--out-implib"

Native unit testing will also fail with the following, quite funny, error:

[exec] ../../../../../../../../test/csrc/com/xuggle/xuggler/StreamCoderTest
.cpp:408: Error: Expected (num->getDouble() == h->expected_time_base), found (0.
0010 != 0.0010)
     [exec] ../../../../../../../../test/csrc/com/xuggle/xuggler/StreamCoderTest
.cpp:408: Error: Expected (num->getDouble() == h->expected_time_base), found (0.
0010 != 0.0010)
     [exec] ../../../../../../../../test/csrc/com/xuggle/xuggler/StreamCoderTest
.cpp:408: Error: Expected (num->getDouble() == h->expected_time_base), found (0.
0010 != 0.0010)
     [exec] Failed 1 of 9 tests
     [exec] Success rate: 88%
     [exec] FAIL: xugglerTestStreamCoder.exe
     [exec] Running 6 tests......OK!
     [exec] PASS: xugglerTestStreamCoderProperty.exe
     [exec] Running 3 tests...OK!
     [exec] PASS: xugglerTestStreamCoderX264.exe
     [exec] Running 1 test.OK!
     [exec] PASS: xugglerTestStreamCoderSpeex.exe
     [exec] Running 2 tests..OK!
     [exec] ERROR com.xuggle.xuggler - libfaac not supported by this build; igno
ring test (../../../../../../../../test/csrc/com/xuggle/xuggler/StreamCoderFaacT
est.cpp:78)
     [exec] PASS: xugglerTestStreamCoderFaac.exe
     [exec] Running 1 test.OK!
     [exec] PASS: xugglerTestStream.exe
     [exec] Running 4 tests....OK!
     [exec] PASS: xugglerTestTimeValue.exe
     [exec] Running 1 test.OK!
     [exec] PASS: xugglerTestError.exe
     [exec] Running 7 tests.......OK!
     [exec] PASS: xugglerTestVideoResampler.exe
     [exec] make[6]: *** [check-TESTS] Error 1
     [exec] make[5]: *** [check-am] Error 2
     [exec] make[4]: *** [check] Error 2
     [exec] ================================
     [exec] 3 of 24 tests failed
     [exec] Please report to in...@xuggle.com
     [exec] ================================

I’m assuming this is because I’m using GCC 4.6.1. Initially I thought it was due to some sort of precision issue. After all, it is reporting the following:

found (0.0010 != 0.0010) 

which happens to be the same but somehow it is still failing. While debugging for the error, I’ve edited the file

…\trunk\java\xuggle-xuggler\share\cxxtest\cxxtest\TestSuit.h

and added the following code:

...

#ifdef _CXXTEST_HAVE_STD
#   include <stdexcept>
#endif // _CXXTEST_HAVE_STD

#include <iostream> // <-- Line added

...

    template<class X, class Y>
    bool equals( X x, Y y )
    {
        std::cerr << "X = " << x << std::endl; // <-- Line added
        std::cerr << "Y = " << y << std::endl; // <-- Line added

        return (x == y);
    }

...

And this was enough to make all native tests pass??? Go figure!

I’m still to test if all it needs is to have the file simply “touched” in order to force the compilation process to re-compile (I’m not familiar with cxxtest lib at all).

But wait… we are not finished yet! The next thing to fail are the JUnit tests due to an ivy issue with JUnit library. To fix it I’ve modified the junit entry in the ivy.xml from:

    <!--  Include for JUnit Test framework -->
    <dependency org="junit" name="junit" rev="4.5" conf="test" />

to:

    <!--  Include for JUnit Test framework -->
    <dependency org="junit" name="junit" rev="4.5" conf="*" />
Advertisements

About CrazyPenguin

Software Engineer
This entry was posted in Uncategorized. Bookmark the permalink.

20 Responses to How to compile Xuggle-Xuggler in Windows 7 (32bit)

  1. Pasquale says:

    Hi,
    thanks for shared info. You saved me! 🙂
    But, I need some help…enabling captive librtmp the build fail with this error:
    autom4te: failed to run /bin/m4: Bad file number
    aclocal: autom4te failed with exit status: 1

    Can you help me, please?

    • Pasquale says:

      I resolved…I re-installed autoconf-2.5 on MinGW from bin.
      Thanks.

      • CrazyPenguin says:

        Pasquale,

        That’s great because I haven’t tried to compile librtmp yet. Would you like to share the details? I’ll try it once I get some time.

        Thanks

      • Pasquale says:

        Sorry, but now I have another problem with build..seems that it doesn’t produce dll file for librtmp and than ffmpeg build fail because not found librtmp.
        I just enabled the compilation of the library by editing the buildhelper.xml:
        add –enable-captive-librtmp option to property “configure.line”.

      • CrazyPenguin says:

        What version of gcc are you using?
        Also, what version of openssl are you using? Did you compile OpenSSL in shared or static mode?

      • Pasquale says:

        My gcc version is 4.6.1 and 0.9.8h 28 May 2008 for openssl. But I have installed Openssl from windows installer, Win32OpenSSL_Light-1_0_0e.exe

      • CrazyPenguin says:

        Can you confirm that your configure scripts detects OpenSSL? You should see something like:

        [exec] checking for library containing zlibVersion… -lz
        [exec] checking for library containing SSL_library_init… yes
        [exec] checking whether to use captive version of librtmp… yes

      • Pasquale says:

        Yes, I confirm. The libraries used are: -lz -lws2_32 -lwinmm -lssl -lpthread -lgdi32 -lcrypto.

  2. Pasquale says:

    I have noticed there are a lot of error about “conftest.c” in config.log…I try to find it on my system but there isn’t anywhere. This tells you something?
    Thanks a lot

    • CrazyPenguin says:

      Pasquale,

      I’m trying to help but unfortunately I’m having issues with the configure script to find libssl. I’ve even installed the version you referred to (bin release 1.0.0e) in order to have it as similar as to what you have. I’ve even copied SSL exe’s and dlls into MinGW bin, libs into lib and openssl .h dir into include. So far no dice!

      I’m sure I’m missing something but so far I have no idea yet why configure script is not accepting OpenSSL.

      • Pasquale says:

        Have you installed Microsoft Visual C++ 2008 Redistributable before OpenSSL? It’s required. And if you try “openssl version” from MinGW prompt, does it work fine?

      • CrazyPenguin says:

        The problem was just in front of my eyes during the all time! For some strange reason, on Windows, libssl and libcrypto are compiled to ssleay32 and libeay32 respectively. Renaming them to their unix like names fixes it. I guess another possible fix could be to change configure.ac, but less one touches the conf files the better. Moving forward and compiling…

  3. CrazyPenguin says:

    Pasquale,

    Any news on this front? Have you been able to make it work? I’ve been able to compile librtmp but its only generating the static librtmp.a and I do not see any dll as one would expect for usage within ffmpeg. Dis you came across this issue to? If so how did you fix it?

  4. iqbalyusuf says:

    Kooool…. Waiting for your Win 64 bit tutorial 🙂

  5. izehhaf says:

    I have tried all solutions suggested here but it still not work, it dos not find libssl, any idea ?

    • CrazyPenguin says:

      Has been awhile since I’ve touched it, but yes, In the end I was able to add and compile librtmp with libssl but unfortunately I never got to get the necessary shared lib from it as required by ffmpeg. I was only able to get a static build of librtmp.

  6. A says:

    HI i am new to xuggler need your help badly….i have windows 7. and tried to build xuggler from Paul Gregoire’s Blog… in the end when i run “ant clobber” it gives error that ‘ant’ can not be recognized as an internal or external command…. please tell me whats going wrong…??

    • CrazyPenguin says:

      Try to follow the post above. I’ve been able to compile it for Windows 7 without SSL. Unfortunately my time is really tight right now to allow me to continue working on this post.

  7. TRXtER99 says:

    Hello, Thanks for this post. I Still have a problem when I run “ant run-tests dist”. It give me this problem:
    [exec] checking for faac.h… yes
    [exec] checking for library containing faacEncOpen… no
    [exec] configure: creating ./config.status
    [exec] config.status: creating Makefile
    [exec] config.status: creating Makefile.global
    [exec] config.status: error: cannot find input file: librtmp/Makefile.in
    [exec] configure: error: ../../../../captive/configure failed for captive

    BUILD FAILED
    C:\MinGW\home\trxter99\trunk\java\xuggle-xuggler\mk\buildtools\buildhelper.xml:1
    155: exec returned: 1

    Total time: 1 minute 45 seconds

    Do someone had solve this problem ? I previously did all the steps in this post and in “Paul’s” post.

    Thanks,

    TRXtER99

    • CrazyPenguin says:

      Cross-compilation is by far the easiest way to get Xuggler up and running on Windows 7. Check my new post on how to do it using Ubuntu 11.10 on a VirtualBox VM running on Windows 7 (64 bit).

      Hope this helps

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s