Difference between revisions of "MacOSCompile"

From VideoLAN Wiki
Jump to navigation Jump to search
(made it a bit more readable; hopefully...)
Line 6: Line 6:
  
 
Don't put any of the non-released test binaries or svn-compiles on software sites or on user-forums. We have had bad experiences with this before and we do not appreciate it.
 
Don't put any of the non-released test binaries or svn-compiles on software sites or on user-forums. We have had bad experiences with this before and we do not appreciate it.
 +
 +
''Be sure to read the paragraph on Mac OS X Leopard before starting the compilation.''
  
 
== Steps ==
 
== Steps ==
Line 15: Line 17:
 
Install the Mac OS X Developer Tools from the Developer Tools CD, or get them online.  
 
Install the Mac OS X Developer Tools from the Developer Tools CD, or get them online.  
  
You need at least Mac OS X 10.4.x and Xcode 2.4.x (or later) for compilation.  
+
You need at least Mac OS X 10.4.x and Xcode 2.4.x (or Xcode 2.5) for compilation.  
  
 
Compiling with earlier releases of Mac OS X and/or Xcode will not work. Note, that only VLC's current development trunk can be compiled on Mac OS X 10.5 Leopard. Any stable branch cannot, while the 0.8.6 series compiled on 10.4 Tiger works on Leopard as expected.
 
Compiling with earlier releases of Mac OS X and/or Xcode will not work. Note, that only VLC's current development trunk can be compiled on Mac OS X 10.5 Leopard. Any stable branch cannot, while the 0.8.6 series compiled on 10.4 Tiger works on Leopard as expected.
Line 34: Line 36:
 
* cd to the extras/contrib subdir of VLC and execute <code>./bootstrap</code>
 
* cd to the extras/contrib subdir of VLC and execute <code>./bootstrap</code>
 
* Now execute <code>make src</code>. This will download and compile all the required external libraries and programs. You will only have to do this once. (You can do it again if required libraries are added or updated by the team.)
 
* Now execute <code>make src</code>. This will download and compile all the required external libraries and programs. You will only have to do this once. (You can do it again if required libraries are added or updated by the team.)
''Note that the 10.4u SDK is required for the default compilation of this contributed code. If you encounter problems, make sure that your default GCC version is set to 4 and your Xcode installation's version is 2.4.x or later. If bootstrap exits with an error message on Mac OS X Leopard, check the paragraph on this version below.''
+
''Note that the 10.4u SDK is required for the default compilation of this contributed code. If you encounter problems, make sure that your default GCC version is set to 4 and your Xcode installation's version is 2.4.x or 2.5. If bootstrap exits with an error message on Mac OS X Leopard, check the paragraph on this version below.''
  
 
=== Prepare the VLC build ===
 
=== Prepare the VLC build ===
Line 45: Line 47:
 
The next step is to configure, in the top level VLC source directory.
 
The next step is to configure, in the top level VLC source directory.
  
In current trunk revisions, you can simply run <code>./configure --enable-debug</code> to get VLC in its default configuration. If do not want to use VLC's default configuration for Mac, be sure to add <code>--disable-macosx-defaults</code> to your custom set.
+
In current trunk revisions, you can simply run <code>./configure --enable-debug --with-macosx-sdk</code> to get VLC in its default configuration. If do not want to use VLC's default configuration for Mac, be sure to add <code>--disable-macosx-defaults</code> to your custom set.
  
 
When compiling earlier revisions or the 0.8.6 branch, you need to give a wide variety of configure flags to achieve a useful build. We used to use this set:
 
When compiling earlier revisions or the 0.8.6 branch, you need to give a wide variety of configure flags to achieve a useful build. We used to use this set:
 
<code> ./configure --enable-debug --disable-x11 --disable-xvideo --disable-glx --enable-sdl --enable-mad --enable-libdvbpsi --enable-a52 --disable-dvdplay --enable-dvdnav --enable-dvdread --enable-ffmpeg --enable-faad --enable-flac --enable-vorbis --enable-speex --enable-theora --enable-ogg --enable-shout --enable-cddb --disable-cddax --enable-vcdx --disable-skins --disable-skins2 --disable-wxwidgets --enable-freetype --enable-fribidi --enable-caca --enable-live555 --enable-dca --enable-goom --enable-modplug --enable-gnutls --enable-daap --enable-ncurses --enable-libtwolame --enable-x264 --enable-png --enable-realrtsp --enable-lua --disable-libtool</code>
 
<code> ./configure --enable-debug --disable-x11 --disable-xvideo --disable-glx --enable-sdl --enable-mad --enable-libdvbpsi --enable-a52 --disable-dvdplay --enable-dvdnav --enable-dvdread --enable-ffmpeg --enable-faad --enable-flac --enable-vorbis --enable-speex --enable-theora --enable-ogg --enable-shout --enable-cddb --disable-cddax --enable-vcdx --disable-skins --disable-skins2 --disable-wxwidgets --enable-freetype --enable-fribidi --enable-caca --enable-live555 --enable-dca --enable-goom --enable-modplug --enable-gnutls --enable-daap --enable-ncurses --enable-libtwolame --enable-x264 --enable-png --enable-realrtsp --enable-lua --disable-libtool</code>
  
You can add <code>--with-mozilla-sdk-path=./extras/contrib/src/gecko-sdk --enable-mozilla</code> to the configure-line to enable the compilation of VLC's Safari/Firefox plugin. To ensure compatibility with Mac OS X 10.4.x when compiling on later releases, add <code>--with-macosx-sdk</code>. This also makes sure that current VLC versions cannot be launched on 10.3 and below, which would lead to unexpected results.
+
You can add <code>--with-mozilla-sdk-path=./extras/contrib/src/gecko-sdk --enable-mozilla</code> to the configure-line to enable the compilation of VLC's Safari/Firefox plugin.
  
 
=== Build VLC ===
 
=== Build VLC ===
Line 56: Line 58:
  
 
=== Special apostille on Mac OS X Leopard ===
 
=== Special apostille on Mac OS X Leopard ===
As widely published, this future version of Mac OS X includes a new release of Xcode, which 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:
+
As widely published, this version of Mac OS X includes a new release of Xcode, called Xcode 3, which includes may cool new features, but unfortunately, it is incompatible with VLC. You need Xcode 2.5 to compile VLC on Leopard, which can easily be installed in addition to your Xcode 3 tools. However, you need to edit your PATH variable before doing anything with VLC's source. In case that you installed to to the default location (<code>/Xcode2.5</code>) and you are using the default shell (<code>bash</code>), this is pretty simple:
 +
 
 +
<code>export PATH=/Xcode2.5/bin:/Xcode2.5/sbin:/Xcode2.5/usr/bin:/Xcode2.5/usr/sbin:$PATH</code>
 +
 
 +
Note that you need to repeat this PATH edit every time you relaunch the shell. You can avoid this by editing your bashrc file. Once Apple releases a fixed linker for Mac OS X Leopard, this work-around will not be necessary anymore and you can use Xcode 3 as expected.
 +
 
 +
 
 +
 
 +
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:
  
 
<code>usr, Headers, Private, SDKs, Tools, Makefiles</code>
 
<code>usr, Headers, Private, SDKs, Tools, Makefiles</code>

Revision as of 18:31, 11 November 2007

Compile VLC on Mac OS X

Compiling VLC media player on Mac OS X is different from normal linux compiling and OS X compiling. We do not use Xcode, but a simple ./configure and then make isn't enough either. The instructions below are always for the currently unstable, non-released code.

If you compile from Subversion then please remember that this code can often be in an unstable state. If you wish to develop or test please join the vlc-devel mailinglist.

Don't put any of the non-released test binaries or svn-compiles on software sites or on user-forums. We have had bad experiences with this before and we do not appreciate it.

Be sure to read the paragraph on Mac OS X Leopard before starting the compilation.

Steps

Please follow these steps for compiling:

Set the development environment

Install the Mac OS X Developer Tools from the Developer Tools CD, or get them online.

You need at least Mac OS X 10.4.x and Xcode 2.4.x (or Xcode 2.5) for compilation.

Compiling with earlier releases of Mac OS X and/or Xcode will not work. Note, that only VLC's current development trunk can be compiled on Mac OS X 10.5 Leopard. Any stable branch cannot, while the 0.8.6 series compiled on 10.4 Tiger works on Leopard as expected.

Additionally, you may need to install Subversion aka SVN on your Mac.

Get the source

Download the VLC media player source code (using subversion) as described on the "Get the source" page or get a recent source tarball. Note that the 3rd party libraries will probably break a few months after the release's publication.

Build external libs

We now need to build the 3rd party libs. For that, you will need to:

  • cd to the source directory with your Terminal application.
  • If you have fink, then you will need to disable it. VLC media player has it's own form of Fink (in the extras/contrib subdir) and it can conflict with Fink. We use this system to generate a reliable, consistent and known amount of packages that VLC media player requires.

To disable Fink comment the line: #source /sw/bin/init.csh in your .cshrc file or . /sw/bin/init.csh in your .bashrc file in your home-directory.

  • cd to the extras/contrib subdir of VLC and execute ./bootstrap
  • Now execute make src. This will download and compile all the required external libraries and programs. You will only have to do this once. (You can do it again if required libraries are added or updated by the team.)

Note that the 10.4u SDK is required for the default compilation of this contributed code. If you encounter problems, make sure that your default GCC version is set to 4 and your Xcode installation's version is 2.4.x or 2.5. If bootstrap exits with an error message on Mac OS X Leopard, check the paragraph on this version below.

Prepare the VLC build

Now we return to VLC itself. Go back to the top level VLC source directory. If you use Subversion (which you really should), then run ./bootstrap.

This will create configure and Makefiles for VLC media player (snapshots and releases already include this).

Configure the VLC build

The next step is to configure, in the top level VLC source directory.

In current trunk revisions, you can simply run ./configure --enable-debug --with-macosx-sdk to get VLC in its default configuration. If do not want to use VLC's default configuration for Mac, be sure to add --disable-macosx-defaults to your custom set.

When compiling earlier revisions or the 0.8.6 branch, you need to give a wide variety of configure flags to achieve a useful build. We used to use this set: ./configure --enable-debug --disable-x11 --disable-xvideo --disable-glx --enable-sdl --enable-mad --enable-libdvbpsi --enable-a52 --disable-dvdplay --enable-dvdnav --enable-dvdread --enable-ffmpeg --enable-faad --enable-flac --enable-vorbis --enable-speex --enable-theora --enable-ogg --enable-shout --enable-cddb --disable-cddax --enable-vcdx --disable-skins --disable-skins2 --disable-wxwidgets --enable-freetype --enable-fribidi --enable-caca --enable-live555 --enable-dca --enable-goom --enable-modplug --enable-gnutls --enable-daap --enable-ncurses --enable-libtwolame --enable-x264 --enable-png --enable-realrtsp --enable-lua --disable-libtool

You can add --with-mozilla-sdk-path=./extras/contrib/src/gecko-sdk --enable-mozilla to the configure-line to enable the compilation of VLC's Safari/Firefox plugin.

Build VLC

After configure is finished, we can finally build VLC media player. A simple make will do the trick. If you want to use the resulting application package on a different Mac or a different account on the same Mac, run make VLC-release.app afterwards. Use the resulting VLC-release.app for these purposes.

Special apostille on Mac OS X Leopard

As widely published, this version of Mac OS X includes a new release of Xcode, called Xcode 3, which includes may cool new features, but unfortunately, it is incompatible with VLC. You need Xcode 2.5 to compile VLC on Leopard, which can easily be installed in addition to your Xcode 3 tools. However, you need to edit your PATH variable before doing anything with VLC's source. In case that you installed to to the default location (/Xcode2.5) and you are using the default shell (bash), this is pretty simple:

export PATH=/Xcode2.5/bin:/Xcode2.5/sbin:/Xcode2.5/usr/bin:/Xcode2.5/usr/sbin:$PATH

Note that you need to repeat this PATH edit every time you relaunch the shell. You can avoid this by editing your bashrc file. Once Apple releases a fixed linker for Mac OS X Leopard, this work-around will not be necessary anymore and you can use Xcode 3 as expected.


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


History

Written by Jean-Alexis Montignies, Felix Paul Kühne and Derk-Jan Hartman, for the VideoLAN Team. Adapted to the Wiki by Jean-Baptiste Kempf.