Tuesday, June 11, 2013

Guide to building FFMpeg for Windows Mobile / Win CE

Re: Guide to building FFMpeg for Windows Mobile / Win CE

Postby ceebmoj on Tue Mar 31, 2009 9:16 am
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 thehttp://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


编译环境:msys 3.15 ,同时有安装mingw和Cygwin(具体版本我自己都已经搞不大清楚了)
ffmpeg版本:0.5.2,下载地址:http://ffmpeg.org/releases/ffmpeg-0.5.2.tar.bz2

先是一些准备工作,把之前的一些文档找出来,

ffmpeg编译手册:编译Windows Mobile/Windows CE版的ffmpeg

此文主要摘录自:http://ffmpeg.arrozcru.org/forum/viewtopic.php?f=8&t=780

Guide to building FFMpeg for Windows Mobile / Win CE

First Guide:
http://www.craigshaw.com/2008/04 ... EWindowsMobile.aspx
但是据很多人讲,依据这篇文章根本无法真正编译出Windows Mobile版的ffmpeg。更不幸的是,似乎是GFW把这篇这么好的文章给“墙”住了,所以似乎更是让你一点线索都没有。


不过还好,有人根据那篇Guide,再做了一些补充,据说可以编译出来,以下是其说明和补充的步骤:

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/s ... p;package_id=198682 . The version you should get is http://downloads.sourceforge.net ... 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/cegc ... e.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_ ... l-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

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