jrtplib 编译安装配置
生活随笔
收集整理的這篇文章主要介紹了
jrtplib 编译安装配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
? ? RTP 是目前解決流媒體實時傳輸問題的最好辦法,而JRTPLIB 是一個用C++語言實現的RTP庫,包括UDP通訊,它的主頁地址是:Jori's page
? ? jrtplib 源碼的獲取,可以在它的主頁上直接下載,也可以使用git 直接克隆一份。因為它的主頁是國外網站,下載速度非常慢,我這里提供一份已經下載好的最新的jrtplib源碼:jrtplib-3.11.1.tar.gz
? ? 我這里介紹JRTPLIB在ubuntu系統中的編譯安裝以及配置
? ? (1)下載源碼:
? ? ? ??git clone https://github.com/j0r1/JRTPLIB.git
? ? (2)安裝cmake
? ? ? ??sudo apt install cmake
? ? (3)生成Makefile 文件
? ? ? ??sudo cmake CMakeLists.txt?
? ? (4)編譯
? ? ? ? make
? ? (5)安裝
? ? ? ? sudo make ?install
? ? 可以看到已經安裝到下面的路徑去了:
..................... -- Installing: /usr/local/include/jrtplib3/rtpudpv4transmitter.h -- Installing: /usr/local/include/jrtplib3/rtpudpv6transmitter.h -- Installing: /usr/local/include/jrtplib3/rtpbyteaddress.h -- Installing: /usr/local/include/jrtplib3/rtpexternaltransmitter.h -- Installing: /usr/local/include/jrtplib3/rtpsecuresession.h -- Installing: /usr/local/include/jrtplib3/rtpsocketutil.h -- Installing: /usr/local/include/jrtplib3/rtpabortdescriptors.h -- Installing: /usr/local/include/jrtplib3/rtpselect.h -- Installing: /usr/local/include/jrtplib3/rtptcpaddress.h -- Installing: /usr/local/include/jrtplib3/rtptcptransmitter.h -- Installing: /usr/local/include/jrtplib3/rtpfaketransmitter.h -- Installing: /usr/local/lib/libjrtp.a -- Installing: /usr/local/lib/libjrtp.so.3.11.1 -- Installing: /usr/local/lib/libjrtp.so? ? (6)修改頭文件引用
? ? 這個時候編譯jrtplib 自帶的示例程序,會出現下面的錯誤:
licaibiao@lcb:~/test/RTP/JRTPLIB/examples$ g++ example1.cpp -o test -ljrtp example1.cpp:6:24: fatal error: rtpsession.h: No such file or directory compilation terminated. licaibiao@lcb:~/test/RTP/JRTPLIB/examples$ ? ? 這個是頭文件路徑不對引起的。可以直接修改頭文件的引用,如下: licaibiao@lcb:~/test/RTP/JRTPLIB/examples$ vim example1.cpp 1 /*2 Here's a small IPv4 example: it asks for a portbase and a destination and 3 starts sending packets to that destination.4 */5 6 #include <jrtplib3/rtpsession.h>7 #include <jrtplib3/rtpudpv4transmitter.h>8 #include <jrtplib3/rtpipv4address.h>9 #include <jrtplib3/rtpsessionparams.h>10 #include <jrtplib3/rtperrors.h>11 #include <jrtplib3/rtplibraryversion.h>12 #include <stdlib.h>13 #include <stdio.h>14 #include <iostream>15 #include <string>? ? 修改后可編譯通過并生成可執行文件 "example1.cpp" 147L, 3436C written licaibiao@lcb:~/test/RTP/JRTPLIB/examples$ g++ example1.cpp -o test -ljrtp licaibiao@lcb:~/test/RTP/JRTPLIB/examples$ ls CMakeFiles CMakeLists.txt example2.cpp example4.cpp example6.cpp example8.cpp test cmake_install.cmake example1.cpp example3.cpp example5.cpp example7.cpp Makefile licaibiao@lcb:~/test/RTP/JRTPLIB/examples$? ? (7)配置共享鏈接庫
? ? ? ? 直接運行上面生成的test 文件會出現下面的問題:
licaibiao@lcb:~/test/RTP/JRTPLIB/examples$ ./test ./test: error while loading shared libraries: libjrtp.so.3.11.1: cannot open shared object file: No such file or directory licaibiao@lcb:~/test/RTP/JRTPLIB/examples$ ? ? ? ? 這個是共享連接庫連接不到的問題,執行下面命令: sudo ln -s /usr/local/lib/libjrtp.so.3.11.1 /usr/lib/? ? ? 之后運行程序,可正常運行。
licaibiao@lcb:~/test/RTP/JRTPLIB/examples$ ./test Using version 3.11.1 Enter local portbase: 6666Enter the destination IP address 192.168.0.6 Enter the destination port 6666Number of packets you wish to be sent: 10Sending packet 1/10Sending packet 2/10Sending packet 3/10Sending packet 4/10Sending packet 5/10Sending packet 6/10Sending packet 7/10Sending packet 8/10Sending packet 9/10Sending packet 10/10 licaibiao@lcb:~/test/RTP/JRTPLIB/examples$總結
以上是生活随笔為你收集整理的jrtplib 编译安装配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 《黑客攻防技术-系统实战》开篇讲解
- 下一篇: 黑客概念与文化(课程笔记)