error at building libjingle on Mac OS X 10.7.2 lik

2020-05-09 09:16发布

问题:

I failed to build libjingle on Mac OS X 10.7.2. The output was the following when I run $path_to_swtoolkit/hammer.sh according to the README of libjingle.

MBP17:talk rei25$ ~/Desktop/swtoolkit/hammer.sh
scons: Reading SConscript files ...

scons: warning: The build_dir keyword has been deprecated; use the variant_dir keyword instead.
File "/Users/rei25/Desktop/swtoolkit/site_scons/site_init.py", line 203, in BuildEnvironmentSConscripts
scons: done reading SConscript files.
scons: Building targets ...
________Compiling build/dbg/obj/third_party/expat-2.0.1/lib/xmlparse.o
third_party/expat-2.0.1/lib/xmlparse.c:6:48: error: string.h: No such file or directory
third_party/expat-2.0.1/lib/xmlparse.c:7:20: error: assert.h: No such file or directory
In file included from third_party/expat-2.0.1/lib/xmlparse.c:24:
third_party/expat-2.0.1/lib/expat.h:17:20: error: stdlib.h: No such file or directory
cc1: warnings being treated as errors
third_party/expat-2.0.1/lib/xmlparse.c: In function 'parserCreate':
third_party/expat-2.0.1/lib/xmlparse.c:719: warning: implicit declaration of function 'malloc'
third_party/expat-2.0.1/lib/xmlparse.c:719: warning: incompatible implicit declaration of built-in function 'malloc'
third_party/expat-2.0.1/lib/xmlparse.c:723: error: 'realloc' undeclared (first use in this function)
third_party/expat-2.0.1/lib/xmlparse.c:723: error: (Each undeclared identifier is reported only once
third_party/expat-2.0.1/lib/xmlparse.c:723: error: for each function it appears in.)
third_party/expat-2.0.1/lib/xmlparse.c:724: error: 'free' undeclared (first use in this function)
third_party/expat-2.0.1/lib/xmlparse.c: In function 'parserInit':
third_party/expat-2.0.1/lib/xmlparse.c:848: warning: implicit declaration of function 'memset'
third_party/expat-2.0.1/lib/xmlparse.c:848: warning: incompatible implicit declaration of built-in function 'memset'
third_party/expat-2.0.1/lib/xmlparse.c: In function 'XML_Parse':
third_party/expat-2.0.1/lib/xmlparse.c:1543: warning: implicit declaration of function 'memcpy'
third_party/expat-2.0.1/lib/xmlparse.c:1543: warning: incompatible implicit declaration of built-in function 'memcpy'
third_party/expat-2.0.1/lib/xmlparse.c: In function 'XML_GetBuffer':
third_party/expat-2.0.1/lib/xmlparse.c:1627: warning: implicit declaration of function 'memmove'
third_party/expat-2.0.1/lib/xmlparse.c:1627: warning: incompatible implicit declaration of built-in function 'memmove'
third_party/expat-2.0.1/lib/xmlparse.c:1656: warning: incompatible implicit declaration of built-in function 'memcpy'
third_party/expat-2.0.1/lib/xmlparse.c: In function 'XML_GetParsingStatus':
third_party/expat-2.0.1/lib/xmlparse.c:1750: warning: implicit declaration of function 'assert'
third_party/expat-2.0.1/lib/xmlparse.c: In function 'storeRawNames':
third_party/expat-2.0.1/lib/xmlparse.c:2009: warning: incompatible implicit declaration of built-in function 'memcpy'
third_party/expat-2.0.1/lib/xmlparse.c: In function 'doContent':
third_party/expat-2.0.1/lib/xmlparse.c:2424: warning: implicit declaration of function 'memcmp'
third_party/expat-2.0.1/lib/xmlparse.c: In function 'storeAtts':
third_party/expat-2.0.1/lib/xmlparse.c:2922: warning: incompatible implicit declaration of built-in function 'memcpy'
third_party/expat-2.0.1/lib/xmlparse.c:2931: warning: incompatible implicit declaration of built-in function 'memcpy'
third_party/expat-2.0.1/lib/xmlparse.c: In function 'addBinding':
third_party/expat-2.0.1/lib/xmlparse.c:3039: warning: incompatible implicit declaration of built-in function 'memcpy'
third_party/expat-2.0.1/lib/xmlparse.c: In function 'lookup':
third_party/expat-2.0.1/lib/xmlparse.c:5871: warning: incompatible implicit declaration of built-in function 'memset'
third_party/expat-2.0.1/lib/xmlparse.c:5898: warning: incompatible implicit declaration of built-in function 'memset'
third_party/expat-2.0.1/lib/xmlparse.c:5927: warning: incompatible implicit declaration of built-in function 'memset'
third_party/expat-2.0.1/lib/xmlparse.c: In function 'poolGrow':
third_party/expat-2.0.1/lib/xmlparse.c:6112: warning: incompatible implicit declaration of built-in function 'memcpy'
third_party/expat-2.0.1/lib/xmlparse.c:6148: warning: incompatible implicit declaration of built-in function 'memcpy'
scons: *** [build/dbg/obj/third_party/expat-2.0.1/lib/xmlparse.o] Error 1
scons: building terminated because of errors.

I'm sure about the existence of string.h, assert.h and so on in my Mac. I also tried cd to the directory expat-2.0.1 and run ./configure and make, and succeeded. I've searched the web for this problem and it seems nothing useful to me. So, if you know why, thank you for telling me!

P.S My problem seems to be like this one: http://groups.google.com/group/googletestframework/browse_thread/thread/e8ed5a3f410b7ec7/a8ba72e727801fc8?show_docid=a8ba72e727801fc8

回答1:

I had the same problem with lion. As wayon pointed out it's appears the developers hardcoded a particular SDK version "/Developer/SDKs/MacOSX10.5.sdk". As of the time of posting, the latest version is 10.7 which comes with Xcode 4. After fixing that there were a couple other issues with the build, I'm not sure if they're related to OS X or just a broken build script for lib jingle.

Here's the patch which fixes the other issues I found, libjingle patch. Also, you'll probably have to fix swtoolkit via stackoverflow swtoolkit fix.

I haven't checked if the unit tests pass, but at least it compiles now.



回答2:

I had the same issue.

In my case the issue was caused by the wrong CCFLAGS in the main.scons file in the directory 'talk' (top level of the source tree). There was a wrong path for '-isysroot' argument:

CCFLAGS = [ '-arch', 'i386', '-isysroot', '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk',

'-fasm-blocks', ],

There was not iPhoneSimulator4.0.sdk on my mac, only iPhoneSimulator4.3.sdk and iPhoneSimulator5.0.sdk.

So, I just replaced 4.0 to 5.0 and got the following:

CCFLAGS = [ '-arch', 'i386', '-isysroot', '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk', '-fasm-blocks', ],

It helped to me.

To resolve the issue try the following:

  1. Check what version of sdk you've got in the folder /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
  2. Set an appropriate path for -isysroot argument in the main.scons file at the top of source tree (in my case it's ilibjingle/gtalk/libjingle-0.5/talk):

Then try to run $path_to_swtoolkit/hammer.sh again.

I hope it will help you.



回答3:

Try to add the following include to your main.scons file:

main.scons:

... // more than 300 lines and the you will find the mac_env section

mac_env.Append(
  CPPDEFINES = [
    'OSX',
  ],
  CCFLAGS = [
    '-m32',
    '-arch', 'i386',
    '-isysroot', '/Developer/SDKs/MacOSX10.5.sdk',
    '-fasm-blocks',
    '-I/usr/include', <--- Add this line and this will tell to scons where is your includes
...