How to cross-compile Xuggle-Xuggler for Windows 7 64 or 32 bit


Compile Xuggle-Xuggler on Ubuntu 11.10 64 or 32 on VirtualBox VM running over Windows 7 64 or 32 bit.


I’ve tested this process on a Windows 7 64 bit machine with a VirtualBox VM where I’ve installed two copies of Ubuntu 11.10 (one 64 bit and the other 32 bit).

Add required packages for compilation:

Java JDK:

sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk sun-java6-plugin

Select Oracle Hotspot VM:

sudo update-alternatives --config java

Confirm that you are using Hotspot VM with:

java -version

Compiler and other dev tools:

sudo apt-get install build-essential

Yasm:

sudo apt-get install yasm

OpenSSL:

sudo apt-get install openssl

Pkg-config:

sudo apt-get install pkg-config

Git:

sudo apt-get install git

Ant:

sudo apt-get install ant-optional

JUnit:

sudo apt-get install junit

Cross-Compiling package – MinGW 64bit:

sudo apt-get install mingw-w64

Get source code into a directory of your choice:
Note: Recently Art added a new branch dedicated to cross-compilation. You might want to test this branch instead.

git clone git://github.com/xuggle/xuggle-xuggler.git

or

git clone -b cross-compile git://github.com/xuggle/xuggle-xuggler.git

I’ve used the cross-compilation branch on my 32 bit compilation and the trunk on my 64 bit compilation.

Set environment variables (add them to ~/.profile if you wish):

export XUGGLE_HOME=/usr/local/xuggler
export PATH=$XUGGLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$XUGGLE_HOME/lib:$LD_LIBRARY_PATH

You need to compile using -fPIC due to the following issue:

1. Edit mk/buildtools/buildhelper.xml and add “–enable-pic” to:

<property name="configure.line"
      value="../../../configure --enable-pic ${build.configure.host.flag} ${build.configure.flag} ${build.configure.maintainer.flag} ${build.configure.debug.flag} --prefix=${xuggle.dir}"/>

2. Edit captive/libvpx/incarcerate.in and add -fPIC to:

CFLAGS="-fPIC @CFLAGS@"

Enable RTMP support (librtmp) – Optional

export XUGGLE_NATIVE_CONFIGURE="--enable-captive-librtmp"

Compile it for Linux:

ant run-tests

Note: If the junit tests fail to compile it might be because the shared libs are not being found (you might have used a different place for XUGGLE_HOME, like I did). To fix this just run “ant install” and re-run the tests “ant run-tests”.

Cross-Compile it for Windows 7 64 bit:

ant -Dbuild.configure.os=x86_64-w64-mingw32 run-tests

Cross-Compile it for Windows 7 32 bit:

ant -Dbuild.configure.os=i686-w64-mingw32 run-tests

Note: Tests will fail for cross compilation since it can not execute the Windows tests on Ubuntu. Before you cross-compile make sure you clean everything from your XUGGLER_HOME directory.

Install packages for Win64:

ant -Dbuild.configure.os=x86_64-w64-mingw32 install

Install packages for Win32:

ant -Dbuild.configure.os=i686-w64-mingw32 install

The install will fail to copy the necessary java jars. Fix it by creating the following directories:

mkdir $XUGGLE_HOME/share/java
mkdir $XUGGLE_HOME/share/java/jars

Copy the jars from your build directory:

cp dist/lib/*.jar $XUGGLE_HOME/share/java/jars

Copy the files from XUGGLE_HOME into Windows 7 64 or 32 bit, install a 64 or 32 bit Java VM respectively in it and you are good to go.

Note: An easy way to copy the files to Windows 7 is to make use of VirtualBox shared folders as shown here.

Enjoy!

About CrazyPenguin

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

20 Responses to How to cross-compile Xuggle-Xuggler for Windows 7 64 or 32 bit

  1. Sean says:

    Thank you so much for posting this. a few questions and comments.
    Questions:
    Is this working for you with the the latest revision from git? Are you using a version you previously pulled from git? I’m doing this from a brand new bare metal Ubuntu 11.10 and ‘ant run-tests’ fails about half way through(it’s not the libraries problem you mention above). There seems to be many having these same sorts of problems at the ‘ant run-tests’ stage with the current git status (according to the Google group for Xuggle). If this is working for you with the current git revision, you may very well be one of the few. Any idea what is special about your 11.10 install? Any chance of getting you to tar up your whole build directory and posting it somewhere?

    comments:
    you may want to add ‘sudo apt-get install build-essential’ so that gcc and g++ ,gmake, etc. are for certain on the person’s machine….unless mingw64 does that. (I don’t think it did for me)
    ‘mk/buildtools/builderhelper.xml’ is ‘mk/buildtools/buildhelper.xml’ in the latest git version.

    • CrazyPenguin says:

      Sean,

      Yes, it us the latest. I installed everything last friday, including VirtualBox, Ubuntu 11.10 and code from git repository. Your comments are correct, forgot to add essentials and the builderhelper.xml is a typo.

      I’ll see what I can do about your request.

    • CrazyPenguin says:

      Here is my xuggle dir (does not include the build or the dist). If you were really mentioning the build dir I can try to pack that to (about 1/2 a gig). Rename the .doc to .tgz

      • Sean says:

        ok, great thanks! I will give this a shot. Is your 11.1 on a virtualbox vm? Is the ubuntu 11.1 you have 32bit or 64bit? did you install xuggler on a new, completely clean install of 11.1, or had you installed previous versions of xuggle (or anything else) on it, prior to doing the above? thanks again for your help.

      • CrazyPenguin says:

        Update: I’ve now successfully compiled with support for librtmp.

        — // —

        Sean,

        No, I did not have a previous version of Xuggle installed on the machine I’ve tried. Not on Windows and not on the VM.
        Everything is 64 bit and freshly installed. Env details below.

        System:
        Windows 7 64 bit (Host)
        Oracle VirtualBox 4.1.10
        Ubuntu 11.10 64 bit (Guest) – installed using ubuntu-11.10-desktop-amd64.iso

        VM environment detail:
        RAM 2048 (1/2 of my computer memory)
        Processors 2 (CPU is an Intel Core 2 Duo P8600 @ 2.4Ghz)
        Hardware Acceleration: VT-x/AMD-V (nested paging enabled)
        Chipset: PIIX 3
        Extended features: IO APIC (also UTC clock and absolute pointing device, not that matters)
        Display: 128 MG with 3D (you need to install VirtualBox Guest Additions on Ubuntu 11.10)
        Recommend a minimum of 10GB hard-drive for the VM.

        In addition, I’ve first compiled Xuggler for Linux using “ant run-tests” and it failed because native libs were not being found in the staging dir. To fix it I just executed “ant install” and the libs were now available on my XUGGLER_HOME directory. After that “ant run-tests” worked just fine. Then I removed everything from XUGGLER_HOME and compiled Xuggler for windows using “ant -Dbuild.configure.os=x86_64-w64-mingw32 run-tests” which will fail to execute the tests, but the compilation will go just fine. To install it do “ant -Dbuild.configure.os=x86_64-w64-mingw32 install-native install-java install”, it will fail to copy the jars but they have been created just fine and all you have to do is to follow that step from the post above. Pack everything, move it windows platform and test it.

        Important side note: I did not compile Xuggler with support for librtmp.

        Hope this helps, good luck

  2. Steve says:

    Hi, When doing ant run-test or ant install is it suppose to install something to XUGGLER_HOME? Because when i check usr/local/ there is not even a folder xuggler.

  3. winston says:

    Hi, I have this problem with cross platform compile. I am using mac ox lion. Running vmware fusion on it. I tried to follow the instruction on this blog and failed…. Do i need to use 32bit jdk to build 32bit xuggler for windows and use 64bit jdk to build 64 one?

  4. janoti says:

    Hi all,
    I cross compiled xuggler for windows 32 bit with MinGW.
    after installation all the libxuggler.dll copied into my C:\XUGGL\bin
    and I copied all the jar files from dist directory to C:\XUGGLE\share\java\jars.

    I want to test the xugger with a sample program but it is saying

    ERROR com.xuggle.ferry.JNILibraryLoader – Could not load library: xuggle; version: 5; Visit http://www.xuggle.com/xuggler/faq/ to find common solutions to this problem
    Exception in thread “main” java.lang.UnsatisfiedLinkError: no xuggle in java.library.path

  5. Pingback: Récréation n°008 « Mon Blog…

  6. jeff esposito says:

    I’m trying to follow your directions, but when I did this:

    “Before you cross-compile make sure you clean everything from your XUGGLER_HOME directory.”

    I ended up deleting the source. What exactly did you mean by the above statement? Is XUGGLER_HOME supposed to be a different directory than where the source is? Am I supposed to clean only the genereated files? Is the an ant target for doing so?

    • Valenthorpe says:

      XUGGLER_HOME should be a different empty directory on your system, when you build xuggler from the source it will fill that directory with built files, if i’m not mistaken

  7. jaykumarhk1 says:

    hi can you pls send me xuggler.exe for windows 7 64bit?

  8. Pingback: Point Software AG

  9. Valenthorpe says:

    I love you for this. There’s nothing I love more than step by step instructions for doing things I’ve never done before. Thanks a lot!

Leave a reply to janoti Cancel reply