构建Android源时出错

时间:2012-04-18 04:49:30

标签: android android-ndk

在Mac OS X 10.7.3(Lion)上构建android源代码时出现以下错误:

host SharedLib: libSR_Recognizer (out/host/darwin-x86/obj/lib/libSR_Recognizer.dylib)
Undefined symbols for architecture i386:
  "_pushAudioIntoRecognizer", referenced from:
      _SR_RecognizerAdvanceImpl in RecognizerImpl.o
      _detectBeginningOfSpeech in RecognizerImpl.o
  "_generatePatternFromFrame", referenced from:
      _SR_RecognizerAdvanceImpl in RecognizerImpl.o
  "_canPushAudioIntoRecognizer", referenced from:
      _SR_RecognizerAdvanceImpl in RecognizerImpl.o
      _detectBeginningOfSpeech in RecognizerImpl.o
  "_generatePatternFromFrameEOI", referenced from:
      _SR_RecognizerAdvanceImpl in RecognizerImpl.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [out/host/darwin-x86/obj/lib/libSR_Recognizer.dylib] Error 1

任何线索?

6 个答案:

答案 0 :(得分:3)

解决此错误的最佳方法是执行以下操作:

  1. 安装gcc-4.2和g ++ - 4.2:brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
  2. 设置CCCXX环境变量:export CC=/usr/local/bin/gcc-4.2 && export CXX=/usr/local/bin/g++-4.2
  3. 然后构建:make
  4. 如果您需要为#1安装自制软件,请转到:Homebrew homepage

答案 1 :(得分:3)

我以这种方式修复,我的编译器看起来很满意。

vi ./external/srec/srec/Recognizer/src/RecognizerImpl.c

将所有PINLINE替换为/*** PINLINE ***/ - 实际上删除所有{/ p>

答案 2 :(得分:1)

我终于找到了答案:)

使用以下选项运行make

make CC=gcc CXX=g++ -j4

一切都会顺利

答案 3 :(得分:1)

唯一正确的解决方案是安装XCode 3。*

答案 4 :(得分:0)

以下是来自Android master stram的修复 - external / srec / portable / include / PortExport.h

  #if defined(__APPLE_CC__)
  #if __APPLE_CC__ >= 5621
  #undef PINLINE
  #define PINLINE
  #endif
  #endif

答案 5 :(得分:0)

不幸的是,这是AOSP中的一个已知问题(访问http://source.android.com/source/known-issues.html)。 安装brew包。

您应该使用

创建自定义构建
lunch full-eng

而不是

lunch full-userdebug

我在Android-4.1.2_r1上找不到问题