Difference between revisions of "MacOSCompile"

From VideoLAN Wiki
Jump to navigation Jump to search
(remove useless step)
Line 146: Line 146:
 
MacOS X.5.SDK is broken.
 
MacOS X.5.SDK is broken.
  
* Download [http://ftp.videolan.org/pub/videolan/contrib/QTCaptureDecompressedAudioOutput.h QTCaptureDecompressedAudioOutput.h] and move it to ''/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QTKit.framework/Headers/''
+
* Download the MacOS10.6.sdk and get QTCaptureDecompressedAudioOutput.h from ''/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/QTKit.framework/Headers/'' and move it to ''/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QTKit.framework/Headers/''
  
 
* Edit ''/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QTKit.framework/Headers/QTKit.h'' and add the  
 
* Edit ''/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QTKit.framework/Headers/QTKit.h'' and add the  

Revision as of 01:15, 2 December 2011

This is an howto to compile VLC media player on Mac OS X, focused on VLC 1.2 and newer.

Pre-requisites

Apple

Check that the LLVM GCC 4.2 compiler is installed:

$ gcc --version

GCC 4.2 on Xcode 4.2

If you are on Xcode 4.2 with no previous Xcode installation, you NEED gcc-4.2 that isn't installed anymore.

Please install it from OSX-GCC installer.

$ gcc-4.2 --version

Git

You need to get Git to clone VLC.

You can use homebrew as:

$ brew install git

Get the source code

 $ git clone git://git.videolan.org/vlc.git

Additional development tools

You need all the autoconf tools to build it correctly.

This is automated for you:

 $ cd vlc/extras/tools
 $ ./bootstrap
 $ make
 $ cd ../..

SDK selection and 32/64 bits

SDK selection

If you want to use the 10.6 SDK (your VLC will only run on 10.6 and more recent computers):

$ export OSX_VERSION=10.6

You can do the same for 10.5, but please check that you have MacOSX10.5.sdk installed in /Developer/SDKs/ . If you are using Xcode 4.2, you can install the 10.5 sdk with the .dmg from Xcode3.

32/64bits selection

The instructions below will build a 64 bits binary using 10.6 (Leopard) SDK. This is reflected by using host and build variables x86_64-apple-darwin10.

This "triplet" is ARCHITECTURE-apple-SYSTEM.

ARCHITECTURE

  • x86_64 represents Intel 64bits.
  • i686 represents Intel 32bits.
  • powerpc represents PowerPC 32bits.

SDK SYSTEM

  • darwin9 represents MacOSX 10.5.
  • darwin10 represents MacOSX 10.6.

So to make a PowerPC build, you would use powerpc-apple-darwin9. So to make a intel32 build for 10.5+, you would use i686-apple-darwin9. So to make a intel64 build for 10.6+, you would use x86_64-apple-darwin10.

Prepare 3rd party libraries

Before compiling VLC, you need lots of other libraries. Here is how to get them:

 $ cd contrib
 $ mkdir -p osx && cd osx
 $ ../bootstrap --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10

Prebuilt libraries (recommended)

If you want to download a prebuilt package of all the needed libraries.

 $ make prebuilt

Build your own libraries (not for the faint-hearted)

If you want to build from source a package in the contribs:

 $ make -j4 .gettext
 $ export PATH=$PWD/../x86_64-apple-darwin10/bin:$PATH

Then:

 $ make -j4

If you had no errors, the 3rd party libraries (contrib) are built correctly and you can proceed to the next step.

Go Back

Go back to the VLC source directory:

 $ cd ../..

Bootstrap VLC

This will create the configure script:

 $ export PATH=$PWD/extras/tools/build/bin/:$PATH
 $ ./bootstrap

Configure the VLC build

Create a build folder:

 $ mkdir -p build && cd build

To list the different options of configure:

 $ ../extras/package/macosx/configure.sh --help

To build a 64 bits binary:

 $ ../extras/package/macosx/configure.sh --enable-debug --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10

Build VLC

 $ make -j4

and wait...

Package VLC Application for Mac

If you want to share the application with another user or another computer:

 $ make VLC-release.app

If you want a disk-image:

 $ make package-macosx

Respectively make package-macosx-plugin for the Safari/Mozilla plugin.

What's wrong: troubleshooting

Xcode path

Starting with Leopard, Xcode may be installed to a custom location on the administrator's choice. While this is non-problematic for ordinary Xcode projects, VLC needs a little help. You have to place extra symbolic links in /Developer pointing to your custom location for these folders:

usr, Headers, Private, SDKs, Tools, Makefiles

You can easily create these links by executing the following command for each folder (whereas theFolder is one of these six):

ln -s /full/path/to/Developer/theFolder /Developer/theFolder

Xcode version

Please make sure that you are using the latest Xcode3 or the latest version of Xcode4 to compile VLC

3rd party packagers and PATH

Pay careful attention to remove any reference to 3rd party package managersfrom your environment. This is important to avoid conflicts between your package manager (homebrew, fink, macports...) and the contrib package manager we use to build our contrib.

It shouldn't be necessary, but it can happen.

git must still be accessible though!

 $ unset PKG_CONFIG_PATH
 $ unset PKG_CONFIG_LIBDIR
 $ export PATH=$PWD/build/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin

QTsound compilation on X.5

MacOS X.5.SDK is broken.

  • Download the MacOS10.6.sdk and get QTCaptureDecompressedAudioOutput.h from /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/QTKit.framework/Headers/ and move it to /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QTKit.framework/Headers/
  • Edit /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QTKit.framework/Headers/QTKit.h and add the
  1. import <QTKit/QTCaptureDecompressedAudioOutput.h> where needed.