ilibjingle 编译 for iphoneSimulator

本文介绍了如何在 Xcode 中正确配置编译器路径、SDK 路径及编译选项,解决因路径配置错误导致的编译失败问题。同时提供了针对特定编译错误的解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://i-blog.csdnimg.cn/blog_migrate/0f2e942a0929bb7f0bbefc1c0009a6ce.png




******

修改main.soncs

[html]  view plain copy print ?
  1. mac_env.Replace(CC = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/i686-apple-darwin10-llvm-g++-4.2')    
  2. # Use my-gcc instead of the default compiler.  
  3. mac_env.Replace(CXX = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/i686-apple-darwin10-llvm-gcc-4.2')    
  4. # Use my-gcc instead of the default compiler.  

**

[html]  view plain copy print ?
  1. mac_env.Replace(CC = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2')    
  2. # Use my-gcc instead of the default compiler.  
  3. mac_env.Replace(CXX = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2')    
  4. # Use my-gcc instead of the default compiler.  

**

[html]  view plain copy print ?
  1. mac_env.Replace(CC = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2')    
  2. # Use my-gcc instead of the default compiler.  
  3. mac_env.Replace(CXX = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-g++-4.2')    
  4. # Use my-gcc instead of the default compiler.  

**

[html]  view plain copy print ?
  1. mac_env.Replace(CC = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2')    
  2. # Use my-gcc instead of the default compiler.  
  3. mac_env.Replace(CXX = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-g++-4.2')    
  4. # Use my-gcc instead of the default compiler.  


**

*************

修改main.scons的sdk

注意,这里是

[html]  view plain copy print ?
  1. '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk',  
而不是

[html]  view plain copy print ?
  1. <del>/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk</del>  
否则会出现以下错误:

[html]  view plain copy print ?
  1. ________Compiling build/dbg/obj/third_party/expat-2.0.1/lib/xmlparse.o  
  2. In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/sys/_types.h:33,  
  3.                  from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/_types.h:27,  
  4.                  from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/string.h:61,  
  5.                  from third_party/expat-2.0.1/lib/xmlparse.c:6:  
  6. /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/machine/_types.h:32:25: error: i386/_types.h: No such file or directory  
  7. In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/_types.h:27,  
  8.                  from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/string.h:61,  
  9.                  from third_party/expat-2.0.1/lib/xmlparse.c:6:  
***************

下面的问题或许会用得到

********

Q: change C language dialect to GNU89 to get rid of asm and inline issues

Xcode 4.2 had finally added support for C++0X:

  1. In the project build settings screen, switch on "All" options.

  2. In the "Build Options" section, set compiler to "Apple LLVM compiler 3.0".

  3. Scroll down to "Apple LLVM Compiler 3.0 - Language" section and set "C++ Language Dialect" to "C++0X" and "C++ Standard Library" to "libc++".

The std::move(), move constructor and R-Value reference are known to work as expected, and I'm testing on the std::thread and std::atomic.

************

Error:  

[html]  view plain copy print ?
  1. asm("bswap %0" : "=r" (v) : "0" (v));   

implicit declaration of function asm is invalid in c99

fix: 修改c dialect 为 GUN89



*********

Error

[html]  view plain copy print ?
  1. ld: warning: directory not found for option '-L/ilibjingle/gtalk/libjingle-0.5/talk/build/dbg/lib /ilibjingle/gtalk/libjingle-0.5/talk/third_party/openssl-1.0.0 /ilibjingle/gtalk/libjingle-0.5/talk/third_party/openssl-1.0.0/lib'  
  2. ld: library not found for -lcrypto-iphone  
  3. clang: error: linker command failed with exit code 1 (use -v to see invocation)  

Fix:

build setting -> basic -> 搜索对应的目录关键字,将之改为正确的路径,这样子可以修复上面的warning。



****



******

修改main.soncs

[html]  view plain copy print ?
  1. mac_env.Replace(CC = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/i686-apple-darwin10-llvm-g++-4.2')    
  2. # Use my-gcc instead of the default compiler.  
  3. mac_env.Replace(CXX = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/i686-apple-darwin10-llvm-gcc-4.2')    
  4. # Use my-gcc instead of the default compiler.  

**

[html]  view plain copy print ?
  1. mac_env.Replace(CC = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2')    
  2. # Use my-gcc instead of the default compiler.  
  3. mac_env.Replace(CXX = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2')    
  4. # Use my-gcc instead of the default compiler.  

**

[html]  view plain copy print ?
  1. mac_env.Replace(CC = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2')    
  2. # Use my-gcc instead of the default compiler.  
  3. mac_env.Replace(CXX = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-g++-4.2')    
  4. # Use my-gcc instead of the default compiler.  

**

[html]  view plain copy print ?
  1. mac_env.Replace(CC = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2')    
  2. # Use my-gcc instead of the default compiler.  
  3. mac_env.Replace(CXX = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-g++-4.2')    
  4. # Use my-gcc instead of the default compiler.  


**

*************

修改main.scons的sdk

注意,这里是

[html]  view plain copy print ?
  1. '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk',  
而不是

[html]  view plain copy print ?
  1. <del>/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk</del>  
否则会出现以下错误:

[html]  view plain copy print ?
  1. ________Compiling build/dbg/obj/third_party/expat-2.0.1/lib/xmlparse.o  
  2. In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/sys/_types.h:33,  
  3.                  from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/_types.h:27,  
  4.                  from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/string.h:61,  
  5.                  from third_party/expat-2.0.1/lib/xmlparse.c:6:  
  6. /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/machine/_types.h:32:25: error: i386/_types.h: No such file or directory  
  7. In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/_types.h:27,  
  8.                  from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/string.h:61,  
  9.                  from third_party/expat-2.0.1/lib/xmlparse.c:6:  
***************

下面的问题或许会用得到

********

Q: change C language dialect to GNU89 to get rid of asm and inline issues

Xcode 4.2 had finally added support for C++0X:

  1. In the project build settings screen, switch on "All" options.

  2. In the "Build Options" section, set compiler to "Apple LLVM compiler 3.0".

  3. Scroll down to "Apple LLVM Compiler 3.0 - Language" section and set "C++ Language Dialect" to "C++0X" and "C++ Standard Library" to "libc++".

The std::move(), move constructor and R-Value reference are known to work as expected, and I'm testing on the std::thread and std::atomic.

************

Error:  

[html]  view plain copy print ?
  1. asm("bswap %0" : "=r" (v) : "0" (v));   

implicit declaration of function asm is invalid in c99

fix: 修改c dialect 为 GUN89



*********

Error

[html]  view plain copy print ?
  1. ld: warning: directory not found for option '-L/ilibjingle/gtalk/libjingle-0.5/talk/build/dbg/lib /ilibjingle/gtalk/libjingle-0.5/talk/third_party/openssl-1.0.0 /ilibjingle/gtalk/libjingle-0.5/talk/third_party/openssl-1.0.0/lib'  
  2. ld: library not found for -lcrypto-iphone  
  3. clang: error: linker command failed with exit code 1 (use -v to see invocation)  

Fix:

build setting -> basic -> 搜索对应的目录关键字,将之改为正确的路径,这样子可以修复上面的warning。



****


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值