这里将根据我自己的环境以及遇到的问题进行总结.
1. 安装Python 2.4或者之后的版本. 因为swtoolkit只能工作在Python 2.x版本, 所以不能安装Python 3.x版本.
下载位置: http://www.python.org/
2. 安装scons-local 2.0.0或者之后的版本. 设置环境变量SCONS_DIR指向包含scons-local的目录, 如/src/libjingle/scons-local/scons-local-2.0.0.final.0/
注意SCONS_DIR指向的目录不是你下载的scons-local包直接解压缩后的目录 (这个目录包括scons.py, scons-README等文件), 而是里面包含的名为scons-local-x.x.x的子目录
下载位置: http://www.scons.org/download.php
3. 安装swtoolkit
下载位置: http://code.google.com/p/swtoolkit/
4. 下载expat包, 解压缩到talk/third_party/expat-2.0.1/
注意不要下载Win32安装包, 而应该是源代码包
下载位置: http://sourceforge.net/projects/expat/
5. 下载最新的srtp包, 解压缩到talk/third_party/srtp
注意不要使用srtp-1.4.4, 因为这个版本遗漏了Libjingle所使用的一些extensions
下载位置: http://sourceforge.net/projects/srtp/develop
为了省去你使用CVS下载最新srtp代码的麻烦, Libjingle已经上传了最新的srtp包, 下载位置: http://libjingle.googlecode.com/files/srtp-cvs.zip
如果你的expat和srtp包在其他位置或者名称不一样, 需要对应地修改talk/libjingle.scons
6. 进入到talk目录, 运行$path_to_swtoolkit/hammer.bat
将会进行编译, 最终将在talk/build/dbg/lib目录下生成:
expat.lib
libjingle.lib
libsrtp.lib
libxmpphelp.lib
在talk/build/dbg/staging目录下生成:
call.exe
login.exe
relayserver.exe
stunserver.exe
下面是可能遇到的编译问题以及对应的解决方法.
1.
编译错误talk\session\phone\devicemanager.cc(31) : fatal error C1083: Cannot open include file: 'atlbase.h': No such file or directory
解决方法:
1) 安装Platform SDK
下载位置: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a55b6b43-e24f-4ea3-a93e-40c0ec4f68e5
2) 添加c:\Program Files\Microsoft Platform SDK\Include\atl到INCLUDE环境变量中, 在编译Libjingle的同一DOS窗口中执行set INCLUDE=c:\Program Files\Microsoft Platform SDK\Include\atl;%INCLUDE%
Refer to:
http://code.google.com/p/libjingle/issues/detail?id=89
2.
编译错误
c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(91) : error C2220: warning treated as error - no 'object' file generated
c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(206) : error C2011: 'sockaddr' : 'struct' type redefinition
c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(437) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft sdks\windows\v6.0a\include\winsock2.h(132) : error C2011: 'fd_set' : 'struct' type redefinition
c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(68) : see declaration of 'fd_set'
c:\program files\microsoft sdks\windows\v6.0a\include\winsock2.h(176) : error C2011: 'timeval' : 'struct' type redefinition
c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(111) : see declaration of 'timeval'
......
解决办法:
在devicemanager.cc中#if WIN32宏开始的地方加入
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
在在devicemanager.cc中#if WIN32宏结束之前的地方加入
#include <mmsystem.h>
最后应该如下:
Refer to:
http://code.google.com/p/libjingle/issues/detail?id=89
http://social.msdn.microsoft.com/Forums/en/vclanguage/thread/671124df-c42b-48b8-a4ac-3413230bc43b
3.
Link错误
________Linking build\dbg\obj\call.exe
LINK : fatal error LNK1104: cannot open file 'atlthunk.lib'
解决办法:
找到atlbase.h, 注释掉#pragma comment(lib, "atlthunk.lib")
Refer to:
http://code.google.com/p/libjingle/issues/detail?id=89
1. 安装Python 2.4或者之后的版本. 因为swtoolkit只能工作在Python 2.x版本, 所以不能安装Python 3.x版本.
下载位置: http://www.python.org/
2. 安装scons-local 2.0.0或者之后的版本. 设置环境变量SCONS_DIR指向包含scons-local的目录, 如/src/libjingle/scons-local/scons-local-2.0.0.final.0/
注意SCONS_DIR指向的目录不是你下载的scons-local包直接解压缩后的目录 (这个目录包括scons.py, scons-README等文件), 而是里面包含的名为scons-local-x.x.x的子目录
下载位置: http://www.scons.org/download.php
3. 安装swtoolkit
下载位置: http://code.google.com/p/swtoolkit/
4. 下载expat包, 解压缩到talk/third_party/expat-2.0.1/
注意不要下载Win32安装包, 而应该是源代码包
下载位置: http://sourceforge.net/projects/expat/
5. 下载最新的srtp包, 解压缩到talk/third_party/srtp
注意不要使用srtp-1.4.4, 因为这个版本遗漏了Libjingle所使用的一些extensions
下载位置: http://sourceforge.net/projects/srtp/develop
为了省去你使用CVS下载最新srtp代码的麻烦, Libjingle已经上传了最新的srtp包, 下载位置: http://libjingle.googlecode.com/files/srtp-cvs.zip
如果你的expat和srtp包在其他位置或者名称不一样, 需要对应地修改talk/libjingle.scons
6. 进入到talk目录, 运行$path_to_swtoolkit/hammer.bat
将会进行编译, 最终将在talk/build/dbg/lib目录下生成:
expat.lib
libjingle.lib
libsrtp.lib
libxmpphelp.lib
在talk/build/dbg/staging目录下生成:
call.exe
login.exe
relayserver.exe
stunserver.exe
下面是可能遇到的编译问题以及对应的解决方法.
1.
编译错误talk\session\phone\devicemanager.cc(31) : fatal error C1083: Cannot open include file: 'atlbase.h': No such file or directory
解决方法:
1) 安装Platform SDK
下载位置: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a55b6b43-e24f-4ea3-a93e-40c0ec4f68e5
2) 添加c:\Program Files\Microsoft Platform SDK\Include\atl到INCLUDE环境变量中, 在编译Libjingle的同一DOS窗口中执行set INCLUDE=c:\Program Files\Microsoft Platform SDK\Include\atl;%INCLUDE%
Refer to:
http://code.google.com/p/libjingle/issues/detail?id=89
2.
编译错误
c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(91) : error C2220: warning treated as error - no 'object' file generated
c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(206) : error C2011: 'sockaddr' : 'struct' type redefinition
c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(437) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft sdks\windows\v6.0a\include\winsock2.h(132) : error C2011: 'fd_set' : 'struct' type redefinition
c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(68) : see declaration of 'fd_set'
c:\program files\microsoft sdks\windows\v6.0a\include\winsock2.h(176) : error C2011: 'timeval' : 'struct' type redefinition
c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(111) : see declaration of 'timeval'
......
解决办法:
在devicemanager.cc中#if WIN32宏开始的地方加入
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
在在devicemanager.cc中#if WIN32宏结束之前的地方加入
#include <mmsystem.h>
最后应该如下:
#if WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <atlbase.h>
#include <dbt.h>
#include <strmif.h> // must come before ks.h
#include <ks.h>
#include <ksmedia.h>
#define INITGUID // For PKEY_AudioEndpoint_GUID
#include <mmdeviceapi.h>
#include <functiondiscoverykeys_devpkey.h>
#include <uuids.h>
#include "talk/base/win32.h" // ToUtf8
#include "talk/base/win32window.h"
#include <mmsystem.h>
#elif OSX
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <atlbase.h>
#include <dbt.h>
#include <strmif.h> // must come before ks.h
#include <ks.h>
#include <ksmedia.h>
#define INITGUID // For PKEY_AudioEndpoint_GUID
#include <mmdeviceapi.h>
#include <functiondiscoverykeys_devpkey.h>
#include <uuids.h>
#include "talk/base/win32.h" // ToUtf8
#include "talk/base/win32window.h"
#include <mmsystem.h>
#elif OSX
Refer to:
http://code.google.com/p/libjingle/issues/detail?id=89
12. Added #include <mmsystem.h> to line 42 of talk\session\phone\devicemanager.cc (Just above the end of the windows tag)
http://social.msdn.microsoft.com/Forums/en/vclanguage/thread/671124df-c42b-48b8-a4ac-3413230bc43b
For historical reasons, the Windows.h header defaults to including the Winsock.h header file
for Windows Sockets 1.1. The declarations
in the Winsock.h header file will conflict with the declarations
in the Winsock2.h header file required by Windows Sockets 2.0. The WIN32_LEAN_AND_MEAN macro prevents the Winsock.h from being included by the Windows.h header.
So, please add:
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
Before "#include <windows.h>". This will tell the compiler to ignore all Winsock 1.1 definitions within windows.h.
So, please add:
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
Before "#include <windows.h>". This will tell the compiler to ignore all Winsock 1.1 definitions within windows.h.
3.
Link错误
________Linking build\dbg\obj\call.exe
LINK : fatal error LNK1104: cannot open file 'atlthunk.lib'
解决办法:
找到atlbase.h, 注释掉#pragma comment(lib, "atlthunk.lib")
Refer to:
http://code.google.com/p/libjingle/issues/detail?id=89
13. Found
out which version of atlbase.h the compiler was utilizing (In my
case, because of the PATH that I
set, the version I used was at c:\Program Files\Microsoft Platform SDK\Include\atl. Edit that file and comment
out the line #pragma comment(lib, "atlthunk.lib") which was on or around line 293.