1.download
https://gstreamer.freedesktop.org/src/gstreamer/
2.
2.1 ./configure
2.2 sudo make
编译过程中可能出现以下错误:
1. configure: error: Could not find bison
sudo apt-get install bison
2. configure: error: Could not find flex
admin@ubuntu:$sudo apt-get install flex
在Linux下编译gstreamer出现一下错误: grammar.tab.c: In function 'priv_gst_parse_yyparse': grammar.tab.c:1819:7: error: too few arguments to function 'priv_gst_parse_yylex' if (yychar == YYEMPTY) ^ ./grammar.y:39:5: note: declared here int priv_gst_parse_yylex (void * yylval_param,yyscan_t yyscanner); ^ make[3]: *** [libgstparse_la-grammar.tab.lo] 错误 1 make[3]:正在离开目录 `/home/liuqian/work/gstreamer-0.10.36/gst/parse' make[2]: *** [install-recursive] 错误 1 make[2]:正在离开目录 `/home/liuqian/work/gstreamer-0.10.36/gst' make[1]: *** [install] 错误 2 make[1]:正在离开目录 `/home/liuqian/work/gstreamer-0.10.36/gst' make: *** [install-recursive] 错误 1 这是由于本机装的bison3.0中grammar的参数做了调整,具体是: --- gst/parse/grammar.y | 2 +- 1 file changed,1 insertion(+),1 deletion(-) diff --git a/gst/parse/grammar.y b/gst/parse/grammar.y index cd26a2a..ce85295 100644 --- a/gst/parse/grammar.y +++ b/gst/parse/grammar.y @@ -36,7 +36,7 @@ typedef void* yyscan_t; -int priv_gst_parse_yylex (void * yylval_param,yyscan_t yyscanner); +int priv_gst_parse_yylex (void * yylval_param); int priv_gst_parse_yylex_init (yyscan_t scanner); int priv_gst_parse_yylex_destroy (yyscan_t scanner); struct yy_buffer_state * priv_gst_parse_yy_scan_string (char*,yyscan_t);
2.3 sudo make install
2.4 sudo ldconfig
3.测试
#include <stdio.h> #include <gst/gst.h> int main (int argc,char *argv[]) { const gchar *nano_str; guint major,minor,micro,nano; gst_init (&argc,&argv); gst_version (&major,&minor,µ,&nano); if (nano == 1) nano_str = "(CVS)"; else if (nano == 2) nano_str = "(Prerelease)"; else nano_str = ""; printf ("This program is linked against GStreamer %d.%d.%d %s\n",major,nano_str); return 0; }
gcc demo1.c `pkg-config --cflags --libs gstreamer-0.11`
./a.out
This program is linked against GStreamer 0.11.2
原文链接:https://www.f2er.com/ubuntu/355357.html