linux下编译jrtplib-3.9.1

一、下载jrtplib、jthreadjrtplib:http://research.edm.uhasselt.be/jori/jrtplib/jrtplib-3.9.1.zipjthread:http://research.edm.uhasselt.be/jori/jthread/jthread-1.3.1.zipCMake:https://cmake.org/downl

大家好,又见面了,我是你们的朋友全栈君。

一、下载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,如下所示,注意添加的部分。

cmake_minimum_required(VERSION 2.6)

project(jthread)
set(VERSION 1.3.1)
#************************************添加开始******************************
#告知当前使用的是交叉编译方式  
SET(CMAKE_SYSTEM_NAME Linux)  
#设置c编译器  
SET(CMAKE_C_COMPILER "gcc")  
#设置c++编译器  
SET(CMAKE_CXX_COMPILER "g++")
#设置安装路径
set(CMAKE_INSTALL_PREFIX "/usr/local/jrtplibRedHat")
#************************************添加结束******************************
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
set (_DEFAULT_LIBRARY_INSTALL_DIR lib)
if (EXISTS "${CMAKE_INSTALL_PREFIX}/lib32/" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
	set (_DEFAULT_LIBRARY_INSTALL_DIR lib32)
elseif (EXISTS "${CMAKE_INSTALL_PREFIX}/lib64/" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
	set (_DEFAULT_LIBRARY_INSTALL_DIR lib64)
endif ()

set(LIBRARY_INSTALL_DIR "${_DEFAULT_LIBRARY_INSTALL_DIR}" CACHE PATH "Library installation directory")
if(NOT IS_ABSOLUTE "${LIBRARY_INSTALL_DIR}")
	set(LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIR}")
endif()

find_package(Threads)
if (NOT CMAKE_USE_WIN32_THREADS_INIT)
	if (NOT CMAKE_USE_PTHREADS_INIT)
		message(FATAL_ERROR "Can find neither pthread support nor Win32 thread support")
	endif (NOT CMAKE_USE_PTHREADS_INIT)
endif (NOT CMAKE_USE_WIN32_THREADS_INIT)

add_subdirectory(src)

cmake CMakeLists.txt

make

make install

2.jrtplib编译

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

cmake_minimum_required(VERSION 2.6)

project(jrtplib)
set(VERSION 3.9.1)
#************************************添加开始******************************
#告知当前使用的是交叉编译方式  
SET(CMAKE_SYSTEM_NAME Linux)  
#设置c编译器  
SET(CMAKE_C_COMPILER "gcc")  
#设置c++编译器  
SET(CMAKE_CXX_COMPILER "g++")
#设置安装路径
set(CMAKE_INSTALL_PREFIX "/usr/local/jrtplibRedHat")
#************************************添加结束******************************
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")

set (_DEFAULT_LIBRARY_INSTALL_DIR lib)
if (EXISTS "${CMAKE_INSTALL_PREFIX}/lib32/" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
	set (_DEFAULT_LIBRARY_INSTALL_DIR lib32)
elseif (EXISTS "${CMAKE_INSTALL_PREFIX}/lib64/" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
	set (_DEFAULT_LIBRARY_INSTALL_DIR lib64)
endif ()

set(LIBRARY_INSTALL_DIR "${_DEFAULT_LIBRARY_INSTALL_DIR}" CACHE PATH "Library installation directory")
if(NOT IS_ABSOLUTE "${LIBRARY_INSTALL_DIR}")
	set(LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIR}")
endif()

include(CheckCXXCompilerFlag)
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
include(CheckCXXSourceCompiles)
include(TestBigEndian)
include(${PROJECT_SOURCE_DIR}/cmake/Macros.cmake)

find_package(JThread)

set(JRTPLIB_LINK_LIBS "")
#************************************修改开始******************************
set(JRTPLIB_INTERNAL_INCLUDES "/usr/local/jrtplibRedHat/include")
set(JRTPLIB_EXTERNAL_INCLUDES "/usr/local/jrtplibRedHat/include")
#************************************修改结束******************************
add_additional_stuff(JRTPLIB_EXTERNAL_INCLUDES JRTPLIB_LINK_LIBS)

jrtplib_support_option("Support SDES PRIV items" JRTPLIB_SUPPORT_SDESPRIV RTP_SUPPORT_SDESPRIV ON "// No support for SDES PRIV items")
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")
jrtplib_support_option("Support sending RTCP APP packets" JRTPLIB_SUPPORT_SENDAPP RTP_SUPPORT_SENDAPP ON "// No direct support for sending RTCP APP packets")
jrtplib_support_option("Support sending unknown RTCP packets" JRTPLIB_SUPPORT_RTCPUNKNOWN RTP_SUPPORT_RTCPUNKNOWN OFF "// No support for sending unknown RTCP packets")
jrtplib_support_option("Support memory management mechanism" JRTPLIB_SUPPORT_MEMORYMGMT RTP_SUPPORT_MEMORYMANAGEMENT ON "// No memory management support")

jrtplib_include_test(sys/filio.h RTP_HAVE_SYS_FILIO "// Don't have <sys/filio.h>")
jrtplib_include_test(sys/sockio.h RTP_HAVE_SYS_SOCKIO "// Don't have <sys/sockio.h>")
jrtplib_include_test(ifaddrs.h RTP_SUPPORT_IFADDRS "// No ifaddrs support")

if (JTHREAD_FOUND)
	set(V "ON")
else (JTHREAD_FOUND)
	set(V "OFF")
endif (JTHREAD_FOUND)

option(JTHREAD_ENABLED "Thread support" ${V})
if (JTHREAD_ENABLED)
	set (RTP_SUPPORT_THREAD "#define RTP_SUPPORT_THREAD")
	if (JTHREAD_FOUND)
		save_paths(JRTPLIB_EXTERNAL_INCLUDES "${JTHREAD_INCLUDE_DIRS}")
		save_paths(JRTPLIB_LINK_LIBS "${JTHREAD_LIBRARIES}")
	endif(JTHREAD_FOUND)
else (JTHREAD_ENABLED)
	set (RTP_SUPPORT_THREAD "// No support for JThread was enabled")
endif (JTHREAD_ENABLED)

if (CMAKE_CROSSCOMPILING)
	option (JRTPLIB_USE_BIGENDIAN "Target platform is big endian" ON)
	if (JRTPLIB_USE_BIGENDIAN)
		set(RTP_ENDIAN "#define RTP_BIG_ENDIAN")
	else (JRTPLIB_USE_BIGENDIAN)
		set(RTP_ENDIAN "// Little endian system")
	endif (JRTPLIB_USE_BIGENDIAN)
else (CMAKE_CROSSCOMPILING)
	test_big_endian(JRTPLIB_BIGENDIAN)
	if (JRTPLIB_BIGENDIAN)
		set(RTP_ENDIAN "#define RTP_BIG_ENDIAN")
	else (JRTPLIB_BIGENDIAN)
		set(RTP_ENDIAN "// Little endian system")
	endif (JRTPLIB_BIGENDIAN)
endif (CMAKE_CROSSCOMPILING)

jrtplib_test_feature(socklentest RTP_SOCKLENTYPE_UINT TRUE "// socklen_t is 'int'")
jrtplib_test_feature(ipv4mcasttest RTP_SUPPORT_IPV4MULTICAST FALSE "// No IPv4 multicasting support")
jrtplib_test_feature(salentest RTP_HAVE_SOCKADDR_LEN FALSE "// No sa_len member in struct sockaddr")
jrtplib_test_feature(getloginrtest RTP_SUPPORT_GETLOGINR FALSE "// Not using getlogin_r")
jrtplib_test_feature(ipv6test RTP_SUPPORT_IPV6 FALSE "// No IPv6 support")
jrtplib_test_feature(ipv6mcasttest RTP_SUPPORT_IPV6MULTICAST FALSE "// No IPv6 multicasting support")

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)
if (JRTPLIB_STDINT)
	set(RTP_INTTYPE_HEADERS "#include <stdint.h>\n#include <sys/types.h>")
else (JRTPLIB_STDINT)
	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)
	if (JRTPLIB_INTTYPES)
		set(RTP_INTTYPE_HEADERS "#include <inttypes.h>\n#include <sys/types.h>\n")
	else (JRTPLIB_INTTYPES)
		if (NOT UNIX AND WIN32)
			set(RTP_INTTYPE_HEADERS "#include \"rtptypes_win.h\"")
		else (NOT UNIX AND WIN32)
			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")
			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")
		endif (NOT UNIX AND WIN32)
	endif (JRTPLIB_INTTYPES)
endif (JRTPLIB_STDINT)

if (NOT UNIX AND WIN32)
	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")
endif (NOT UNIX AND WIN32)

if (NOT UNIX)
	set(JRTPLIB_COMPILE_STATIC ON CACHE BOOL "Flag indicating if a static library should be built, or a dynamic one")
	list(APPEND JRTPLIB_LINK_LIBS "ws2_32")
endif (NOT UNIX)

if (UNIX OR JRTPLIB_COMPILE_STATIC)
	set(JRTPLIB_IMPORT "")
	set(JRTPLIB_EXPORT "")
else (UNIX OR JRTPLIB_COMPILE_STATIC)
	set(JRTPLIB_IMPORT "__declspec(dllimport)")
	set(JRTPLIB_EXPORT "__declspec(dllexport)")
endif (UNIX OR JRTPLIB_COMPILE_STATIC)

configure_file("${PROJECT_SOURCE_DIR}/src/rtptypes.h.in" "${PROJECT_BINARY_DIR}/src/rtptypes.h")
configure_file("${PROJECT_SOURCE_DIR}/src/rtpconfig.h.in" "${PROJECT_BINARY_DIR}/src/rtpconfig.h")

save_paths(JRTPLIB_INTERNAL_INCLUDES "${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/src")

add_subdirectory(src)

 
if (UNIX)
	get_target_property(JRTPLIB_LOCAL_LIBRARY_NAME jrtplib-shared LOCATION)
	get_filename_component(JRTPLIB_LIBNAME "${JRTPLIB_LOCAL_LIBRARY_NAME}" NAME)
	set(JRTPLIB_LIBS "${LIBRARY_INSTALL_DIR}/${JRTPLIB_LIBNAME}")
else (UNIX)
	if (JRTPLIB_COMPILE_STATIC)
		get_target_property(JRTPLIB_LOCAL_LIBRARY_NAME jrtplib-static RELEASE_LOCATION)
		get_filename_component(JRTPLIB_LIBNAME_RELEASE "${JRTPLIB_LOCAL_LIBRARY_NAME}" NAME_WE)
		get_target_property(JRTPLIB_LOCAL_LIBRARY_NAME jrtplib-static DEBUG_LOCATION)
		get_filename_component(JRTPLIB_LIBNAME_DEBUG "${JRTPLIB_LOCAL_LIBRARY_NAME}" NAME_WE)
	else (JRTPLIB_COMPILE_STATIC)
		get_target_property(JRTPLIB_LOCAL_LIBRARY_NAME jrtplib-shared RELEASE_LOCATION)
		get_filename_component(JRTPLIB_LIBNAME_RELEASE "${JRTPLIB_LOCAL_LIBRARY_NAME}" NAME_WE)
		get_target_property(JRTPLIB_LOCAL_LIBRARY_NAME jrtplib-shared DEBUG_LOCATION)
		get_filename_component(JRTPLIB_LIBNAME_DEBUG "${JRTPLIB_LOCAL_LIBRARY_NAME}" NAME_WE)
	endif (JRTPLIB_COMPILE_STATIC)
	set(JRTPLIB_LIBS optimized "${LIBRARY_INSTALL_DIR}/${JRTPLIB_LIBNAME_RELEASE}.lib" 
		         debug "${LIBRARY_INSTALL_DIR}/${JRTPLIB_LIBNAME_DEBUG}.lib")
endif (UNIX)

set(JRTPLIB_INCDIRS ${JRTPLIB_EXTERNAL_INCLUDES} ${CMAKE_INSTALL_PREFIX}/include)
set(JRTPLIB_LIBS ${JRTPLIB_LIBS} ${JRTPLIB_LINK_LIBS})
remove_empty(JRTPLIB_INCDIRS)
list(REMOVE_DUPLICATES JRTPLIB_INCDIRS)
remove_empty(JRTPLIB_LIBS)

foreach(ARG ${JRTPLIB_LIBS})
	set(JRTPLIB_LIBS_CMAKECONFIG "${JRTPLIB_LIBS_CMAKECONFIG} \"${ARG}\"")
endforeach()
foreach(ARG ${JRTPLIB_INCDIRS})
	set(JRTPLIB_INCDIRS_CMAKECONFIG "${JRTPLIB_INCDIRS_CMAKECONFIG} \"${ARG}\"")
endforeach()

configure_file("${PROJECT_SOURCE_DIR}/cmake/JRTPLIBConfig.cmake.in" "${PROJECT_BINARY_DIR}/cmake/JRTPLIBConfig.cmake")
install(FILES "${PROJECT_BINARY_DIR}/cmake/JRTPLIBConfig.cmake" DESTINATION ${LIBRARY_INSTALL_DIR}/cmake/JRTPLIB)

if (UNIX)
	foreach(ARG ${JRTPLIB_LIBS})
		set(JRTPLIB_LIBS_PKGCONFIG "${JRTPLIB_LIBS_PKGCONFIG} ${ARG}")
	endforeach()
	foreach(ARG ${JRTPLIB_INCDIRS})
		set(JRTPLIB_INCDIRS_PKGCONFIG "${JRTPLIB_INCDIRS_PKGCONFIG} -I${ARG}")
	endforeach()

	configure_file(${PROJECT_SOURCE_DIR}/pkgconfig/jrtplib.pc.in ${PROJECT_BINARY_DIR}/pkgconfig/jrtplib.pc)
	install(FILES ${PROJECT_BINARY_DIR}/pkgconfig/jrtplib.pc DESTINATION ${LIBRARY_INSTALL_DIR}/pkgconfig)
endif (UNIX)

cmake CMakeLists.txt

make

make install

原创不易,转载请标明出处:https://blog.csdn.net/caoshangpa/article/details/51416822

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/126727.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • zero based budgeting_monetdb

    zero based budgeting_monetdbMcObjectODBCimplementsmostoftheODBC3.0standardsexcept‘descriptors’, whicharesupplementary.Currently,theMcObjectODBCdriverreturns“02.00”asthe driverversion.OpenaDOSCMD.EX

    2022年10月14日
    0
  • 基于ssm的医院病历管理系统SSM医院管理系统

    基于ssm医院病历管理系统基于ssm医院病历管理系统介绍:eclipse,mysql,spring,springmvc,mybatis本设计主要实现集人性化、高效率、便捷等优点于一身的医院病历管理系统,完成系统用户管理、医生管理、护士管理、病人管理、病历管理、药品管理、医生统计等功能模块医院病历管理系统的设计与实现摘要随着互联网趋势的到来,各行各业都在考虑利用互联网将自己推广出去,最好方式就是建立自己的互联网系统,并对其进行维护和管理。在现实运用中,应用软件的工作规则和开发步骤,

    2022年4月9日
    38
  • 如何安装sqlmap(怎么看python安装成功)

    第一步:下载python:https://www.python.org/downloads/(这里有python各种版本,但是一般建议安装3和2.7)sqlmap:https://github.com/sqlmapproject/sqlmap/tarball/master第二步:在Windows我的电脑》属性》高级》环境变量里找到p…

    2022年4月15日
    30
  • 面试题整理|45个CSS面试题

    面试题整理|45个CSS面试题面试题整理|45个CSS面试题一、初级CSS面试题二、中级CSS面试题三、进阶CSS面试题四《HTML5&CSS3还原美团外卖》移动端布局实战CSS已成为Web设计不可或缺的一部分,它让web页面变得更加美观,更具设计感。在前端面试中,CSS面试题也占有一定比重。本篇文章,将为大家分享45个和CSS相关的面试题及其解析,难度分为:初级、中级、高级三个部分,由易到难,循序渐进。一、初级CSS面试题Q1、CSS全称是什么?CSS英文全称:CascadingStyleSheets,也就是层

    2022年5月31日
    39
  • .pfx数字证书制作及操作使用

    .pfx数字证书制作及操作使用#.pfx数字证书制作及操作使用使用工具.pfx创建从*.pfx文件提取密钥Java代码操作#工具下载地址链接:http://pan.baidu.com/s/1jHOyIQa密码:aund#创建.pfxCN=名称(一般填公司名称)OU=单位名称O=作者名称L=地区C=国家第一步打开CertManager

    2022年5月20日
    144
  • 简单易懂的自动编码器

    简单易懂的自动编码器作者:叶虎编辑:田旭引言自动编码器是一种无监督的神经网络模型,它可以学习到输入数据的隐含特征,这称为编码(coding),同时用学习到的新特征可以重构出原始输入数据,称之为解码(decoding)。从直观上来看,自动编码器可以用于特征降维,类似主成分分析PCA,但是其相比PCA其性能更强,这是由于神经网络模型可以提取更有效的新特征。除了进行特征降维,

    2022年5月7日
    52

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号