My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
MacBuild  
Compilation on Mac OSX.
Updated Oct 13, 2010 by andres.c...@gmail.com

Compilation of GStreamer for the Mac platform is in its earlier stages. MacPorts is currently used as the mechanism to resolve dependencies, apply patches and build the binaries. This is followed by some post-build steps to remove absolute paths in the resulting .dylib and .so files (which MacPorts sets by default to /opt/local/lib).

Target platform: 32 bits

  • Install macports for your development platform. Completely remove older install if present:
  • > sudo rm -rf \
        /opt/local \
        /Applications/DarwinPorts \
        /Applications/MacPorts \
        /Library/LaunchDaemons/org.macports.* \
        /Library/Receipts/DarwinPorts*.pkg \
        /Library/Receipts/MacPorts*.pkg \
        /Library/StartupItems/DarwinPortsStartup \
        /Library/Tcl/darwinports1.0 \
        /Library/Tcl/macports1.0 \
        ~/.macports
  • Edit /opt/local/share/macports/Tcl/port1.0/portconfigure.tcl and replace the line:
  • default configure.ldflags   {-L${prefix}/lib}
with:
default configure.ldflags   {"-L${prefix}/lib -Xlinker -headerpad_max_install_names"}

this will allow to change later the absolute dependency paths embedded in the .dylib and .so files by relative paths.

  • Use the portfiles included in the svn to create a local repository. Add the location of the local repository to the /opt/local/macports/source.conf file, as explained here.
  • Add the line:
  • build_arch  i386
to /opt/local/etc/macports/macports.conf.
  • Install the gstreamer, gst-plugins-base, gst-plugins-good, gst-plugins-bad and gst-plugins-ugly packages:
  • > sudo port install gstreamer
    > sudo port install gst-plugins-base +no_x11 +no_gnome_vfs
    > sudo port install gst-plugins-good
    > sudo port install gst-plugins-bad +no_x11 +dc1394
    > sudo port install gst-plugins-ugly
  • Installation of gst-ffmpeg:
  • > sudo port install gst-ffmpeg
will fail during the build stage, at least for version 0.10.10. Inspection of the log file will show this error:
libavcodec/cabac.h: In function ‘get_cabac_noinline’:
libavcodec/cabac.h:527: error: PIC register ‘%ebx’ clobbered in ‘asm’
libavcodec/cabac.h: In function ‘decode_cabac_mb_intra4x4_pred_mode’:
libavcodec/cabac.h:527: error: PIC register ‘%ebx’ clobbered in ‘asm’
libavcodec/cabac.h:527: error: PIC register ‘%ebx’ clobbered in ‘asm’
libavcodec/cabac.h:527: error: PIC register ‘%ebx’ clobbered in ‘asm’
libavcodec/cabac.h:527: error: PIC register ‘%ebx’ clobbered in ‘asm’
libavcodec/cabac.h: In function ‘decode_cabac_mb_ref’:
libavcodec/cabac.h:527: error: PIC register ‘%ebx’ clobbered in ‘asm’
libavcodec/cabac.h: In function ‘decode_cabac_mb_mvd’:
libavcodec/cabac.h:527: error: PIC register ‘%ebx’ clobbered in ‘asm’
libavcodec/cabac.h:527: error: PIC register ‘%ebx’ clobbered in ‘asm’
libavcodec/cabac.h:641: error: PIC register ‘%ebx’ clobbered in ‘asm’
Change into the <local repository>/gnome/gst-ffmpeg/work/gst-ffmpeg-0.10.10 folder.
  1. Edit gst-libs/ext/ffmpeg/config.h and make sure that the macro HAVE_EBX_AVAILABLE is defined as zero:
  2. #define HAVE_EBX_AVAILABLE 0
  3. Add the following macro definition:
  4. #define HAVE_MMX 0
to gst-libs/ext/ffmpeg/libswscale/rgb2rgb_template.c.
These workarounds were found in this bug report.
  • Still in <local repository>/gnome/gst-ffmpeg/work/gst-ffmpeg-0.10.10 run:
  • > sudo make
followed by:
> sudo make install
to manually complete the compilation and installation of gst-ffmpeg.

Target platform: 64 bits

The steps to compile for a 64 bits platform are almost identical, with a few exceptions:

  • Specify 64 bits architecture in /opt/local/etc/macports/macports.conf:
  • build_arch x86_64
although if you are compiling on a 64 bits platform, the target is assumed to be 64 bits by default.
  • The compilation of gst-ffmpeg completes without error, so no there is no need to apply the workaround described before.
  • One thing to note is that the osxvideosrc plugin is missing from the 64 bits builds, because it uses the older 32-bit Carbon QuickTime API, which has been deprecated in 64-bit mode. The plugin needs to be rewritten for the newer Cocoa QTKit API (which will work in 32-bit and 64-bit modes).

Compiling on a different platform

The steps above assume that you are compiling GStreamer on the same platform as the target. But if you are compiling in Snow Leopard (10.6) with the intention to generate binaries for Leopard (10.5), then you need to do a few additional things right after installing MacPorts and before installing any ports:

  • In /opt/local/share/macports/Tcl/port1.0/portconfigure.tcl have two more linker flags added to the defaults:
  • default configure.ldflags   {"-L${prefix}/lib -Xlinker -headerpad_max_install_names -mmacosx-version-min=10.5 -no_compact_linkedit"}
(Based on this discussion).
  • Add the following line:
  • macosx_deployment_target 10.5
to /opt/local/etc/macports/macports.conf. For more details, see here and here.

Additional steps to create GStreamer binaries for bundling with 3rd-party applications

  • You only need /opt/local/lib, so copy it to some other location.
  • Remove .la, .a files.
  • Remove all subfolders, with the exception of /lib/gstreamer-0.10 (containing the plugins).
  • Any other file that is not .dylib in /lib or .so in lib/gstreamer-0.10 can be removed as well.
  • Replace absolute paths with relative paths using the replacepath.py tool.
    1. For base libs:
    2. > ./replacepath.py --old /opt/local/lib/ --new @loader_path/ --dir <lib folder>
    3. For plugins (note that here we use the relative path @loader_path/../ instead of @loader_path/):
    4. > ./replacepath.py --old /opt/local/lib/ --new @loader_path/../ --dir <lib folder>/gstreamer-0.10
  • If also needed, eliminate symbolic links using the removesymlinks.py tool:
  • > ./removesymlinks.py --dir <lib folder>

The replacepath.py and removesymlinks.py tools are located in the ossbuild source trunk here.


Sign in to add a comment
Powered by Google Project Hosting