您的位置:首页 > 其它

Compiling GStreamer for Windows using MinGW

2008-02-02 14:03 411 查看

Compiling GStreamer for Windows using MinGW

Warning: this information is very out-dated and currently unmaintained. Ask on gstreamer-devel mailing for more help.

Introduction

This documents is a manual to prepare a MSYS/MinGW environment and compile gstreamer. If you have some questions or notices please let me know at michal (d0t) benes (aT) xeris (d0t) cz

Ready to use environment

I've provided the ready to use environment that follows all the steps noticed in this document. There are all the prerequisities implemented and there are cvs versions from 2005-12-09 04:30 UTC+1 of plugins: gstreamer, gst-plugins-base, gst-plugins-good installed. The sources in /src are not included.

Download

Prerequisities

If you decided not to use precompiled environment provided but to compile it yourself, you need to install several utilities and libraries (listed in recommended order of installation) before compiling gstreamer.

WARNING! It's VERY important to install all these binaries into right directory paths. Please keep these paths, otherwise it will not work right!

MinGW Can be obtained or at official MinGW site: (Download -> File list -> MinGW -> MinGW-4.1.0.exe).
Install to c:/root/mingw.
I installed everything, but you needn't install:
The full set of source packages

Current/gcc-g77
Current/gcc-ada
Current/gcc-java
Current/gcc-ojbc

MSYS Can be obtained or from site (Download -> File list -> MSYS -> MSYS-1.0.10.exe).
Install to c:/root (Not to c:/root/1.0).
After passing an installation wizard there are some postinstall questions. Those with answers are:
Do you wish to continue with the post install? y
Do you have MinGW installed? y
Where is your MinGW installation? c:/root/mingw

msysDTK Can be obtained or from site (Download -> File list -> MSYS Developer Tool Kit -> msysDTK-1.0.1.exe).
Install to c:/root (Not to c:/root/1.0).

gettext Can be obtained or from site (Download -> File list -> gettext -> gettext-0.11.5-2003.02.01-1.exe).
Install to c:/root/mingw.

The environment is not yet ready to run, but it will be after the while. We will make some short tasks:

wget This is a tool for downloading source files from the web. We need it due to iconv's installer.
I recommend that works fine on Windows. Or you can use just a single exe file from site (Downloads -> wget.exe).
Unpack it and copy all files included to c:/root/mingw/bin
Create directory c:/root/src. In this directory we will store every source files.
Create directory c:/root/local
Create directory c:/root/local/bin
DLLs I had a problem with DLL lookup. Some DLLs are not included with binary distributions of gettext, iconv, and glib. These DLLs are necessary to run some gnuwin32 tools and also to compile gstreamer. So I've found these missing DLLs in GTK+ for Win32 and copied them into MSYS environment.
Download , unpack it and copy all files included into c:/root/local/bin.
bison is a tool for syntax analysis. I recommend the binary version that you can download or from official gnuwin32 site: (Download Binaries - Zip distribution (bison-2.1-bin.zip)).
Unpack it and copy content of directories bin to c:/root/local/bin (don't replace m4.exe) and share to c:/root/local/share.
Now, it's time to run MSYS environment.

The environment simulates unix file system. When you type ls -l /, you will see:

$ ls -l /
total 6
drwxr-xr-x    2 Petr     Administ        0 Dec  9 05:16 bin
drwxr-xr-x    3 Petr     Administ        0 Dec  9 03:19 doc
drwxr-xr-x    2 Petr     Administ        0 Dec  9 04:14 etc
drwxr-xr-x    3 Petr     Administ        0 Dec  9 03:20 home
drwxr-xr-x    4 Petr     Administ        0 Dec  9 03:20 lib
drwxr-xr-x    8 Petr     Administ        0 Dec  9 03:55 local
-rw-r--r--    1 Petr     Administ     2238 Mar 16  2004 m.ico
drwxr-xr-x   12 Petr     Administ        0 Dec  9 03:19 mingw
-rwxr-xr-x    1 Petr     Administ     4771 Mar 16  2004 msys.bat
-rw-r--r--    1 Petr     Administ     2238 Mar 16  2004 msys.ico
drwxr-xr-x   10 Petr     Administ        0 Dec  9 03:20 share
drwxr-xr-x   19 Petr     Administ        0 Dec  9 04:32 src
drwxr-xr-x    2 Petr     Administ        0 Dec  9 03:20 uninstall

These files are those that you can see in c:/root. So when you type /bin it means c:/root/bin. It's because of the dir c:/root is mounted to /. You can see all the mounted points by running mount.

$ mount
C:/DOCUME~1/Petr/LOCALS~1/Temp on /tmp type user (binmode,noumount)
c:/root/mingw on /mingw type user (binmode)
C:/root/bin on /usr/bin type user (binmode,cygexec,noumount)
C:/root/bin on /bin type user (binmode,cygexec,noumount)
C:/root on / type user (binmode,noumount)
C:/root on /usr type user (binmode,noumount)
c: on /c type user (binmode,noumount)
d: on /d type user (binmode,noumount)
e: on /e type user (binmode,noumount)

You can see C:/root on / that is what I told. But there is also C:/root on /usr. That means that if you type /usr/bin it's the same as if you type /bin. So /usr/bin and /bin are c:/root/bin in Windows file system.

 

Now, change dir to /src (it's c:/root/src in Windows file system) by cd /src.

Now, we have to install some utilities and libraries that gstreamer installer or gstreamer self needs.

autoconf You can download the source or from official GNU site: (autoconf-2.59.tar.bz2).
Unpack it to c:/root/src so that the source files will be in c:/root/src/autoconf-2.59 (you can use tar -jf archive.tar.bz2 or tar -zf archive.tar.gz to unpack). Change dir to c:/root/src/autoconf-2.59 and run:
./configure This will look for dependencies, compiler to use and paths where the dependencies or compiler are stored.
make This will compile the source using the paths discovered by ./configure
make install This will install the result of compilation (mostly binary files and other deployment files).

automake You can download the source or from (automake-1.9.6.tar.bz2).
Unpack it to c:/root/src so that the source files will be in c:/root/src/automake-1.9.6, change dir to it and run:
./configure
make
make install

libtool You can download the source or from (libtool-1.5.20.tar.gz).
Unpack it to c:/root/src so that the source files will be in c:/root/src/libtool-1.5.20, change dir to it and run:
./configure
make
make install

liboil You can download the source or from official (liboil-0.3.6.tar.gz).
Unpack it to c:/root/src so that the source files will be in c:/root/src/liboil-0.3.6, change dir to it and run:
./configure
make
make install

iconv You can download the source or from site (Download -> File list -> mingwPORT -> libiconv-1.9.2-mingwPORT.tar.bz2).
Unpack to the similar location as above, change dir to it and run:
./mingwPORT.sh Press ENTER for every question. Now, the script downloads about 3 MB of data, performs some tests (there could be some errors with missing libiconv-2.dll, press OK), makes the source and installs builded binaries.
flex You can download the binary or from site (Download Binaries - Zip distribution (flex-2.5.4a-1-bin.zip)).
Unpack and copy the content of included directory bin to c:/root/local/bin.
glib You can download the binary or from official site (glib-dev-2.8.4.zip).
Copy content of each directory to appropriate directories under c:/root/local
Because it's a binary distribution there could be some wrong paths stored in the copied files, so open all files /usr/local/lib/pkgconfig/g*.pc and replace the line:
prefix=c:/devel/target/glib-2.8.4
by prefix=/usr/local
pkg-config You can download the source or from (pkg-config-0.20.tar.gz).
Unpack, change dir to it and run:
./configure
make
make install

Now, we have to edit our environment paths in the file /etc/profile. Open it and append these lines to the end:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export GST_PLUGIN_PATH=/usr/local/lib/gstreamer-0.10

libxml2 You can download the source or from official (libxml2-2.6.22.tar.gz).
Unpack, change dir to it and run:
./configure
make
make install

These two libraries are not really neccesary to compile gstreamer but i'm using it to test if gstreamer works.

ogg You can download the source or from official (libogg-1.1.3.tar.gz).
Unpack, change dir to it and run:
./configure
make
make install

vorbis You can download the source or from (libvorbis-1.1.2.zip).
Unpack, change dir to it.
Because originaly it's a Unix library and Windows works with dynamic libraries differently than Unix does, there is a little portability issue when comiping this library on Windows. To solve it, you must add '@OGG_LIBS@' to file /src/libvorbis-1.1.2/lib/Makefile.am as follows:
line 23: libvorbisfile_la_LIBADD = @OGG_LIBS@ libvorbis.la
line 27: libvorbisenc_la_LIBADD = @OGG_LIBS@ libvorbis.la
Then run:
./autogen.sh
make
make install

Compilation of gstreamer

I'm using a cvs version (the most actual) of source files of gstreamer. To download the source files from cvs change directory to /src and run:
cvs -d:pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer co gstreamer
There will be a new directory /src/gstreamer that contains downloaded files.
There is a bug (http://bugzilla.gnome.org - bug #316086) in /src/gstreamer/plugins/indexers/Makefile.am file so open it and replace this code:

if GST_DISABLE_LOADSAVE
GST_LOADSAVE_SRC =
else
GST_LOADSAVE_SRC = gstfileindex.c
endif
if HAVE_MMAP

else
GST_LOADSAVE_SRC =
endif

by this one:

if HAVE_MMAP
if GST_DISABLE_LOADSAVE
GST_LOADSAVE_SRC =
else
GST_LOADSAVE_SRC = gstfileindex.c
endif
else
GST_LOADSAVE_SRC =
endif

Now, change dir to /src/gstreamer and run:
./autogen.sh
There are some non-fatal warnings during the compilation. You will need to replace the following line in /gst/Makefile:
ERROR_CFLAGS = -Wall -Werror
by the line:
ERROR_CFLAGS = -Wall
Now, run:
make
make install

The gstreamer is now ready to use, so try to test if it works. Find some smaller file, eg. README and run:
gst-launch-0.10 filesrc location=README ! filesink location=README.new

$ gst-launch-0.10 filesrc location=README ! filesink location=README.new
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0 ns.
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
FREEING pipeline ...

The new file README.new should be created in the actual dir.

Compilation of gst-plugins-base

Change dir to /src, download the source from cvs by running:
cvs -d:pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer co gst-plugins-base
There will be a new directory /src/gst-plugins-base that contains downloaded files.
There is a problem with pango plugin so make sure it is not enabled by the configure script (create new file /src/gst-plugins-base/disable that contains only word pango inside).
There is some other problem with tests/icles (bug #323852), so edit the file /src/gst-plugins-base/tests/Makefile.am and replace the code:

SUBDIRS =			/
$(SUBDIRS_CHECK)	/
$(SUBDIRS_EXAMPLES)	/
icles

by code:

SUBDIRS =			/
$(SUBDIRS_CHECK)	/
$(SUBDIRS_EXAMPLES)
#	icles

Now, run:
./autogen.sh
make
make install

Compilation of gst-plugins-good

Download the source from cvs by changing the actual dir to /src and running:
cvs -d:pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer co gst-plugins-good
There will be a new directory /src/gst-plugins-good that contains downloaded files.
There are some plugins that do not compile on Windows (bug #316203), so open the /src/gst-plugins-good/configure.ac and look up following lines:

dnl these are all the gst plug-ins, compilable without additional libs
dnl videofilter is at the top because others depend on it
GST_PLUGINS_ALL="/
videofilter /
alpha /
auparse /
autodetect /
avi /
cutter /
debug /
effectv /
flx /
goom /
law /
level /
matroska /
multipart /
rtp	/
rtsp	/
smpte	/
udp	/
videobox /
videomixer /
wavenc /
wavparse /
"

Delete the lines with rtp, rtsp and udp (this problem is reported in bugzilla, so may be later these lines needn't be there).
Disable another plugin by creating a new file /src/gst-plugins-good/disable with the only word jpeg inside.
Then run:
./autogen.sh
make
make install
 

this environment (about 60 MB) and unpack it to c:/ so that c:/root will contain dirs bin, doc, etc ...
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息