Guide to building FFMpeg for Windows Mobile / Win CE

Hi all,

I after playing round with Crags guide I thought I would post what I have found. No small amount of hair pulling from me to

Prerequisites

1. Before proceeding, you must have the Msys + MingW development environment set up. I can highly recommend thishttp://ffmpeg.arrozcru.org/ guide as a starting point. Follow this guide through until you have an environment which is sufficient for building FFMpeg on Windows.

2. Get the CeGCC cross compiler from the http://sourceforge.net/project/showfiles.php?group_id=173455&package_id=198682 . The version you should get is http://downloads.sourceforge.net/cegcc/cegcc-mingw32ce-0.50-cygwin.tar.gz?modtime=1188210321&big_mirror=0%20cegcc-mingw32ce-0.50-cygwin.tar.gz.

3. Unzip cegcc-cegcc-0.50-cygwin.tar.gz into your msys/mingw directory. Assuming you followed the guid in step 1, that will be
"c:\msys\mingw"

4. Rename the winsock 2 library found in
"/mingw/opt/mingw32ce/arm-wince-mingw32ce/lib"
from libws2.a to libws2_32.a. Assuming you followed the guide in step 1 that will be
"C:\msys\mingw\opt\mingw32ce\arm-wince-mingw32ce\lib"

5. Modify the file errno.h found in
"/mingw/opt/mingw32ce/arm-wince-mingw32ce/include/errno.h"
Remove lines 11-14:
#ifdef __COREDLL__
# include_next <errno.h>
#else /* __COREDLL__ */
and lines 106-107:
#endif /* Not __COREDLL__ */

6. Note that this is only an issue if you are ''not'' using CeGCC to build your Windows CE / Mobile application. There is an issue with the alignment of structures that contain 8-byte variables in CeGCC (see this http://www.mail-archive.com/cegcc-devel@lists.sourceforge.net/msg00738.html discussion for more info). The solution for this problem involves modifying the stdint.h header file that ships with the release of CeGCC.
/mingw/opt/mingw32ce/arm-wince-mingw32ce/include/stdint.h
If the guide in step 1 was followed that will be
C:\msys\mingw\opt\mingw32ce\arm-wince-mingw32ce\include\stdint.h
Modify the typedefs of the 64-bit integer variables from:
typedef long long int64_t;
typedef unsigned long long uint64_t;
to:
typedef long long int64_t
#if defined(__GNUC__)
__attribute((aligned(8)))
#endif
;
typedef unsigned long long uint64_t
#if defined(__GNUC__)
__attribute((aligned(8)))
#endif
;

7. Download http://www.gnuarm.com/bu-2.16.1_gcc-4.1.0-c-c++_nl-1.14.0_gi-6.4.exe binutils-2.16.1, gcc-4.1.0-c-c++, newlib-1.14.0, insight-6.4, setup.exe [25.3MB] from http://www.gnuarm.com.

8. Install the gnuArm tools to the default location.

Build Process
1. Check out the latest version of the FFMpeg source from SVN. The rest of this guide will assume you checked out to c:\projects\ffmpeg.

2. Open a MSYS command window and navigate to the directory you checked FFMpeg out to:
cd /c/projects/ffmpeg

3. Add the path to the CeGCC cross compiler's bin directory to your PATH environment variable:
PATH=$PATH:/mingw/opt/mingw32ce/bin

4. Add the path to the gnuArm tools bin directory to your PATH environment variable:
PATH=$PATH:"/C/Program Files/GNUARM/bin"

5. Configure the build by executing the following command:
./configure --enable-mingwce --cross-compile --cross-prefix=arm-wince-mingw32ce- --arch=arm --disable-static --enable-shared --disable-parsers --enable-memalign-hack --disable-ffmpeg --disable-ffplay --disable-debug
note from metalkin) It seems that ffmpeg doesn't support '--enable-mingwce' and '--cross-compile'options anymore, '--enable-cross-compile' could replace '--cross-compile' based on current ffmpeg revision.
During build, dsputil_arm_s.S makes several errors "' junk at end of line, first unrecognized character is `p'". I guess an arm assember has to be designated to compile it.
Due to the reasons, this option could be a bit out of date, I think.

6. Remove any old intermediate files
make clean

7. Start the build by executing make:
make

8. Once the build is finished.
make install

9. The lib and header files will now have been copied over to the directories below.
/usr/local/lib
/usr/local/include/ffmpeg
Which if you followed the guide in the prerequisites will be located in:
C:\msys\local\lib
C:\msys\local\include\ffmpeg

Have fun
ceebmoj

ceebmoj
Posts: 1
Joined: Thu Nov 20, 2008 4:30 pm