概述
实编译SRS源码方法狠简单,
切换到trunk目录,直接执行:
./configure && make
就搞定
但是呢,ubuntu15的版本却提示,以下错误
=====================================================
egenerate config: --prefix=/usr/local/srs --with-hls --with-hds --with-dvr --without-nginx --with-ssl --without-ffmpeg --with-transcode --with-ingest --with-stat --with-http-callback --with-http-server --without-stream-caster --with-http-api --with-librtmp --without-research --with-utest --without-gperf --without-gmc --without-gmp --without-gcp --without-gprof --without-arm-ubuntu12 --without-mips-ubuntu12 --log-trace
check gcc/g++/gdb/make
depends tools are ok
Ubuntu detected, install tools if needed
Ubuntu install tools success
build st-1.9t
patching file md.h
patching file io.c
patching file Makefile
make OS="LINUX" BUILD="DBG"
make[1]: Entering directory '/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9'
if [ ! -d LINUX_4.2.0-25-generic_DBG ]; then mkdir LINUX_4.2.0-25-generic_DBG; fi
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -c sched.c -o LINUX_4.2.0-25-generic_DBG/sched.o
sched.c: In function ‘_st_vp_check_clock’:
sched.c:470:14: warning: variable ‘elapsed’ set but not used [-Wunused-but-set-variable]
st_utime_t elapsed, now;
^
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -c stk.c -o LINUX_4.2.0-25-generic_DBG/stk.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -c sync.c -o LINUX_4.2.0-25-generic_DBG/sync.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -c key.c -o LINUX_4.2.0-25-generic_DBG/key.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -c io.c -o LINUX_4.2.0-25-generic_DBG/io.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -c event.c -o LINUX_4.2.0-25-generic_DBG/event.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -c md.S -o LINUX_4.2.0-25-generic_DBG/md.o
ar -rv LINUX_4.2.0-25-generic_DBG/libst.a LINUX_4.2.0-25-generic_DBG/sched.o LINUX_4.2.0-25-generic_DBG/stk.o LINUX_4.2.0-25-generic_DBG/sync.o LINUX_4.2.0-25-generic_DBG/key.o LINUX_4.2.0-25-generic_DBG/io.o LINUX_4.2.0-25-generic_DBG/event.o LINUX_4.2.0-25-generic_DBG/md.o
ar: 正在创建 LINUX_4.2.0-25-generic_DBG/libst.a
a - LINUX_4.2.0-25-generic_DBG/sched.o
a - LINUX_4.2.0-25-generic_DBG/stk.o
a - LINUX_4.2.0-25-generic_DBG/sync.o
a - LINUX_4.2.0-25-generic_DBG/key.o
a - LINUX_4.2.0-25-generic_DBG/io.o
a - LINUX_4.2.0-25-generic_DBG/event.o
a - LINUX_4.2.0-25-generic_DBG/md.o
ranlib LINUX_4.2.0-25-generic_DBG/libst.a
rm -f obj; ln -s LINUX_4.2.0-25-generic_DBG obj
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -fPIC -c sched.c -o LINUX_4.2.0-25-generic_DBG/sched-pic.o
sched.c: In function ‘_st_vp_check_clock’:
sched.c:470:14: warning: variable ‘elapsed’ set but not used [-Wunused-but-set-variable]
st_utime_t elapsed, now;
^
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -fPIC -c stk.c -o LINUX_4.2.0-25-generic_DBG/stk-pic.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -fPIC -c sync.c -o LINUX_4.2.0-25-generic_DBG/sync-pic.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -fPIC -c key.c -o LINUX_4.2.0-25-generic_DBG/key-pic.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -fPIC -c io.c -o LINUX_4.2.0-25-generic_DBG/io-pic.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -fPIC -c event.c -o LINUX_4.2.0-25-generic_DBG/event-pic.o
rm -f LINUX_4.2.0-25-generic_DBG/md-pic.o; ln -s md.o LINUX_4.2.0-25-generic_DBG/md-pic.o
ld -shared -soname=libst.so.1 -lc LINUX_4.2.0-25-generic_DBG/sched-pic.o LINUX_4.2.0-25-generic_DBG/stk-pic.o LINUX_4.2.0-25-generic_DBG/sync-pic.o LINUX_4.2.0-25-generic_DBG/key-pic.o LINUX_4.2.0-25-generic_DBG/io-pic.o LINUX_4.2.0-25-generic_DBG/event-pic.o LINUX_4.2.0-25-generic_DBG/md-pic.o -o LINUX_4.2.0-25-generic_DBG/libst.so.1.9
LINUX_4.2.0-25-generic_DBG/sched-pic.o:在函数‘st_poll’中:
/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9/sched.c:108:对‘__stack_chk_fail_local’未定义的引用
LINUX_4.2.0-25-generic_DBG/sync-pic.o:在函数‘st_utime’中:
/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9/sync.c:70:对‘__stack_chk_fail_local’未定义的引用
LINUX_4.2.0-25-generic_DBG/io-pic.o:在函数‘_st_io_init’中:
/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9/io.c:106:对‘__stack_chk_fail_local’未定义的引用
LINUX_4.2.0-25-generic_DBG/io-pic.o:在函数‘_st_netfd_new’中:
/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9/io.c:166:对‘__stack_chk_fail_local’未定义的引用
LINUX_4.2.0-25-generic_DBG/io-pic.o:在函数‘st_netfd_poll’中:
/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9/io.c:241:对‘__stack_chk_fail_local’未定义的引用
LINUX_4.2.0-25-generic_DBG/io-pic.o:/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9/io.c:438: more undefined references to `__stack_chk_fail_local' follow
Makefile:356: recipe for target 'LINUX_4.2.0-25-generic_DBG/libst.so.1.9' failed
make[1]: *** [LINUX_4.2.0-25-generic_DBG/libst.so.1.9] Error 1
make[1]: Leaving directory '/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9'
Makefile:441: recipe for target 'linux-debug' failed
make: *** [linux-debug] Error 2
build st-1.9 failed, ret=2
afa@afa-VirtualBox:~/work/tmp/srs-2.0release/trunk$
afa@afa-VirtualBox:~/work/tmp/srs-2.0release/trunk$ grep -rn 'regenerate config' ./
./auto/options.sh:847: echo "regenerate config: ${SRS_AUTO_CONFIGURE}"
afa@afa-VirtualBox:~/work/tmp/srs-2.0release/trunk$ grep -rn 'regenerate_options' ./
./auto/options.sh:815:function regenerate_options() {
./auto/options.egenerate config: --prefix=/usr/local/srs --with-hls --with-hds --with-dvr --without-nginx --with-ssl --without-ffmpeg --with-transcode --with-ingest --with-stat --with-http-callback --with-http-server --without-stream-caster --with-http-api --with-librtmp --without-research --with-utest --without-gperf --without-gmc --without-gmp --without-gcp --without-gprof --without-arm-ubuntu12 --without-mips-ubuntu12 --log-trace
check gcc/g++/gdb/make
depends tools are ok
Ubuntu detected, install tools if needed
Ubuntu install tools success
build st-1.9t
patching file md.h
patching file io.c
patching file Makefile
make OS="LINUX" BUILD="DBG"
make[1]: Entering directory '/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9'
if [ ! -d LINUX_4.2.0-25-generic_DBG ]; then mkdir LINUX_4.2.0-25-generic_DBG; fi
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -c sched.c -o LINUX_4.2.0-25-generic_DBG/sched.o
sched.c: In function ‘_st_vp_check_clock’:
sched.c:470:14: warning: variable ‘elapsed’ set but not used [-Wunused-but-set-variable]
st_utime_t elapsed, now;
^
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -c stk.c -o LINUX_4.2.0-25-generic_DBG/stk.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -c sync.c -o LINUX_4.2.0-25-generic_DBG/sync.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -c key.c -o LINUX_4.2.0-25-generic_DBG/key.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -c io.c -o LINUX_4.2.0-25-generic_DBG/io.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -c event.c -o LINUX_4.2.0-25-generic_DBG/event.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -c md.S -o LINUX_4.2.0-25-generic_DBG/md.o
ar -rv LINUX_4.2.0-25-generic_DBG/libst.a LINUX_4.2.0-25-generic_DBG/sched.o LINUX_4.2.0-25-generic_DBG/stk.o LINUX_4.2.0-25-generic_DBG/sync.o LINUX_4.2.0-25-generic_DBG/key.o LINUX_4.2.0-25-generic_DBG/io.o LINUX_4.2.0-25-generic_DBG/event.o LINUX_4.2.0-25-generic_DBG/md.o
ar: 正在创建 LINUX_4.2.0-25-generic_DBG/libst.a
a - LINUX_4.2.0-25-generic_DBG/sched.o
a - LINUX_4.2.0-25-generic_DBG/stk.o
a - LINUX_4.2.0-25-generic_DBG/sync.o
a - LINUX_4.2.0-25-generic_DBG/key.o
a - LINUX_4.2.0-25-generic_DBG/io.o
a - LINUX_4.2.0-25-generic_DBG/event.o
a - LINUX_4.2.0-25-generic_DBG/md.o
ranlib LINUX_4.2.0-25-generic_DBG/libst.a
rm -f obj; ln -s LINUX_4.2.0-25-generic_DBG obj
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -fPIC -c sched.c -o LINUX_4.2.0-25-generic_DBG/sched-pic.o
sched.c: In function ‘_st_vp_check_clock’:
sched.c:470:14: warning: variable ‘elapsed’ set but not used [-Wunused-but-set-variable]
st_utime_t elapsed, now;
^
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -fPIC -c stk.c -o LINUX_4.2.0-25-generic_DBG/stk-pic.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -fPIC -c sync.c -o LINUX_4.2.0-25-generic_DBG/sync-pic.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -fPIC -c key.c -o LINUX_4.2.0-25-generic_DBG/key-pic.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -fPIC -c io.c -o LINUX_4.2.0-25-generic_DBG/io-pic.o
cc -DLINUX -DDEBUG -Wall -g -DMD_HAVE_EPOLL -fPIC -c event.c -o LINUX_4.2.0-25-generic_DBG/event-pic.o
rm -f LINUX_4.2.0-25-generic_DBG/md-pic.o; ln -s md.o LINUX_4.2.0-25-generic_DBG/md-pic.o
ld -shared -soname=libst.so.1 -lc LINUX_4.2.0-25-generic_DBG/sched-pic.o LINUX_4.2.0-25-generic_DBG/stk-pic.o LINUX_4.2.0-25-generic_DBG/sync-pic.o LINUX_4.2.0-25-generic_DBG/key-pic.o LINUX_4.2.0-25-generic_DBG/io-pic.o LINUX_4.2.0-25-generic_DBG/event-pic.o LINUX_4.2.0-25-generic_DBG/md-pic.o -o LINUX_4.2.0-25-generic_DBG/libst.so.1.9
LINUX_4.2.0-25-generic_DBG/sched-pic.o:在函数‘st_poll’中:
/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9/sched.c:108:对‘__stack_chk_fail_local’未定义的引用
LINUX_4.2.0-25-generic_DBG/sync-pic.o:在函数‘st_utime’中:
/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9/sync.c:70:对‘__stack_chk_fail_local’未定义的引用
LINUX_4.2.0-25-generic_DBG/io-pic.o:在函数‘_st_io_init’中:
/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9/io.c:106:对‘__stack_chk_fail_local’未定义的引用
LINUX_4.2.0-25-generic_DBG/io-pic.o:在函数‘_st_netfd_new’中:
/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9/io.c:166:对‘__stack_chk_fail_local’未定义的引用
LINUX_4.2.0-25-generic_DBG/io-pic.o:在函数‘st_netfd_poll’中:
/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9/io.c:241:对‘__stack_chk_fail_local’未定义的引用
LINUX_4.2.0-25-generic_DBG/io-pic.o:/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9/io.c:438: more undefined references to `__stack_chk_fail_local' follow
Makefile:356: recipe for target 'LINUX_4.2.0-25-generic_DBG/libst.so.1.9' failed
make[1]: *** [LINUX_4.2.0-25-generic_DBG/libst.so.1.9] Error 1
make[1]: Leaving directory '/home/afa/work/tmp/srs-2.0release/trunk/objs/st-1.9'
Makefile:441: recipe for target 'linux-debug' failed
make: *** [linux-debug] Error 2
build st-1.9 failed, ret=2
======================================================
貌似少了一些定义,
没见过的,只能找google了,果然有人遇到了,问题处在编译选项上:
若在ubuntu上编译代码遇到"__stack_chk_fail_local"错误时,在makefile CFLAGS中加入"-fno-stack-protector"
参考:
http://blog.csdn.net/duanbeibei/article/details/11890929
问题找到了,果断搜索一下代码
在auto/depends.sh文件中找到了,红色字体即为修改后的
#####################################################################################
# st-1.9
#####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# check the cross build flag file, if flag changed, need to rebuild the st.
_ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_EPOLL -fno-stack-protector"
# for osx, use darwin for st, donot use epoll.
if [ $OS_IS_OSX = YES ]; then
_ST_MAKE=darwin-debug && _ST_EXTRA_CFLAGS="EXTRA_CFLAGS=-DMD_HAVE_KQUEUE"
fi
# memory leak for linux-optimized
# @see: https://github.com/simple-rtmp-server/srs/issues/197
if [ $SRS_CROSS_BUILD = YES ]; then
# ok, arm specified, if the flag filed does not exists, need to rebuild.
if [[ -f ${SRS_OBJS}/_flag.st.cross.build.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then
echo "st-1.9t for arm is ok.";
else
# TODO: FIXME: patch the bug.
# patch st for arm, @see: https://github.com/simple-rtmp-server/srs/wiki/v1_CN_SrsLinuxArm#st-arm-bug-fix
echo "build st-1.9t for arm";
(
rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 && chmod +w * &&
patch -p0 < ../../3rdparty/patches/1.st.arm.patch &&
patch -p0 < ../../3rdparty/patches/3.st.osx.kqueue.patch &&
patch -p0 < ../../3rdparty/patches/4.st.disable.examples.patch &&
make ${_ST_MAKE} CC=${SrsArmCC} AR=${SrsArmAR} LD=${SrsArmLD} RANDLIB=${SrsArmRANDLIB} EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" &&
cd .. && rm -rf st && ln -sf st-1.9/obj st &&
cd .. && touch ${SRS_OBJS}/_flag.st.cross.build.tmp
)
fi
=========================================
参考链接:
http://blog.csdn.net/duanbeibei/article/details/11890929
最后
以上就是务实黄蜂为你收集整理的srs compile error的全部内容,希望文章能够帮你解决srs compile error所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复