当前位置: 首页 > article >正文

iOS开发笔记之五——Xcode 6.0 Beta编译工程时可能遇到的问题及参考解决方案

由于开发需要,最近需要将Xcode 由5.0升级到6.0 beta版,将MAC升级到10.9.4版本后。利用Xcode 6.0编译我们的项目工程,

发现错误累累,经过一步步摸索,问题最终一一解决;现在将问题记录下来,以供参考。

(1)"_fwrite$UNIX2003"报错问题;

Undefined symbols for architecture i386:
  "_fwrite$UNIX2003", referenced from:
      _voAWB_dtx_enc_reset in libvo-amrwbenc.a(dtx.o)
      _voAWB_dtx_enc_init in libvo-amrwbenc.a(dtx.o)
      _wb_vad_reset in libvo-amrwbenc.a(wb_vad.o)
      _wb_vad_init in libvo-amrwbenc.a(wb_vad.o)
      _quant_5p_5N in libvo-amrwbenc.a(q_pulse.o)
      _quant_4p_4N in libvo-amrwbenc.a(q_pulse.o)
      _quant_6p_6N_2 in libvo-amrwbenc.a(q_pulse.o)
      ...
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

对照错误来看,这是一个库链接的错误。

参考解决方案:工程内新增文件 fileadp.c  内容如下 :

    #include <stdio.h>

    FILE *fopen$UNIX2003( const char *filename, const char *mode )

    {
        return fopen(filename, mode); 
    }

    size_t fwrite$UNIX2003( const void *a, size_t b, size_t c, FILE *d )

    {
        return fwrite(a, b, c, d); 
    }

stackOverflow上有解释如下:

The UNIX™ conformance variants use the $UNIX2003 suffix.

Important: The work for UNIX™ conformance started in Mac OS 10.4, but was not completed until 10.5. Thus, in the 10.4 versions of libSystem.dylib, many of the conforming variant symbols (with the $UNIX2003 suffix) exist. The list is not complete, and the conforming behavior of the variant symbols may not be complete, so they should be avoided.

Because the 64-bit environment has no legacy to maintain, it was created to be UNIX™ conforming from the start, without the use of the $UNIX2003 suffix. So, for example, _fputs$UNIX2003 in 32-bit and _fputs in 64-bit will have the same conforming behavior.

看样子是64位上遗留的符号命名问题。

(2)在我们的工程项目有专业版和企业版之分,在编译企业版时,可能还会出现如下报错:

Undefined symbols for architecture i386:
  "std::istream::gcount() const", referenced from:
      sq::InSmallFile::readBuf(void*, int) in libTF.a(IOFile.o)
  "std::string::find_last_of(char, unsigned long) const", referenced from:
      getFileNameFromPath(std::string) in libTF.a(FileSrvClient.o)
  "std::string::data() const", referenced from:
      sqnet::StringPiece::StringPiece(std::string const&) in libTF.a(TcpConnection.o)
      Result(boost::shared_ptr<TranFilePara_>&) in libTF.a(sqfilesrvlib.o)
      sqnet::StringPiece::StringPiece(std::string const&) in libTF.a(_auto_filesrv_msg.o)
      sqnet::StringPiece::StringPiece(std::string const&) in libTF.a(FileSrvClient.o)
      sqnet::StringPiece::StringPiece(std::string const&) in libTF.a(FileSrvMsgCodec.o)
      sq::InSmallFile::InSmallFile(std::string) in libTF.a(IOFile.o)
      sq::OutSmallFile::OutSmallFile(std::string) in libTF.a(IOFile.o)
      ...
  "std::string::find(char const*, unsigned long) const", referenced from:
      zxing::aztec::Decoder::getEncodedData(zxing::Ref<zxing::BitArray>) in libTF.a(Decoder-387E8B3BE4AFD07D.o)
  "std::string::size() const", referenced from:
      sqnet::LogStream::operator<<(boost::thread::id const&) in libTF.a(LogStream.o)
      sqnet::LogStream::operator<<(std::string const&) in libTF.a(EventLoop.o)
      sqnet::LogStream::operator<<(std::string const&) in libTF.a(TcpClient.o)
      sqnet::LogStream::operator<<(std::string const&) in libTF.a(TcpConnection.o)
      sqnet::StringPiece::StringPiece(std::string const&) in libTF.a(TcpConnection.o)
      FileSrvDownLoadRsp::lenByProtocal() const in libTF.a(_auto_filesrv_msg.o)
      sqnet::StringPiece::StringPiece(std::string const&) in libTF.a(_auto_filesrv_msg.o)
      ...
  "std::string::c_str() const", referenced from:
      boost::system::system_error::what() const in libTF.a(SQNetChannel.o)
      boost::system::system_error::what() const in libTF.a(ChannelClient.o)
      boost::system::system_error::what() const in libTF.a(ChannelClientWrapper.o)
      boost::system::system_error::what() const in libTF.a(thread-CEABBE7F4161525B.o)
      boost::system::system_error::what() const in libTF.a(mutex.o)
      boost::system::system_error::what() const in libTF.a(CurrentThread.o)
      boost::system::system_error::what() const in libTF.a(Condition.o)
      ...
  "std::string::empty() const", referenced from:
      boost::system::system_error::what() const in libTF.a(SQNetChannel.o)
      boost::system::system_error::what() const in libTF.a(ChannelClient.o)
      boost::system::system_error::what() const in libTF.a(ChannelClientWrapper.o)
      boost::system::system_error::what() const in libTF.a(thread-CEABBE7F4161525B.o)
      boost::system::system_error::what() const in libTF.a(mutex.o)
      boost::system::system_error::what() const in libTF.a(CurrentThread.o)
      boost::system::system_error::what() const in libTF.a(Condition.o)
      ...
  "std::string::length() const", referenced from:
      FileSrvDownLoadRsp::serialize2Buf(sqnet::Buffer*) const in libTF.a(_auto_filesrv_msg.o)
      FileSrvDownLoadReq::serialize2Buf(sqnet::Buffer*) const in libTF.a(_auto_filesrv_msg.o)
      FileSrvRecvBlkRsp::serialize2Buf(sqnet::Buffer*) const in libTF.a(_auto_filesrv_msg.o)
      FileSrvTranFileCompleteRsp::serialize2Buf(sqnet::Buffer*) const in libTF.a(_auto_filesrv_msg.o)
      FileSrvSendBlkRsp::serialize2Buf(sqnet::Buffer*) const in libTF.a(_auto_filesrv_msg.o)
      FileSrvUpLoadRsp::serialize2Buf(sqnet::Buffer*) const in libTF.a(_auto_filesrv_msg.o)
      FileSrvUpLoadReq::serialize2Buf(sqnet::Buffer*) const in libTF.a(_auto_filesrv_msg.o)
      ...
  "std::string::substr(unsigned long, unsigned long) const", referenced from:
      getFileNameFromPath(std::string) in libTF.a(FileSrvClient.o)
  "std::string::compare(char const*) const", referenced from:
      CSpeedComm::CheckHttpHeader(char const*) in libMTIA.a(SpeedComm.o)
      CSpeedDecoder::DecodeQuoteUpdateData(CDecodeCode&) in libMTIA.a(SpeedDecoder.o)
      CSpeedDecoder::DecodeQuoteUpdateDataNew(CDecodeCode&) in libMTIA.a(SpeedDecoder.o)
      CSpeedDecoder::DecodeFormalizedTrend(CDecodeCode&) in libMTIA.a(SpeedDecoder.o)
      CSpeedDecoder::DecodeFormalizedDeal(CDecodeCode&) in libMTIA.a(SpeedDecoder.o)
      CSpeedDecoder::DecodeDayKLineData(CDecodeCode&) in libMTIA.a(SpeedDecoder.o)
      CSpeedDecoder::DecodeMinuteKlineData(CDecodeCode&) in libMTIA.a(SpeedDecoder.o)
      ...
  "std::string::compare(std::string const&) const", referenced from:
...下面省略...

根据信息来看,编译已经通过,但是在链接时出错,我们需要手动更改我们本地的链接设置。有以下两个方法

第一、Build Settings-->Apple LLVM 5.1 - Language - C++ --> C++ Standard Library,设置为:libstdc++(GNU C++ standard library)


然后Clean工程,然后重新Build,看是否可以成功。

第二、如果上述设置仍旧不能解决你的问题,你还可以尝试Build Phases --> Link Binary With Libraries里面增加库:libstdc++.dylib

备注:上述错误,也可能是由我们自带的SDK导致,具体到其他SDK可能还会有其他的错误。

(3)参考资料:

http://blog.ready4go.com/blog/2014/06/06/xcode6-beta-build-fix/

http://stackoverflow.com/questions/8732393/code-coverage-with-xcode-4-2-missing-files

http://www.lryc.cn/news/2415596.html

相关文章:

  • A 驾驶员辅助系统开发的基础2
  • LCD液晶显示屏工作原理
  • 冯·诺伊曼结构(英語:),也称馮·紐曼模型(Von Neumann model),是一种将程序指令存储器和数据存储器合并在一起的電腦設計概念结构。
  • Adobe Dreamweaver所有版本的序列号
  • 机架服务器 远程电源管理 备忘
  • 史上最详细SharePoint 2010安装步骤图解新手教程
  • Android 学习指南
  • Windows Media Player Real Player ActiveX 属性及方法
  • Computer Graphics From Scratch - Chapter 5
  • 新的UnityAnswers社区站点
  • 13个免费资源网站,你想要的全都有!【各类宝藏资源,建议收藏】
  • wordpress友联_一段代码开启WordPress友情链接管理
  • TM2008 Preview体验
  • 初学者一定要看!Perl 语言入门学习
  • web服务IIS服务器搭建
  • 度量空间
  • Eclipse 3.4+MyEclipse 6.01+MyEclipse 6.5+MyEclipse 6.01注册机+Eclipse汉化包官方下载地址
  • Python之Pandas中Series、DataFrame实践
  • OpenCV学习笔记(二):读取mnist数据集
  • 个人DIY一套全智能机器人基本流程
  • kindeditor在php中的使用,PHP中使用kindeditor
  • 微信小程序实现简单的树形选择控件------treeSelect
  • 干啥啥不行,摸鱼第一名
  • Dell BIOS/CMOS设置诠释
  • 干货分享新华三、华为、思科认证,到底选择哪一个?
  • 程序员常见系统错误代码大全:1到15841
  • echarts中国旅客迁徙地图
  • 使用virtualbox虚拟安装macos
  • 飞刀篮球搜众神推球,Linux 误删文件恢复命令及方法
  • 同步推上传破解ipa方法