Ubuntu 系統(tǒng)下搭建 SRS 流媒體服務器

這個安裝 SRS 服務器的過程,筆者是在 root 身份下進行的。
剛安裝好的 Ubuntu 系統(tǒng)的 root 身份是沒有密碼的,沒有密碼就不能登錄,所以首先要先給 root 設置密碼:
sudo passwd,鍵入兩次密碼設置成功。
然后執(zhí)行 su root 轉換 root 身份。

然后安裝 Git:
執(zhí)行 apt install git

正式安裝

  1. 執(zhí)行 git clone https://github.com/ossrs/srs [該過程很漫長]
  2. 執(zhí)行 cd srs/trunk
  3. 執(zhí)行 ./configure && make
  4. 啟動服務器則執(zhí)行 ./objs/srs -c conf/srs.conf

遇到的問題

若在上節(jié)步驟 3 中的時候報下面的錯誤信息

patching file Makefile
cc -I. -DHTTP_PARSER_STRICT=1  -Wall -Wextra -Werror -O0 -g  -c http_parser.c
http_parser.c: In function ‘http_parser_parse_url’:
http_parser.c:2093:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
         found_at = 1;
         ~~~~~~~~~^~~
http_parser.c:2096:7: note: here
       case s_req_server:
       ^~~~
cc1: all warnings being treated as errors
Makefile:40: recipe for target 'http_parser.o' failed
make: *** [http_parser.o] Error 1
build http-parser-2.1 failed, ret=2

該錯誤將在 SRS3 版本后解決,2 版本則需要開發(fā)者自行處理,處理流程在下。

步驟:

  • 執(zhí)行 cd .. 回到 trunk 目錄

  • 執(zhí)行 cd 3rdparty 進入三方框架目錄

  • 執(zhí)行 mkdir tempcd temp

  • 執(zhí)行 unzip ../http-parser-2.1.zip

    image

  • 執(zhí)行 grep -n "FALLT" ./http-parser-2.1/http_parser.c

    image

  • 執(zhí)行 sed -e s/FALLTROUGH/FALLTHROUGH/ -i ./http-parser-2.1/http_parser.c

  • 執(zhí)行 grep -n "FALLT" ./http-parser-2.1/http_parser.c

    image

  • 執(zhí)行 mv ../http-parser-2.1.zip ../http-parser-2.1-orig.zip

  • 執(zhí)行 zip ../http-parser-2.1.zip http-parser-2.1/*

    image

  • 執(zhí)行 cd ../.. 回到 trunk 文件夾,此時一定是解決成功的 ??。

  • 執(zhí)行 ./configure && make

    image

?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容