Skip to content

GPAC Build Guide for Linux

Aurelien David edited this page Apr 12, 2019 · 2 revisions

HOME » Build » Linux

The following instructions will be based on Ubuntu and Debian. It should be easily applicable to other distros, the only changes should be name of the packages to be installed, and the package manager used.

MP4Box only

To build only the MP4Box command line utility, you need to:

  1. Install zlib
$ sudo apt-get install zlib1g-dev
  1. Get the code
$ git clone https://github.com/gpac/gpac gpac_public
$ cd gpac_public
  1. Build
$ ./configure --static-mp4box
$ make
  1. Use

You can either:

  • sudo make install to install the binary,
  • or use the MP4Box binary in gpac_public/bin/gcc/ directly,
  • or move/copy it somewhere manually.

Full GPAC build

In order to do a full build, we'll first have to handle the dependencies. On Linux, we try to rely on system dependencies (i.e. installable packages) as much as possible and only build the rest manually.

Setting up

We first need to install some building tools:

$ sudo apt-get install build-essential pkg-config g++ git scons cmake yasm

Next we install the development libraries we'll need to build gpac.

$ sudo apt-get install zlib1g-dev libfreetype6-dev libjpeg62-dev libpng-dev libmad0-dev libfaad-dev libogg-dev libvorbis-dev libtheora-dev liba52-0.7.4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libavdevice-dev libxv-dev x11proto-video-dev libgl1-mesa-dev x11proto-gl-dev libxvidcore-dev libssl-dev libjack-dev libasound2-dev libpulse-dev libsdl2-dev dvb-apps mesa-utils

This list should work on Ubuntu from 14.04 (trusty) to at least 18.10 (cosmic).

If you use Debian instead of Ubuntu, replace libjpeg62-dev with libjpeg62-turbo-dev. It should work on at least Debian 9 (stretch) and 10 (buster).

Building other dependencies

From now on, we'll call the base working directory <GPAC_ROOT_DIR>.

  1. Get the code
<GPAC_ROOT_DIR>$ git clone https://github.com/gpac/gpac gpac_public

<GPAC_ROOT_DIR>$ git clone https://github.com/gpac/deps_unix
<GPAC_ROOT_DIR>$ cd deps_unix
<GPAC_ROOT_DIR>/deps_unix$ git submodule update --init --recursive --force --checkout

The convention of calling the main gpac repo gpac_public here is quite important for some scripts. If you don't you'll have to adapt the scripts in deps_unix.

  1. Build the dependencies
<GPAC_ROOT_DIR>/deps_unix$ ./build_all.sh linux

If all went well, you should see some libs have been copied over to the gpac repo. It should look something like this:

<GPAC_ROOT_DIR>/deps_unix$ ls -l ../gpac_public/extra_lib/lib/gcc/
total 26836
-rw-r--r-- 1 adavid adavid 3160120 Apr  1 14:10 libavcap.a
-rw-r--r-- 1 adavid adavid  329528 Apr  1 14:09 libaxTLS.a
-rw-r--r-- 1 adavid adavid 4555206 Apr  1 14:12 libjs.a
-rw-r--r-- 1 adavid adavid 4764176 Apr  1 14:09 libNeptune.a
-rw-r--r-- 1 adavid adavid 3974842 Apr  1 14:12 libopenhevc.a
-rw-r--r-- 1 adavid adavid 1024832 Apr  1 14:10 libOpenSVCDec.a
-rw-r--r-- 1 adavid adavid 6425232 Apr  1 14:09 libPlatinum.a
-rw-r--r-- 1 adavid adavid  388740 Apr  1 14:09 libPltMediaConnect.a
-rw-r--r-- 1 adavid adavid  621284 Apr  1 14:09 libPltMediaRenderer.a
-rw-r--r-- 1 adavid adavid 1997878 Apr  1 14:09 libPltMediaServer.a
-rw-r--r-- 1 adavid adavid  205428 Apr  1 14:09 libZlib.a

Building GPAC

Now that all the set up is done, we can build gpac by simply doing:

<GPAC_ROOT_DIR>/gpac_public$ ./configure
<GPAC_ROOT_DIR>/gpac_public$ make
<GPAC_ROOT_DIR>/gpac_public$ sudo make install

Install for developers

If you want to use GPAC for development (in your own code for example), you can use make install-lib.

It will install the necessary libraries and header files. It will also install a gpac.pc file for pkg-config. With it you can build easily build projects that use the gpac library with something like:

$ gcc -o example $(pkg-config --cflags gpac) example.c $(pkg-config --libs gpac)

Packaging

To generate a .deb package, you can use make deb.

You will probably have to install so packaging tools to run it:

$ sudo apt-get install fakeroot dpkg-dev devscripts debhelper ccache
Clone this wiki locally
You can’t perform that action at this time.