1 FOBS - BUILDING INSTRUCTIONS - 0.4.2
2 ------------------------------------
4 This document contains a full description of the FOBS build process. A simpler compilation guide, using all default options, which also covers some use cases can be found in file 'FOBS_GUIDE'.
8 Fobs requires two software packages in order to be built:
10 - ffmpeg (This Fobs version has been built successfully using: SVN revision 13764)
11 - scons (This Fobs version has been built successfully using: 0.98.5)
13 Both version of these two packages are included in the sources tarball for your convenience. From version 0.4.2, scons comes in uncompressed format in the source package. It can be found in $FOBS_ROOT/scons-local. You may use other different versions to the ones provided, but compatibility is not assured. The ffmpeg project has changed the behavior of key function calls in several updates, so especial care has to be taken when using a different ffmpeg revision.
15 Other important software packages that need to be installed in your system are:
16 - Python: needed by scons to built the Fobs project. Last version, 2.5.2, has been tested to be compatible.
17 - Java Developer Kit: required to build the Java part of Fobs, Fobs4JMF. OpenJDK-1.6 package for Windows and Linux, and Apple JDK 1.5 for Mac have been tested to be compatible.
25 Fobs can be build in different platforms. Binaries have been successfully created under Windows (using MinGW), Linux (Ubuntu 8.04) and MacOSX (OSX 10.5 and 10.4). Follow the appropriate instructions depending on your system:
27 *MinGW: (More information on section 5)
28 - Install MSYS-1.0.10 ,msysdtk-1.0.1 and MinGW 5.1.3. Install nasm-2.0-win32 (copy nasmw.exe to mingw/bin directory)
29 - Download and install last bash update for MinGW (ffmpeg configure script complains about the bash version provided in the msys package), Bash-3.1.
30 - Install last python release
33 http://sourceforge.net/projects/nasm
34 http://www.python.org/download/
38 - Tiger: Install latest realease of XCode (2.5 at the time of this Fobs release). You will also need to install a newer version of make (>3.80) using fink or darwin ports (required to compile ffmpeg).
39 - Leopard: Install latest release of XCode (3.0 at the time of this Fobs release).
42 - Install development tools (gcc, g++, make, automake, autoconf, python, nasm, libtool). In Ubuntu, these tools are gathered in the 'build-essentials' and 'libtool' packages.
46 In the rest of this guide, we will make use of the following environment variable:
47 > export $FOBS_ROOT=/path/to/your/fobs/source/package
48 which points to the folder where Fobs sources where unpacked.
50 Test that 'python' and 'javac' are reachable from the command line. If not, include them in the PATH:
51 e.g. export PATH=$PATH:/usr/lib/jvm/java-6-openjdk/bin
53 Setting up the JAVA_HOME variable also helps the building script to find required files:
54 e.g. export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
58 I don't really like the idea of thousands of SHARED libraries which my project depends upon. It usually makes the project more difficult to pack and distribute, and it is especially uncomfortable for final users, which may have different versions of the required components installed in their systems. For that reason, Fobs building process has been design to use a local sandbox where all the 3rd party libraries required are built and stored. This can be easily accomplished by using the --prefix option of the "configure" scripts, necessary to build all of these libs (including ffmpeg libavcodec and libavformat).
60 IMPORTANT: I have experienced problems when globally available dynamic versions of some of the libraries were available in /usr/lib or /usr/local/lib. If you experience problems, try to make sure the compiler is not choosing those versions instead of the local sandbox versions.
62 By default, the building script assumes that all dependencies are stored under:
65 Most of the times, using the following lines will be enough to get required libraries built and installed in our dependencies folder:
67 $./configure --prefix=$FOBS_ROOT/external --enable-shared=no
72 The 'make install' command creates the necessary files in the subdirectories of the $FOBS_ROOT/external directory, including:
73 $FOBS_ROOT/external/lib
74 $FOBS_ROOT/external/lib/pkgconfig
75 $FOBS_ROOT/external/include
77 This default location can be changed (see section 3), but the rest of this guide assumes this will be the prefix of all dependencies.
80 c) Compile ffmpeg: (further instructions in section 4.7)
81 The ffmpeg version included in the package needs to be unpacked. To unpack it, follow this steps:
83 tar xvfj resources/current-ffmpeg.tar.bz2
85 This creates the directory '$FOBS_ROOT/ffmpeg'. As a pre-step for Fobs compilation, the ffmpeg sources need to be compiled. Ffmpeg depends on many third party libraries, so the building process can be hard. This guide contains comprehensive information to get ffmpeg built without (too many) problems in section 4.
87 You'll need to instruct ffmpeg to look for 3rd party libraries using the following parameters in the ./configure command:
88 $./configure --prefix=$FOBS_ROOT/external --enable-shared=no [more options]
89 --extra-ldflags=-L$FOBS_ROOT/external/lib --extra-cflags=-I$FOBS_ROOT/external/include
91 Some additional files from ffmpeg are required to build fobs. Run the following commands from the ffmpeg sources root folder:
92 cp libavformat/avi.h $FOBS_ROOT/external/include/libavformat/
93 cp libavformat/riff.h $FOBS_ROOT/external/include/libavformat/
94 mkdir $FOBS_ROOT/external/include/libswscale
95 cp libswscale/swscale.h $FOBS_ROOT/external/include/libswscale/swscale.h
103 Please note that Fobs won't compile if you have not built the ffmpeg package included. Please refer to section 4 to get more details.
105 Fobs is built running the building script "buildFobs.sh":
107 ./buildFobs.sh [OPTIONS]
108 (options must not be preceded by '-')
110 This script invokes python to run SCons. Built files are stored under $FOBS_ROOT/dist.
114 ./buildFobs.sh clean OR
119 To get help on the available options, type:
120 ./buildFobs.sh --help
122 Available options in the current release:
123 FFMPEG_HOME=/path/to/dependencies (default '#external')
124 FOBS4JMF=yes|no (default yes) - Build JMF PlugIn (if a jdk is present in the machine)
125 OPTIMIZATIONS=yes|no (default yes) - Build Fobs using optimizations (-O3)
126 DEBUG_SYMBOLS=yes|no (default no) - Build Fobs using debug information (-g)
129 ./buildFobs.sh FOBS4JMF=no DEBUG_SYMBOLS=yes (JMF plugin will not be built, source will be compiled with debug support)
130 ./buildFobs.sh FFMPEG_HOME=#dependencies (The script will look for dependencies in folder $FOBS_ROOT/dependencies. The '#' at the beginning is a special character for the SCons build environment, which denotes the root directory of the current source package, $FOBS_ROOT in our case)
131 ./buildFobs.sh FFMPEG_HOME=/path/to/dependencies (Same as above)
138 4-COMPILING 3rd PARTY LIBRARIES TO IMPROVE FORMAT&CODEC SUPPORT
140 Here are some tips for the compilation of 3rd party libraries that can be used to extend ffmpeg encoding/decoding/parsing capabilities. Each of the following subsections references a 3rd party library which can be used within the ffmpeg context. For each of these libraries, compilation advice is given for each different platform (when appropriate).
143 *ALL PLATFORMS: I normally remove the dynamic library (it always gets created) to avoid fobs4jmf depending on any shared library
145 *MACOSX: Trying to compile xvidcore in Macintel machines with asm enabled will lead to errors. Robert Swain has a very interesting article describing a workaround that allows to compile it with no errors and with full functionality. Three simple stages are enough:
146 1 - declare the following env var: $export LDFLAGS="-read_only_relocs suppress"
147 2 - Run the configure script: ./configure --enable-macosx_module --prefix=/home/username/Sources/fobs-src/resources
148 3 - edit the build/generic/platform.inc file so that it reads:
150 AFLAGS=-I$(<D)/ -f macho -DPREFIX=_
151 ASSEMBLY_EXTENSION=asm
153 Don't miss any of the steps as the procedure won't work!!
155 *MinGW: change "$minimum_nasm_patch_version" for "$nasm_patch" in line 4027 of the configure script
158 *ALL PLATFORMS: The configure script of this package does NOT allow to specify a prefix parameter. You'll have to copy the library (libx264.a) and header (x264.h) file manually to the appropriate directory (resources/lib and resources/include).
163 ./configure --prefix=$FOBS_ROOT/external --enable-shared=no &&
167 *MinGW: To build from the command line, go to WinFAAD2Inst/faad2/libfaad,
168 - First a small edit to common.h has to be performed.
170 #if defined(_WIN32) && !defined(__MINGW32__)
172 #if defined(HAS_LRINTF)
173 #elif defined(_WIN32) && !defined(__MINGW32__)
175 gcc -c -I"." -DDRM -DDRM_PS -DHAS_LRINTF -DHAVE_MEMCPY=1 -DHAVE_STRING_H=1 -mthreads -fexceptions -fexceptions -fexpensive-optimizations -march=pentium3 *.c
179 - You'll have to copy following files to the resources dir:
180 WinFAAD2Inst/faad2/libfaad/libfaad.a -> resources/lib
181 WinFAAD2Inst/faad2/include/*.h -> resources/include
186 ./configure --prefix=$FOBS_ROOT/external --enable-shared=no &&
190 *MACOSX 10.4 (10.5 works fine): The makefile tries to link C++ using gcc at the end of the build process. You can manually create the file so that "make install" proceeds. Here is howto:
191 1) Copy the last gcc invokation which should look like:
192 gcc -O2 -Wall -o faac main.o input.o ../libfaac/.libs/libfaac.a ../common/mp4v2/.libs/libmp4v2.a -lm -lstdc++
193 2) change to the 'frontend/' directory:
195 3) Paste the line and change gcc for g++:
196 g++ -O2 -Wall -o faac main.o input.o ../libfaac/.libs/libfaac.a ../common/mp4v2/.libs/libmp4v2.a -lm -lstdc++
199 To build from the command line, go to WinFAACInst/faac/libfaac or WinFAAC960Inst/faac/libfaac and run:
200 gcc -DDRM -mthreads -fexceptions -I../include -c *.c kiss_fft/*.c
201 ar r libfaac.a *.o kiss_fft/*.o
204 You'll have to copy following files to the resources dir:
205 WinFAAD2Inst/faac/libfaac/libfaac.a -> resources/lib
206 WinFAAD2Inst/faac/include/*.h -> resources/include
208 4.5-libvorbis-1.1.2 (also valid for v1.2.0):
209 *ALL PLATFORMS: Install this library after libogg. Remember to tell the configure script about the path of the ogg installation. That means you need to build and install libogg first and use the following command to configure libvorbis:
210 ./configure --enable-shared=no --prefix=$FOBS_ROOT/external --with-ogg=$FOBS_ROOT/external
212 4.6-libtheora-1.0beta3:
213 *ALL PLATFORMS: Install this library after libogg and libvorbis. Remember to tell the configure script about the path of the ogg installation. That means you need to build and install libogg first and use the following command to configure libvorbis:
214 ./configure --enable-shared=no --prefix=$FOBS_ROOT/external --with-ogg=$FOBS_ROOT/external
218 *All Platforms: Configure. There are several options:
221 -Non distributable: Uses non-free components, so cannot be redistributed freely.
222 ./configure --disable-shared --prefix=$FOBS_ROOT/external --enable-liba52 --enable-libamr-nb --enable-libamr-wb --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --extra-cflags=-I$FOBS_ROOT/external/include --extra-ldflags=-L$FOBS_ROOT/external/lib --enable-gpl --enable-nonfree
224 -GPL: Fobs binaries have been generated using this configuration. Excludes amr-nb and amr-wb.
225 ./configure --disable-shared --prefix=$FOBS_ROOT/external --enable-liba52 --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --extra-cflags=-I$FOBS_ROOT/external/include --extra-ldflags=-L$FOBS_ROOT/external/lib --enable-gpl
227 -LGPL: Most distributable version: excludes libxvid, libx264, libfaad, and liba52.
228 ./configure --disable-shared --prefix=$FOBS_ROOT/external --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --extra-cflags=-I$FOBS_ROOT/external/include --extra-ldflags=-L$FOBS_ROOT/external/lib
230 *Linux: If is normally necessary to explecitely include ptrheads. Append " --enable-pthreads" to the end of the previous configure commands (without quotes)
232 *MinGW: Append " --enable-memalign-hack" to the end of the previous configure commands (without quotes)
234 2) make [*MinGW: use "mingw32-make.exe" instead of "make"]
236 3) make install [*MinGW: use "mingw32-make.exe" instead of "make"]
238 4) Some additional files MUST be copied after make install:
239 4.1- cp libavformat/avi.h $FOBS_ROOT/external/include/libavformat/
240 4.2- cp libavformat/riff.h $FOBS_ROOT/external/include/libavformat/
241 4.3- mkdir $FOBS_ROOT/external/include/libswscale
242 4.4- cp libswscale/swscale.h $FOBS_ROOT/external/include/libswscale/swscale.h
250 5 - Setting up the MinGW Environment to compile in Win32
252 First and more important: DONT USE PATHS WITH SPACES!!! for your MinGW installation. The following components need to be installed:
254 Packages that need to be installed:
257 From: http://downloads.sourceforge.net/mingw/MinGW-5.1.4.exe
258 Remarks: INCLUDE G++ in the setup wizard!!
262 From: http://downloads.sourceforge.net/mingw/MSYS-1.0.10.exe?modtime=1079444447&big_mirror=1
263 Remarks: Install after mingw. Write 'c:/mingw' when the install script asks you for the location of MinGW.
264 Install to: c:\msys\1.0
267 From: http://downloads.sourceforge.net/mingw/msysDTK-1.0.1.exe
268 Install to: c:\msys\1.0
271 From: http://downloads.sourceforge.net/nasm/nasm-2.00-win32.zip
272 Remarks: Install ONLY if you are willing to include support for libxvid asm routines.
273 Install to: Unzip and copy to c:\mingw\bin
276 From: http://downloads.sourceforge.net/mingw/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2
277 Remarks: Install to avoid problems with ffmpeg configure script
279 Copy bz2 file to c:\msys\1.0
281 Go to root folder: "cd /"
282 Uncompress "tar xvfj coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2"
283 Copy files "cp coreutils-5.97/bin/* bin"
284 Remove files "rm -Rf coreutils-5.97"
288 From: http://downloads.sourceforge.net/mingw/bash-3.1-MSYS-1.0.11-1.tar.bz2
290 Copy bz2 file to c:\msys\1.0
292 Go to root folder: "cd /"
293 Type "tar xvfj bash*.bz2"
297 From: http://python.org/ftp/python/2.5.2/python-2.5.2.msi
298 Install to: c:\msys\python25
301 From: http://java.sun.com/javase/downloads/index.jsp
302 Install: Setup path to jdk binaries:
303 1. Click Start > Control Panel > System on Windows XP or Start > Settings > Control Panel > System on Windows 2000.
304 2. Click Advanced > Environment Variables.
305 3. Add the location of bin folder of JDK installation for PATH in User Variables and System Variables. A typical value for PATH is: C:\Program Files\Java\jdk1.6.0_<version>\bin
308 From: http://subversion.tigris.org/files/documents/15/41686/svn-1.4.6-setup.exe
309 Remarks: Just install if you want to download the latest snapshot of ffmpeg (might not work with Fobs). Remember, compatibility is only grated for the ffmpeg distribution included in Fobs sources package.
315 6 - Links to third party libraries:
317 Download 3rd party libraries if you want Fobs to support them. These have to linked to ffmpeg.
319 liba52-0.7.4 -> From http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
320 libfaac-1.26 -> From http://downloads.sourceforge.net/faac/faac-1.26.tar.gz
321 libfaad2-2.6.1->From http://downloads.sourceforge.net/faac/faad2-2.6.1.tar.gz
323 ./configure --prefix=/home/jsan/fobs-src/resources --enable-shared=no
324 Edit file common\mp4ff\mp4ff_int_types.h and change the line
327 #if defined (FAKE_DEFINE)
330 libmp3lame-3.97->From http://downloads.sourceforge.net/lame/lame-3.97.tar.gz
331 libogg-1.1.3 -> From http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
332 libvorbis-1.2.0->From http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz
333 libtheora-1.0b2->From http://downloads.xiph.org/releases/theora/libtheora-1.0beta2.tar.gz
334 libx264 -> Latest snapshot from ftp://ftp.videolan.org/pub/videolan/x264/snapshots/
335 libxvid-1.1.3 -> From http://downloads.xvid.org/downloads/xvidcore-1.1.3.tar.gz
337 (These are the latest versions available when this file was written on 15/June/2008)