Apostolos\’ Daily Plate

OpenSolaris: Compiling FFmpeg for 64-bit

Posted in OpenSolaris by asyropoulos on Ιουνίου 25, 2010

Compiling the SVN version of FFmpeg for 64-bit is not difficult, but one must a little bit careful. First of all, one needs to compile x264, xvid, and libnut  among others. In all cases, one must ensure that the libraries are compiled with the -fPIC -DPIC swicthes (even SunStudio recognizes these switches). For some reason, it is necessary to produce position-independent code (PIC)  and these switches ensure this. Once these additional libraries have been installed in the proper folders (e.g., /usr/local/lib/amd64), we need to compile FFmpeg. In order to configure, I have used the following command:

CFLAGS="-m64 -I/opt/gnu/include" \
LDFLAGS="-m64 -L/opt/gnu/lib/amd64 -R/opt/gnu/lib/amd64" \
./configure --prefix=/opt/gnu --bindir=/opt/gnu/bin/amd64
--shlibdir=/opt/gnu/lib/amd64 --libdir=/opt/gnu/lib/amd64 --enable-libopencore-amrnb\
--enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame  --enable-libnut \
--enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264  --enable-libxvid \
--enable-zlib --enable-bzlib  --cc=cc --enable-pic --enable-shared --enable-version3 \
--enable-gpl --enable-nonfree --enable-x11grab  --disable-mmx --enable-postproc \
--extra-cflags="-fPIC -DPIC" --enable-pthreads

Note that here cc is Sun C 5.11 SunOS_i386 Aten 2010/05/10 , that is, the latest version of the SunStudio. The configuration process generates a number of files but two of them must be modified.  First, file config.h must be modified using the following patch:

--- config.h.orig	Παρ Ιουν 25 23:26:05 2010
+++ config.h	Τετ Ιουν 23 17:03:05 2010
@@ -28,7 +28,7 @@
 #define ARCH_SPARC 0
 #define ARCH_SPARC64 0
 #define ARCH_TOMI 0
-#define ARCH_X861
+#define ARCH_X86 0
 #define ARCH_X86_32 0
 #define ARCH_X86_64 1
 #define HAVE_ALTIVEC 0
@@ -45,7 +45,7 @@
 #define HAVE_NEON 0
 #define HAVE_PPC4XX 0
 #define HAVE_SSE 0
-#define HAVE_SSSE3 0
+#define HAVE_SSSE3 1
 #define HAVE_VIS 0
 #define HAVE_BIGENDIAN 0
 #define HAVE_PTHREADS 1

Also, file config.mak must be modified using the following patch:

--- config.mak.orig	Παρ Ιουν 25 23:34:57 2010
+++ config.mak	Τετ Ιουν 23 17:02:47 2010
@@ -12,7 +12,7 @@
 SRC_PATH="/opt/sources/BACKUP/MPLAYER/ffmpeg"
 SRC_PATH_BARE=/opt/sources/BACKUP/MPLAYER/ffmpeg
 BUILD_ROOT="/opt/sources/BACKUP/MPLAYER/ffmpeg"
-ARCH=x86
+ARCH=x86_64
 CC=cc
 AS=cc
 LD=cc
@@ -30,7 +30,7 @@
 CC_O=-o $@
 LDFLAGS= -m64 -L/opt/gnu/lib/amd64 -R/opt/gnu/lib/amd64
 FFSERVERLDFLAGS=
-SHFLAGS=-mimpure-text -shared -Wl,-h,$$(@F)
+SHFLAGS=-shared -Wl,-h,$$(@F)
 YASMFLAGS=-f elf -DARCH_X86_64 -m amd64 -DPIC -g dwarf2
 BUILDSUF=
 FULLNAME=$(NAME)$(BUILDSUF)

Once these steps have been taken, compilation should complete with no errors.

Advertisements