zf8848 / libjingle

Automatically exported from code.google.com/p/libjingle
0 stars 0 forks source link

How to build libjingle for iphone iPhone OS platform and iPhone Simulator platform ? #111

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
How to build libjingle for iphone iPhone OS platform and iPhone Simulator 
platform ?

because  the iPhone  SDK is limited ,so many api that is not aviable in iphone 
sdk, so porting to iphone platform is not so easy. I think there are 3 methods 
to port libjingle into iphone platform.

1.Use posix platform  instead of  mac pkatform (eg:mac_src => posix_src).

2.Another way is to Comment out the code that  isn't be supported in iphone SDK.

3.The 3th method is best , redefined the functions for iphone platform.

 ciwavinc selected the 2th way to port ,the project  is http://code.google.com/p/ilibjingle/
but i think it's not  good for iphone.so If somebody can give me some suggest? 

Original issue reported on code.google.com by gtalktes...@gmail.com on 30 Dec 2010 at 7:54

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

一.environment setting:
---------------------------------------------------------------------------
<1> First, install Python 2.4 or later from http://www.python.org/

<2> Second ,install the stand alone scons-local package 2.0.0 or later from
    http://www.scons.org/download.php and set an environment variable,
    SCONS_DIR, to point to the directory containing SCons:

for example:
$vim /User/gray/.profile

Enter the following content:

#set env of SCONS_DIR
export 
SCONS_DIR=/Users/anson/Documents/work/scons-local-2.0.1/scons-local-2.0.1/

$sourece /User/gray/.profile

<3> Third, install swtoolkit from http://code.google.com/p/swtoolkit/.
We just download it into a place(eg:/User/gray/..../swtoolkit), It's  a green 
tool.

<4>Finally, Libjingle depends on 3 open-source projects, expat , srtp and 
openssl.

Download expat from http://sourceforge.net/projects/expat/ to
    talk/third_party/expat-2.0.1/. 
Download srtp from http://libjingle.googlecode.com/files/srtp-cvs.zip to
    talk/third_party/srtp/. 
note:Don't download srtp from it's official website.only one google version can 
work for libjingle  

Download openssl source code to
    talk/third_party/openssl-1.0.0.

二. Modify Build Parameters 
---------------------------------------------------------------------------
1.Modify  main.scons

 [iphone Simulator]:

(1) Change
    '-isysroot', '/Developer/SDKs/MacOSX10.5.sdk',
to  
    '-isysroot', '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk',

(2)Add the following content into # M A C OSX Block

mac_env.Replace(CC = 
'/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2')
mac_env.Replace(CXX = 
'/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2')

(3)Add 'CoreAudio', 'QuickTime', 'Cocoa', and 'QTKit' to the FRAMEWORKS 
variable.

 [iphone Device]:

(1) Change
    '-isysroot', '/Developer/SDKs/MacOSX10.5.sdk',
to  
    '-isysroot', '/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk',

(2)Add the following content into # M A C OSX Block

mac_env.Replace(CC='/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
-4.2')
mac_env.Replace(CXX='/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g+
+-4.2')

(3)Add 'CoreAudio', 'QuickTime', 'Cocoa', and 'QTKit' to the FRAMEWORKS 
variable.

(4)Change ['-arch','i386'] to  ['-arch', 'armv6'] in mac env setting,

2.Modify libjingle.scons
(1)Comment out some files with "#",because IOS SDK is limited ,So some api is 
unsupport by IOS:

#       "base/macutils.cc",
#               "session/phone/devicemanager_mac.mm",
#               "base/proxydetect.cc",

(2)Add some Header serach directory in includedirs.
like:
        "third_party/openssl-1.0.0/include",

三.Building libjingle:
---------------------------------------------------------------------------
》》》How to build libjingle for iphone Simulator
1. 
$ cd libjingle-0.5/talk/third_party/srtp
$ ./configure
2.
$ cd libjingle-0.5/talk/third_party/expat-2.0.1 
$ ./configure
3. 
$ cd libjingle-0.5/talk/third_party/openssl-1.0.0 
$ ./config no-shared no-asm 
4. 
Build or Download openssl lib(libcrypto.a,libssl.a) for iphonesimulator to 
talk/build/dbg/lib

5.$/User/gray/..../swtoolkit/hammer.sh  

》》》How to build libjingle for iphone
1.
 $cd libjingle-0.5/talk/third_party/srtp 
 $./configure --host=arm CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2
2. 
 $cd libjingle-0.5/talk/third_party/expat-2.0.1
 $./configure --host=arm CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2
3.
 $cd libjingle-0.5/talk/third_party/openssl-1.0.0
 $./config no-shared no-asm 
4. 
Build or Download openssl lib(libcrypto.a,libssl.a) for iphone device to 
talk/build/dbg/lib

5.$/User/gray/..../swtoolkit/hammer.sh  

四.Modify libjingle source code
---------------------------------------------------------------------------
Refrence : http://code.google.com/p/ilibjingle/

五.XCode setting
U can refrence  http://code.google.com/p/ilibjingle/

1.Add libjingle.a path in Library Search Paths
2.Add some Header path(eg: .../libjingle/) in Header Search Paths

3.GCC_PREPROCESSOR_DEFINITIONS:

POSIX xOSX_USE_COCOA HAMMER_TIME=1 LOGGING=1 FEATURE_ENABLE_SSL 
FEATURE_ENABLE_VOICEMAIL FEATURE_ENABLE_PSTN HASHNAMESPACE=__gnu_cxx 
DISABLE_DYNAMIC_CAST HAVE_OPENSSL_SSL_H=1 OS_MACOSX=OS_MACOSX OSX _DEBUG 
FLAVOR_DBG ENABLE_DEBUG FEATURE_ENABLE_VOICEMAIL EXPAT_RELATIVE_PATH 
SRTP_RELATIVE_PATH XML_STATIC HAVE_EXPAT_CONFIG_H 
MAC_OS_X_VERSION_MIN_REQUIRED=1040

Original comment by guohui.g...@gmail.com on 26 Jan 2011 at 3:33

GoogleCodeExporter commented 9 years ago

Original comment by jun...@google.com on 29 Jun 2011 at 10:09

GoogleCodeExporter commented 9 years ago
Undefined symbols:
"_ENGINE_load_gost", referenced from:
_ENGINE_load_builtin_engines in libcrypto.a(eng_all.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status

if under snow leopard , please follow the below instead 

三.Building libjingle:
---------------------------------------------------------------------------
》》》How to build libjingle for iphone Simulator
1. 
$ cd libjingle-0.5/talk/third_party/srtp
$ ./configure
2.
$ cd libjingle-0.5/talk/third_party/expat-2.0.1 
$ ./configure
3. 
$ cd libjingle-0.5/talk/third_party/openssl-1.0.0 
$ ./Configure darwin64-x86_64-cc zlib no-asm no-krb5 shared
4. 
Build or Download openssl lib(libcrypto.a,libssl.a) for iphonesimulator to 
talk/build/dbg/lib

Original comment by *sallyf...@igpsd.com on 14 Jul 2011 at 9:09

GoogleCodeExporter commented 9 years ago
I've followed the directions outlined by quohui, and am getting errors 
throughout the build process. 

1. 
$ cd libjingle-0.5/talk/third_party/srtp
$ ./configure

checking size of unsigned long... configure: error: cannot compute sizeof 
(unsigned long), 77

<ignored the compute sizeof error>

Several problems with the hammer build:

5.$/User/gray/..../swtoolkit/hammer.sh

________Compiling build/dbg/obj/session/phone/devicemanager.o
cc1plus: warnings being treated as errors
session/phone/devicemanager.cc:833: warning: 'bool 
cricket::ShouldDeviceBeIgnored(const std::string&)' defined but not used
scons: *** [build/dbg/obj/session/phone/devicemanager.o] Error 1
scons: building terminated because of errors.

<fixed by commenting out ShouldDeviceBeIgnored>

________Compiling build/dbg/obj/base/unixfilesystem.o
In file included from base/unixfilesystem.cc:39:
/Users/mitchellru/ilibjingle/ilibjingle/gtalk/libjingle-0.5/talk/base/macutils.h
:43: error: 'EventRef' was not declared in this scope

<fixed by commenting out the definition of the routine that used the EventRef 
type>

________Compiling build/dbg/obj/base/unixfilesystem.o
base/unixfilesystem.cc: In member function 'virtual bool 
talk_base::UnixFilesystem::GetTemporaryFolder(talk_base::Pathname&, bool, const 
std::string*)':
base/unixfilesystem.cc:174: error: aggregate 'FSRef fr' has incomplete type and 
cannot be defined

<several of these errors, that were fixed by commenting out>

ld: unknown option: 
-rpath=/Users/mitchellru/ilibjingle/ilibjingle/gtalk/libjingle-0.5/talk/build/db
g/lib
collect2: ld returned 1 exit status
scons: *** [build/dbg/obj/login] Error 1
scons: building terminated because of errors.

<ignored the rpath error, ilibjingle.a was created>

xcode, 113 of these types of errors, related to missing openssl symbols:

  "_BIO_clear_flags", referenced from:
      socket_write(bio_st*, char const*, int) in openssladapter.o
      socket_read(bio_st*, char*, int) in openssladapter.o
      talk_base::stream_write(bio_st*, char const*, int) in opensslstreamadapter.o
      talk_base::stream_read(bio_st*, char*, int) in opensslstreamadapter.o

Original comment by 7nahnqw9...@gmail.com on 22 Feb 2012 at 5:17

GoogleCodeExporter commented 9 years ago
I think the problem is this, note that I used "./config no-shared no-asm" to 
build openssl

ld: warning: ignoring file 
/Users/mitchellru/ilibjingle/ilibjingle/gtalk/libjingle-0.5/talk/third_party/ope
nssl-1.0.0/libcrypto.1.0.0.dylib, file was built for unsupported file format 
which is not the architecture being linked (armv6)
ld: warning: ignoring file 
/Users/mitchellru/ilibjingle/ilibjingle/gtalk/libjingle-0.5/talk/third_party/ope
nssl-1.0.0/libssl.1.0.0.dylib, file was built for unsupported file format which 
is not the architecture being linked (armv6)

Original comment by 7nahnqw9...@gmail.com on 22 Feb 2012 at 6:00

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/libjingle/issues/detail?id=288#c5

Original comment by guohui.g...@gmail.com on 5 Jul 2012 at 6:26

GoogleCodeExporter commented 9 years ago
how i will integrate libjingle to my existing xmpp IPhone project to enhance 
the performance for audio chatting ?

Original comment by saroj.ip...@gmail.com on 30 Jul 2012 at 12:35