在Mac OS X 10.7.2上构建libjingle时的错误,例如“error:string.h:没有这样的文件或目录”

时间:2011-11-07 12:35:17

标签: macos swt scons libjingle expat-parser

我无法在Mac OS X 10.7.2上构建libjingle。根据libjingle的自述文件运行$path_to_swtoolkit/hammer.sh时输出如下。

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.

我确信我的Mac中存在string.hassert.h等等。 我还尝试cd到目录expat-2.0.1并运行./configuremake,然后成功了。 我在网上搜索了这个问题,对我来说似乎没什么用。所以,如果你知道为什么,谢谢你告诉我!

P.S我的问题似乎就是这个问题:http://groups.google.com/group/googletestframework/browse_thread/thread/e8ed5a3f410b7ec7/a8ba72e727801fc8?show_docid=a8ba72e727801fc8

3 个答案:

答案 0 :(得分:5)

我和狮子有同样的问题。正如Wayon指出的那样,开发人员似乎硬编码了特定的SDK版本“/Developer/SDKs/MacOSX10.5.sdk”。截至发布时,最新版本是10.7,它附带Xcode 4.修复后,还有一些其他问题与构建,我不确定它们是否与OS X或仅仅是一个破坏的构建脚本有关对于lib jingle。

这是修复我发现的其他问题的补丁libjingle patch。 此外,您可能必须通过stackoverflow swtoolkit fix修复swtoolkit。

我没有检查单元测试是否通过,但至少它现在编译。

答案 1 :(得分:2)

我遇到了同样的问题。

在我的情况下,问题是由'talk'目录(源树的顶层)中的main.scons文件中的错误CCFLAGS引起的。 “-isysroot”论证有一条错误的路径:

CCFLAGS = [     '-arch','i386',     '-isysroot','/开发者/平台/ iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk',

' - FASM块',   ],

我的mac上没有iPhoneSimulator4.0.sdk,只有iPhoneSimulator4.3.sdk和iPhoneSimulator5.0.sdk。

所以,我刚刚将4.0替换为5.0并得到以下内容:

CCFLAGS = [     '-arch','i386',     '-isysroot','/开发者/平台/ iPhoneSimulator.platform/Developer/SDKs/ iPhoneSimulator5.0.sdk ',     “-fasm块”,   ],

这对我很有帮助。

要解决此问题,请尝试以下操作:

  1. 检查文件夹/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
  2. 中您的sdk版本
  3. 在源树顶部的main.scons文件中设置-isysroot参数的适当路径(在我的例子中是ilibjingle / gtalk / libjingle-0.5 / talk):
  4. 然后再次尝试运行$ path_to_swtoolkit / hammer.sh。

    我希望它会对你有所帮助。

答案 2 :(得分:2)

尝试将以下include添加到main.scons文件中:

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
...