ubuntu 上编译vlc和debug

Vlc编译:

以下安装步骤和问题解决后,可以播放本地媒体,RTSP,HLS 等。

编译通过后,直接在vlc目录底下gdb vlc 就可以debug了。


1.      下载ffmpeg-0.6.6.tar.bz2 ,因为vlc依赖于ffmpeg,所有要先编译ffmpeg

ffmpeg-2.0.1.tar版本太新,暂时不支持,

ffmpeg-0.6.6.tar.bz2 编译vlc 有问题

下载ffmpeg-0.11.4.tar.bz2版本

 

bunzip2 ffmpeg-0.11.4.tar.bz2

tar -xvf ffmpeg-0.11.4.tar

cd ffmpeg-2.0.1

./configure

Make

Sudo make install

 

1.      下载vlc-2.0.8a.tar.xz。

xz -d vlc-2.0.8a.tar.xz

tar -xvf vlc-2.0.8a.tar

cd  vlc-2.0.8

./bootstrap

./configure--enable-debug --disable-mkv --disable-lua --enable-live555  

Make

Make install

./vlc

 

说明:--disable-mkv  --disable-lua 是为了解决编译错误

                --enable-live555是为了支持网络协议,如rtsp等

 

可以先编译依赖的部件:(第二次编译尝试)

 apt-get install subversion yasm cvs cmake
% cd contrib
% mkdir native
% cd native
% ../bootstrap
% make


这个过程中会遇到下面的问题6(编译x264问题),安装解决方案解决就可以全部编译通过了。

编译vlc的过程中会遇到问题7.

 

编译过程遇到的问题:

1.      configure: error: Your libebml is too old: youmay get a more recent one from http://dl.matroska.org/downloads/libebml/.Alternatively you can use –disable-mkv to disable the matroska plugin.

 

解决方案:./configure --enable-debug --disable-mkv

 

 

2.      Requested 'xcb >= 1.6' but version of XCB is1.5

 

解决方案:

http://xcb.freedesktop.org/网站下载xcb-proto-1.8.tar.gz和libxcb-1.9.tar.gz

先编译xcb-proto-1.8

./configure

Make

SudoMake install

 

编译libxcb-1.9

cdlibxcb-1.9/

./configure

Make

SudoMake install

 

3.       AVDictionary'undeclared  问题

解决方案:下载ffmpeg-0.11.4.tar.bz2 版本

 

  CC    libavformat_plugin_la-demux.lo

demux.c:In function 'OpenDemux':

demux.c:147:warning: suggest parentheses around assignment used as truth value

demux.c:In function 'Demux':

demux.c:660:warning: comparison between signed and unsigned integer expressions

demux.c:In function 'Control':

demux.c:886:error: 'AVDictionary' undeclared (first use in this function)

demux.c:886:error: (Each undeclared identifier is reported only once

demux.c:886:error: for each function it appears in.)

 

 

4.      live555 问题

编译并安装了了一个最新版本的live555,结果还是报了以下的错误.

 

解决方案来自于:

https://forum.videolan.org/viewtopic.php?f=13&t=100133

https://wiki.videolan.org/UnixCompile#The_method_for_badly-behaved_distributions

使用vlc 的contrib方法编译live555

#apt-get install subversion yasm cvs cmake

% cd contrib
% mkdir native
% cd native
% ../bootstrap
% make   /*如果只编译live555 用make .live555  就可以了*/

 

 

configure: WARNING: liveMedia is missingor itsinstalled version is too old:

Version 2011.12.23 or lateris required to proceed.

You can get an updated one from http://www.live555.com/liveMedia .

configure: error: Update live555 or pass --disable-live555 to disableRTSP input support.

charlie@charlie-ubuntu1:~/vlc/vlc-2.0.8$



5.运行VLC, 加载模块找不到live555插件,导致不能播放rtsp源码

原因分析:

1)../vlc -vvv --color --list  查看live555插件是否可以,是否已经注册到vlc系统中。

./vlc -vvv --color --list

[0x954e1f8] main libvlc warning: cannot load module `/home/charlie/vlc/vlc-2.0.8/modules/demux/.libs/liblive555_plugin.so' (/home/charlie/vlc/vlc-2.0.8/modules/demux/.libs/liblive555_plugin.so: undefined symbol: _ZN10RTSPClient11sendRequestEPNS_13RequestRecordE)


2).解放方案:

   来自:https://trac.videolan.org/vlc/ticket/7404

  是版本不匹配导致的,live.2011.12.23.tar.gz 版本

修改方法:

  1)cd vlc-2.0.8/contrib/src/live555/rules.mak

        LIVE555_FILE := live.2011.12.23.tar.gz

  2)   contrib/native

make .live555

   会下载  live.2011.12.23.tar.gz到vlc-2.0.8/contrib/tarballs目录下

  3)计算出新tar包的签名

cd vlc-2.0.8/contrib/tarballs

sha512sum live.2011.12.23.tar.gz 
6d84373dc81df478e3870acd38d72b60d61070861d4b6f394728cf21be06eb41d6e84bc97848c997fe205ec93133c5f4f67bdd7865631a148901b48629c69286  live.2011.12.23.tar.gz

4) vi vlc-2.0.8/contrib/src/live555/SHA512SUMS

    将这段字符串覆盖到这个文件里,

6d84373dc81df478e3870acd38d72b60d61070861d4b6f394728cf21be06eb41d6e84bc97848c997fe205ec93133c5f4f67bdd7865631a148901b48629c69286  live.2011.12.23.tar.gz


5)将contrib/native 里的依赖包全部编译过后,这个问题也一起解决了。


6. 编译 x264 出错

charlie@charlie-ubuntu1:~/vlc/vlc-2.0.8/contrib/native$ make .x264
cd x264 && CC="gcc" CXX="g++" LD="ld" AR="ar" RANLIB="ranlib" STRIP="strip" PATH="/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu/bin:/home/charlie/vlc/vlc-2.0.8/extras/tools/build/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/charlie/android/tool/android-sdk-linux/tools:/home/charlie/android/tool/android-sdk-linux/platform-tools:/home/charlie/android/tool/android-ndk-r7:/home/charlie/android/tool/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin:/home/charlie/android/kernel/toolchain/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin" CPPFLAGS=" -I/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu/include" CFLAGS=" -I/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu/include -g" CXXFLAGS=" -I/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu/include -g" LDFLAGS=" -L/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu/lib" ./configure --prefix="/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu" --host="i486-linux-gnu" --enable-static --disable-avs --disable-lavf --disable-cli --disable-ffms --enable-pic
Found yasm 1.0.0.2319
Minimum version is yasm-1.2.0
If you really want to compile without asm, configure with --disable-asm.
make: *** [.x264] Error 1
charlie@charlie-ubuntu1:~/vlc/vlc-2.0.8/contrib/native$ 


解决方案:

1) 从http://www.linuxfromscratch.org/blfs/view/svn/general/yasm.html  下载yasm-1.2.0源码

2)./configure 

make

   sudo make install

3) OK.  如果用./configure --prefix=/usr  会有问题,用yasm --version 查看,还是原来的版本



7.  zlib.h 头文件定义冲突

解决方案:  删除zlib.h 头文件

vlc/vlc-2.0.8/contrib/i486-linux-gnu/include$ mv zlib.h zlib.h_zybackup


make[6]: Entering directory `/home/charlie/vlc/vlc-2.0.8/modules/gui/skins2'
  CXX    libskins2_plugin_la-cmd_change_skin.lo
In file included from ../../../modules/access/zip/unzip/unzip.h:53,
                 from commands/../src/theme_loader.hpp:31,
                 from commands/cmd_change_skin.cpp:30:
/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu/include/zlib.h:1583: error: declaration of C function 'off_t gzseek64(void*, off_t, int)' conflicts with
/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu/include/zlib.h:1567: error: previous declaration 'off64_t gzseek64(void*, off64_t, int)' here
/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu/include/zlib.h:1584: error: declaration of C function 'off_t gztell64(void*)' conflicts with
/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu/include/zlib.h:1568: error: previous declaration 'off64_t gztell64(void*)' here
/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu/include/zlib.h:1585: error: declaration of C function 'off_t gzoffset64(void*)' conflicts with
/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu/include/zlib.h:1569: error: previous declaration 'off64_t gzoffset64(void*)' here
/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu/include/zlib.h:1586: error: declaration of C function 'uLong adler32_combine64(uLong, uLong, off_t)' conflicts with
/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu/include/zlib.h:1570: error: previous declaration 'uLong adler32_combine64(uLong, uLong, off64_t)' here
/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu/include/zlib.h:1587: error: declaration of C function 'uLong crc32_combine64(uLong, uLong, off_t)' conflicts with
/home/charlie/vlc/vlc-2.0.8/contrib/i486-linux-gnu/include/zlib.h:1571: error: previous declaration 'uLong crc32_combine64(uLong, uLong, off64_t)' here
make[6]: *** [libskins2_plugin_la-cmd_change_skin.lo] Error 1
make[6]: Leaving directory `/home/charlie/vlc/vlc-2.0.8/modules/gui/skins2'
make[5]: *** [all] Error 2
make[5]: Leaving directory `/home/charlie/vlc/vlc-2.0.8/modules/gui/skins2'


8. 运行vlc的时候出现 segment fault。

是在audio decoder的过程中出现的,注释掉以下代码可以解决,具体原因不详:


vi vlc-2.0.8/modules/codec/avcodec/audio.c


aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
{




    if( (p_block->i_flags & BLOCK_FLAG_PRIVATE_REALLOCATED) == 0 )
    {
        p_block = block_Realloc( p_block, 0, p_block->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE );
        if( !p_block )
            return NULL;
        //*pp_block = p_block; //delete by ***** for segment fault
        p_block->i_buffer -= FF_INPUT_BUFFER_PADDING_SIZE;
        memset( &p_block->p_buffer[p_block->i_buffer], 0, FF_INPUT_BUFFER_PADDING_SIZE );


        p_block->i_flags |= BLOCK_FLAG_PRIVATE_REALLOCATED;
    }
}    


segment fault log:

-------------------

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb55fbb70 (LWP 1594)]
DecodeAudio (p_dec=0x8425c30, pp_block=0xb55fb26c) at audio.c:302
302        *pp_block = p_block;
(gdb) bt
#0  DecodeAudio (p_dec=0x8425c30, pp_block=0xb55fb26c) at audio.c:302
#1  0x00187b9c in DecoderDecodeAudio (p_dec=<value optimized out>, 
    p_block=0x8438370) at input/decoder.c:1291
#2  0x001892fa in DecoderProcessAudio (p_dec=<value optimized out>, 
    p_block=0x8438370) at input/decoder.c:1936
#3  DecoderProcess (p_dec=<value optimized out>, p_block=0x8438370)
    at input/decoder.c:2059
#4  0x0018944a in DecoderThread (p_data=0x8425c30) at input/decoder.c:938
#5  0x002a696e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#6  0x0038b98e in clone () from /lib/tls/i

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值