在live555的官网上已经有linux下编译的说明,如下:
How to configure and build the code on Unix (including Linux, Mac OS X, QNX, and other Posix-compliant systems)
The source code package can be found (as a ".tar.gz" file) here. Use "tar -x" and "gunzip" (or "tar -xz", if available) to extract the package; then cd to the "live" directory. Then run
./genMakefiles <os-platform>
where <os-platform> is your target platform - e.g., "linux" or "solaris" - defined by a "config.<os-platform>" file. This will generate a Makefile in the "live" directory and each subdirectory. Then run "make".
- If the "make" fails, you may need to make small modifications to the appropriate "config.<os-platform>" file, and then re-run "genMakefiles <os-platform>". (E.g., you may need to add another "-I<dir>" flag to the COMPILE_OPTS definition.)
- Some people (in particular, FreeBSD users) have reported that the GNU version of "make" - often called "gmake" - works better than their default, pre-installed version of "make". (In particular, you should try using "gmake" if you encounter linking problems with the "ar" command.)
- If you're using "gcc" version 3.0 or greater: You may also wish to add the -Wno-deprecated flag to CPLUSPLUS_FLAGS.
- If no "config.<os-platform>" file exists for your target platform, then try using one of the existing files as a template.
If you wish, you can also 'install' the headers, libraries, and applications by running "make install".
现在按如下步骤编译:
1从live555官网上下载源码,执行tar -zxvf live.2011.06.14a.tar.gz,解压到linux目录下。
2到live555目录下,发现有很多类似config.xx-xx的文件名,这是针对不同平台的配置文件。执行./genMakefiles linux-gdb。
3执行make。到此编译完成,在4个子目录下可以找到生成的.a文件。
遇到的问题:
1》执行make时提示:“#include <xlocale.h> // because, on some systems, <locale.h> doesn't include <xlocale.h>; this makes sure that we get both”
找到locale.h文件,发现一段提示为:
// If you're on a system that (for whatever reason) doesn't have either the "setlocale()" or the "newlocale()" function, then
// add "-DLOCALE_NOT_USED" to your "config.*" file.
// If you're on a system that (for whatever reason) has "setlocale()" but not "newlocale()", then
// add "-DXLOCALE_NOT_USED" to your "config.*" file.
// (Note that -DLOCALE_NOT_USED implies -DXLOCALE_NOT_USED; you do not need both.)
// Also, for Windows systems, we define "XLOCALE_NOT_USED" by default, because at least some Windows systems
// (or their development environments) don't have "newlocale()". If, however, your Windows system *does* have "newlocale()",
// then you can override this by defining "XLOCALE_USED" before #including this file.
这个文字的意思是:windows下默认使用XLOCALE_NOT_USED宏,也就是系统有“setlocale()”,无“newlocale()”,我也按照类似的定义,打开“config.linux-gdb”文件,在CPLUSPLUS_FLAGS后加上-DXLOCALE_NOT_USED,保存,再执行make,编译通过。