网站:http://blog.csdn.net/caoshangpa/article/details/51416822

一、下载jrtplib、jthread、CMake

jrtplib:http://research.edm.uhasselt.be/jori/jrtplib/jrtplib-3.9.1.zip

jthread:http://research.edm.uhasselt.be/jori/jthread/jthread-1.3.1.zip

CMake:https://cmake.org/download/,最新版已经到3.5.1,我用的是3.4.0

注意,如果jrtplib编译过程中报错/usr/bin/ld:cannot find -lIN,参考:http://blog.csdn.NET/caoshangpa/article/details/51416500

二、编译

1.jthread编译

修改CMakeLists.txt,如下所示,注意添加的部分。

[cpp] view plaincopy
  1. cmake_minimum_required(VERSION 2.6)
  2. project(jthread)
  3. set(VERSION 1.3.1)
  4. #************************************添加开始******************************
  5. #告知当前使用的是交叉编译方式
  6. SET(CMAKE_SYSTEM_NAME Linux)
  7. #设置c编译器
  8. SET(CMAKE_C_COMPILER "gcc")
  9. #设置c++编译器
  10. SET(CMAKE_CXX_COMPILER "g++")
  11. #设置安装路径
  12. set(CMAKE_INSTALL_PREFIX "/usr/local/jrtplibRedHat")
  13. #************************************添加结束******************************
  14. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
  15. set (_DEFAULT_LIBRARY_INSTALL_DIR lib)
  16. if (EXISTS "${CMAKE_INSTALL_PREFIX}/lib32/" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
  17. set (_DEFAULT_LIBRARY_INSTALL_DIR lib32)
  18. elseif (EXISTS "${CMAKE_INSTALL_PREFIX}/lib64/" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
  19. set (_DEFAULT_LIBRARY_INSTALL_DIR lib64)
  20. endif ()
  21. set(LIBRARY_INSTALL_DIR "${_DEFAULT_LIBRARY_INSTALL_DIR}" CACHE PATH "Library installation directory")
  22. if(NOT IS_ABSOLUTE "${LIBRARY_INSTALL_DIR}")
  23. set(LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIR}")
  24. endif()
  25. find_package(Threads)
  26. if (NOT CMAKE_USE_WIN32_THREADS_INIT)
  27. if (NOT CMAKE_USE_PTHREADS_INIT)
  28. message(FATAL_ERROR "Can find neither pthread support nor Win32 thread support")
  29. endif (NOT CMAKE_USE_PTHREADS_INIT)
  30. endif (NOT CMAKE_USE_WIN32_THREADS_INIT)
  31. add_subdirectory(src)

cmake CMakeLists.txt

make

make install

2.jrtplib编译

修改CMakeLists.txt,如下所示,注意添加和修改的部分。

[cpp] view plaincopy
  1. cmake_minimum_required(VERSION 2.6)
  2. project(jrtplib)
  3. set(VERSION 3.9.1)
  4. #************************************添加开始******************************
  5. #告知当前使用的是交叉编译方式
  6. SET(CMAKE_SYSTEM_NAME Linux)
  7. #设置c编译器
  8. SET(CMAKE_C_COMPILER "gcc")
  9. #设置c++编译器
  10. SET(CMAKE_CXX_COMPILER "g++")
  11. #设置安装路径
  12. set(CMAKE_INSTALL_PREFIX "/usr/local/jrtplibRedHat")
  13. #************************************添加结束******************************
  14. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
  15. set (_DEFAULT_LIBRARY_INSTALL_DIR lib)
  16. if (EXISTS "${CMAKE_INSTALL_PREFIX}/lib32/" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
  17. set (_DEFAULT_LIBRARY_INSTALL_DIR lib32)
  18. elseif (EXISTS "${CMAKE_INSTALL_PREFIX}/lib64/" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
  19. set (_DEFAULT_LIBRARY_INSTALL_DIR lib64)
  20. endif ()
  21. set(LIBRARY_INSTALL_DIR "${_DEFAULT_LIBRARY_INSTALL_DIR}" CACHE PATH "Library installation directory")
  22. if(NOT IS_ABSOLUTE "${LIBRARY_INSTALL_DIR}")
  23. set(LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIR}")
  24. endif()
  25. include(CheckCXXCompilerFlag)
  26. include(CheckIncludeFile)
  27. include(CheckIncludeFileCXX)
  28. include(CheckCXXSourceCompiles)
  29. include(TestBigEndian)
  30. include(${PROJECT_SOURCE_DIR}/cmake/Macros.cmake)
  31. find_package(JThread)
  32. set(JRTPLIB_LINK_LIBS "")
  33. #************************************修改开始******************************
  34. set(JRTPLIB_INTERNAL_INCLUDES "/usr/local/jrtplibRedHat/include")
  35. set(JRTPLIB_EXTERNAL_INCLUDES "/usr/local/jrtplibRedHat/include")
  36. #************************************修改结束******************************
  37. add_additional_stuff(JRTPLIB_EXTERNAL_INCLUDES JRTPLIB_LINK_LIBS)
  38. jrtplib_support_option("Support SDES PRIV items" JRTPLIB_SUPPORT_SDESPRIV RTP_SUPPORT_SDESPRIV ON "// No support for SDES PRIV items")
  39. jrtplib_support_option("Support the probation mechanism for a new source" JRTPLIB_SUPPORT_PROBATION RTP_SUPPORT_PROBATION ON "// Do not wait for a number of consecutive packets to validate source")
  40. jrtplib_support_option("Support sending RTCP APP packets" JRTPLIB_SUPPORT_SENDAPP RTP_SUPPORT_SENDAPP ON "// No direct support for sending RTCP APP packets")
  41. jrtplib_support_option("Support sending unknown RTCP packets" JRTPLIB_SUPPORT_RTCPUNKNOWN RTP_SUPPORT_RTCPUNKNOWN OFF "// No support for sending unknown RTCP packets")
  42. jrtplib_support_option("Support memory management mechanism" JRTPLIB_SUPPORT_MEMORYMGMT RTP_SUPPORT_MEMORYMANAGEMENT ON "// No memory management support")
  43. jrtplib_include_test(sys/filio.h RTP_HAVE_SYS_FILIO "// Don't have <sys/filio.h>")
  44. jrtplib_include_test(sys/sockio.h RTP_HAVE_SYS_SOCKIO "// Don't have <sys/sockio.h>")
  45. jrtplib_include_test(ifaddrs.h RTP_SUPPORT_IFADDRS "// No ifaddrs support")
  46. if (JTHREAD_FOUND)
  47. set(V "ON")
  48. else (JTHREAD_FOUND)
  49. set(V "OFF")
  50. endif (JTHREAD_FOUND)
  51. option(JTHREAD_ENABLED "Thread support" ${V})
  52. if (JTHREAD_ENABLED)
  53. set (RTP_SUPPORT_THREAD "#define RTP_SUPPORT_THREAD")
  54. if (JTHREAD_FOUND)
  55. save_paths(JRTPLIB_EXTERNAL_INCLUDES "${JTHREAD_INCLUDE_DIRS}")
  56. save_paths(JRTPLIB_LINK_LIBS "${JTHREAD_LIBRARIES}")
  57. endif(JTHREAD_FOUND)
  58. else (JTHREAD_ENABLED)
  59. set (RTP_SUPPORT_THREAD "// No support for JThread was enabled")
  60. endif (JTHREAD_ENABLED)
  61. if (CMAKE_CROSSCOMPILING)
  62. option (JRTPLIB_USE_BIGENDIAN "Target platform is big endian" ON)
  63. if (JRTPLIB_USE_BIGENDIAN)
  64. set(RTP_ENDIAN "#define RTP_BIG_ENDIAN")
  65. else (JRTPLIB_USE_BIGENDIAN)
  66. set(RTP_ENDIAN "// Little endian system")
  67. endif (JRTPLIB_USE_BIGENDIAN)
  68. else (CMAKE_CROSSCOMPILING)
  69. test_big_endian(JRTPLIB_BIGENDIAN)
  70. if (JRTPLIB_BIGENDIAN)
  71. set(RTP_ENDIAN "#define RTP_BIG_ENDIAN")
  72. else (JRTPLIB_BIGENDIAN)
  73. set(RTP_ENDIAN "// Little endian system")
  74. endif (JRTPLIB_BIGENDIAN)
  75. endif (CMAKE_CROSSCOMPILING)
  76. jrtplib_test_feature(socklentest RTP_SOCKLENTYPE_UINT TRUE "// socklen_t is 'int'")
  77. jrtplib_test_feature(ipv4mcasttest RTP_SUPPORT_IPV4MULTICAST FALSE "// No IPv4 multicasting support")
  78. jrtplib_test_feature(salentest RTP_HAVE_SOCKADDR_LEN FALSE "// No sa_len member in struct sockaddr")
  79. jrtplib_test_feature(getloginrtest RTP_SUPPORT_GETLOGINR FALSE "// Not using getlogin_r")
  80. jrtplib_test_feature(ipv6test RTP_SUPPORT_IPV6 FALSE "// No IPv6 support")
  81. jrtplib_test_feature(ipv6mcasttest RTP_SUPPORT_IPV6MULTICAST FALSE "// No IPv6 multicasting support")
  82. check_cxx_source_compiles("#include <stdint.h>\n#include <sys/types.h>\nint main(void) { size_t a = 0 ; size_t b = a; uint32_t x = 0; uint32_t y = x; return 0; }" JRTPLIB_STDINT)
  83. if (JRTPLIB_STDINT)
  84. set(RTP_INTTYPE_HEADERS "#include <stdint.h>\n#include <sys/types.h>")
  85. else (JRTPLIB_STDINT)
  86. check_cxx_source_compiles("#include <inttypes.h>\n#include <sys/types.h>\nint main(void) { uint32_t x = 0; uint32_t y = x; return 0; }" JRTPLIB_INTTYPES)
  87. if (JRTPLIB_INTTYPES)
  88. set(RTP_INTTYPE_HEADERS "#include <inttypes.h>\n#include <sys/types.h>\n")
  89. else (JRTPLIB_INTTYPES)
  90. if (NOT UNIX AND WIN32)
  91. set(RTP_INTTYPE_HEADERS "#include \"rtptypes_win.h\"")
  92. else (NOT UNIX AND WIN32)
  93. set(RTP_INTTYPE_HEADERS "#error Could not find header files that define types like 'uint32_t'. Please edit the file ${PROJECT_BINARY_DIR}/src/rtptypes_unix.h and make sure that the following types are defined: int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t")
  94. message("\n\nError: Could not find header files that define types like 'uint32_t'.\nPlease edit the file ${PROJECT_BINARY_DIR}/src/rtptypes_unix.h\nand make sure that the following types are defined: \nint8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t\n\n")
  95. endif (NOT UNIX AND WIN32)
  96. endif (JRTPLIB_INTTYPES)
  97. endif (JRTPLIB_STDINT)
  98. if (NOT UNIX AND WIN32)
  99. set(RTP_WINSOCK_HEADERS "#if defined(WIN32) || defined(_WIN32_WCE)\n    #include <winsock2.h> \n  #include <ws2tcpip.h>\n#ifndef _WIN32_WCE\n   #include <sys/types.h>\n#endif // _WIN32_WCE\n#endif // WIN32 || _WIN32_WCE\n")
  100. endif (NOT UNIX AND WIN32)
  101. if (NOT UNIX)
  102. set(JRTPLIB_COMPILE_STATIC ON CACHE BOOL "Flag indicating if a static library should be built, or a dynamic one")
  103. list(APPEND JRTPLIB_LINK_LIBS "ws2_32")
  104. endif (NOT UNIX)
  105. if (UNIX OR JRTPLIB_COMPILE_STATIC)
  106. set(JRTPLIB_IMPORT "")
  107. set(JRTPLIB_EXPORT "")
  108. else (UNIX OR JRTPLIB_COMPILE_STATIC)
  109. set(JRTPLIB_IMPORT "__declspec(dllimport)")
  110. set(JRTPLIB_EXPORT "__declspec(dllexport)")
  111. endif (UNIX OR JRTPLIB_COMPILE_STATIC)
  112. configure_file("${PROJECT_SOURCE_DIR}/src/rtptypes.h.in" "${PROJECT_BINARY_DIR}/src/rtptypes.h")
  113. configure_file("${PROJECT_SOURCE_DIR}/src/rtpconfig.h.in" "${PROJECT_BINARY_DIR}/src/rtpconfig.h")
  114. save_paths(JRTPLIB_INTERNAL_INCLUDES "${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/src")
  115. add_subdirectory(src)
  116. if (UNIX)
  117. get_target_property(JRTPLIB_LOCAL_LIBRARY_NAME jrtplib-shared LOCATION)
  118. get_filename_component(JRTPLIB_LIBNAME "${JRTPLIB_LOCAL_LIBRARY_NAME}" NAME)
  119. set(JRTPLIB_LIBS "${LIBRARY_INSTALL_DIR}/${JRTPLIB_LIBNAME}")
  120. else (UNIX)
  121. if (JRTPLIB_COMPILE_STATIC)
  122. get_target_property(JRTPLIB_LOCAL_LIBRARY_NAME jrtplib-static RELEASE_LOCATION)
  123. get_filename_component(JRTPLIB_LIBNAME_RELEASE "${JRTPLIB_LOCAL_LIBRARY_NAME}" NAME_WE)
  124. get_target_property(JRTPLIB_LOCAL_LIBRARY_NAME jrtplib-static DEBUG_LOCATION)
  125. get_filename_component(JRTPLIB_LIBNAME_DEBUG "${JRTPLIB_LOCAL_LIBRARY_NAME}" NAME_WE)
  126. else (JRTPLIB_COMPILE_STATIC)
  127. get_target_property(JRTPLIB_LOCAL_LIBRARY_NAME jrtplib-shared RELEASE_LOCATION)
  128. get_filename_component(JRTPLIB_LIBNAME_RELEASE "${JRTPLIB_LOCAL_LIBRARY_NAME}" NAME_WE)
  129. get_target_property(JRTPLIB_LOCAL_LIBRARY_NAME jrtplib-shared DEBUG_LOCATION)
  130. get_filename_component(JRTPLIB_LIBNAME_DEBUG "${JRTPLIB_LOCAL_LIBRARY_NAME}" NAME_WE)
  131. endif (JRTPLIB_COMPILE_STATIC)
  132. set(JRTPLIB_LIBS optimized "${LIBRARY_INSTALL_DIR}/${JRTPLIB_LIBNAME_RELEASE}.lib"
  133. debug "${LIBRARY_INSTALL_DIR}/${JRTPLIB_LIBNAME_DEBUG}.lib")
  134. endif (UNIX)
  135. set(JRTPLIB_INCDIRS ${JRTPLIB_EXTERNAL_INCLUDES} ${CMAKE_INSTALL_PREFIX}/include)
  136. set(JRTPLIB_LIBS ${JRTPLIB_LIBS} ${JRTPLIB_LINK_LIBS})
  137. remove_empty(JRTPLIB_INCDIRS)
  138. list(REMOVE_DUPLICATES JRTPLIB_INCDIRS)
  139. remove_empty(JRTPLIB_LIBS)
  140. foreach(ARG ${JRTPLIB_LIBS})
  141. set(JRTPLIB_LIBS_CMAKECONFIG "${JRTPLIB_LIBS_CMAKECONFIG} \"${ARG}\"")
  142. endforeach()
  143. foreach(ARG ${JRTPLIB_INCDIRS})
  144. set(JRTPLIB_INCDIRS_CMAKECONFIG "${JRTPLIB_INCDIRS_CMAKECONFIG} \"${ARG}\"")
  145. endforeach()
  146. configure_file("${PROJECT_SOURCE_DIR}/cmake/JRTPLIBConfig.cmake.in" "${PROJECT_BINARY_DIR}/cmake/JRTPLIBConfig.cmake")
  147. install(FILES "${PROJECT_BINARY_DIR}/cmake/JRTPLIBConfig.cmake" DESTINATION ${LIBRARY_INSTALL_DIR}/cmake/JRTPLIB)
  148. if (UNIX)
  149. foreach(ARG ${JRTPLIB_LIBS})
  150. set(JRTPLIB_LIBS_PKGCONFIG "${JRTPLIB_LIBS_PKGCONFIG} ${ARG}")
  151. endforeach()
  152. foreach(ARG ${JRTPLIB_INCDIRS})
  153. set(JRTPLIB_INCDIRS_PKGCONFIG "${JRTPLIB_INCDIRS_PKGCONFIG} -I${ARG}")
  154. endforeach()
  155. configure_file(${PROJECT_SOURCE_DIR}/pkgconfig/jrtplib.pc.in ${PROJECT_BINARY_DIR}/pkgconfig/jrtplib.pc)
  156. install(FILES ${PROJECT_BINARY_DIR}/pkgconfig/jrtplib.pc DESTINATION ${LIBRARY_INSTALL_DIR}/pkgconfig)
  157. endif (UNIX)

cmake CMakeLists.txt

make

make install

linux下编译jrtplib-3.9.1相关推荐

  1. linux 下基于jrtplib库的实时传送实现

    linux 下基于jrtplib库的实时传送实现 一.RTP 是进行实时流媒体传输的标准协议和关键技术 实时传输协议(Real-time Transport Protocol,PRT)是在 Inter ...

  2. linux下基于jrtplib库的实时传送实现

    linux 下基于jrtplib库的实时传送实现 一.RTP 是进行实时流媒体传输的标准协议和关键技术  实时传输协议(Real-time Transport Protocol,PRT)是在 Inte ...

  3. Linux下使用JRTPLIB进行实时流媒体编程

    收藏于 2013-04-22 迁移自本人的百度空间 -------------------------------- 转载自 http://blog.csdn.net/dongliqiang2006/ ...

  4. linux 保存编译log,(转)Linux下编译安装log4cxx

    一个项目的服务器端在Linux平台下,用到了开源日志库log4cxx,这个库是apache项目的一个子库.功能很不错.下面记录下它的编译和安装过程. 第一步安装apr-1.3.8,顺序不能错,它必须首 ...

  5. linux下编译make文件报错“/bin/bash^M: 坏的解释器,使用grep快速定位代码位置

    一.linux下编译make文件报错"/bin/bash^M: 坏的解释器 参考文章:http://blog.csdn.net/liuqiyao_01/article/details/415 ...

  6. 一份简单的在 Linux下编译及调试 C 代码的指南

    摘要: 一份简单的在 Linux下编译及调试 C 代码的指南 对于Linux下的C程序员来说,几乎天天都会和Linux打交道.但在很多人的眼中,Linux是一个易用性极差.靠命令驱动的操作系统,根本无 ...

  7. linux下软件编译终止,[2018年最新整理]linux下编译运行程序命令大全.ppt

    [2018年最新整理]linux下编译运行程序命令大全 1. 项目课题引入 2. Vi编辑器的使用方法 3. Linux中C语言程序的编辑 4. Linux中C语言程序的运行 5. 现场演示案例 课题 ...

  8. linux emule 编译 wx-config --libs,linux下编译wxwidgets所写程序所遇到的问题

    记录linux下编译wxwidgets所遇到的问题 1./home/hrd/baohualib/wxWidgets-3.0.2/include/wx/platform.h:184:22: 致命错误: ...

  9. linux下编译wpa_supplicantnbsp;…

    linux下编译wpa_supplicant 收藏 前一段时间只在vs2005下编译成功过.经过近一段时间的琢磨,今天终于在linux下成功编译了wpa_supplicant. 挺简单的事情折腾了这么 ...

  10. java libpcap,Linux下编译安装libpcap

    要做Sniffer了,先在Linux下编译一下libpcap 1.编译安装flex #libpcap 1.1要求flex必须在2.4.6及以上 wget http://prdownloads.sour ...

最新文章

  1. 小波变换和小波包变换
  2. python2和python3的主要区别
  3. android reboot 定时重启可靠吗,请教一下有人做过安卓系统 reboot 重启之后,appium 能自动重新连接吗...
  4. Matlab找矩阵中最大最小值的位置
  5. 网站添加微信支付功能(小白填坑)
  6. vue中使用原始html插值,VUE.JS中的插值表达式、v-cloak、v-text、v-html、v-bind:、v-on:...
  7. 操作选项_Win 10系统中的电源选项及任务栏图标等功能介绍和操作
  8. c语言 异或_C语言位运算实例讲解
  9. mysql 基础教程 很全
  10. 密码学系列——NTHASH以及MD4算法
  11. 步进电机驱动器电压是多少?
  12. 消费者行为分析包含了哪些内容?
  13. JavaMail发送HTML邮件
  14. Tensorflow函数测试之tf.contrib.layers.embed_sequence
  15. artdialog v6强大的模态对话框v6版api
  16. 姜小白的Python日记Day15 系统模块详解2 sys模块和os模块
  17. python+selenium打开浏览器-设置浏览器路径和驱动器路径
  18. Linux系统基础小白学习(更新中)
  19. 发明了万维网的他,如今却想亲手推翻它
  20. 为知笔记MathJax公式对齐

热门文章

  1. 技术分享连载(六十一)
  2. Kafka官方文档翻译——实现
  3. 使用lxml代替beautifulsoup
  4. hadoop2.2.0 分布式存储hdfs完全分布式搭建及功能测试记录(一)----架构及原理介绍...
  5. AIX samba服务器配置
  6. 如何赋值hook定义的变量
  7. Diango博客--9.归档、分类和标签页
  8. Python 第三方模块之 beautifulsoup(bs4)- 解析 HTML
  9. wireshark 十六进制过滤_CTF流量分析之wireshark使用
  10. sql server 创建唯一性非聚集索引语句_数据库专题—索引原理