从过去xCode 4中的某个点开始抱怨链接器问题:
ld:warning:为MacOSX构建,但是针对为iOS构建的dylib链接:/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks//CoreGraphics.framework/CoreGraphics
我已经检查了所有内容,但在配置中仍然没有任何可疑,它编译并运行.我看到它唯一的东西是CoreGraphics.framework之前的双斜线,为什么我不知道.尝试删除并在"构建阶段"上再次添加库,但没有帮助.
LAME(http://lame.sourceforge.net/)是一个用c语言编写的库.它可以将PCM声音文件转换为MP3文件.我用它将声音文件转换为iPhone上的MP3文件.源PCM声音文件由麦克风录制.
为了将LAME包含到我的XCode项目中,我需要将LAME编译为3个静态库(.a),i386(IOS模拟器),armv6和armv7.
经过大量搜索,我成功地为i368版本(iOS模拟器)编写了一个静态库.这是命令:
./configure \
CFLAGS="-isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk" \
CC="/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386" \
--prefix=/Volumes/Data/test/i386 \
--host="arm-apple-darwin9"
make && make install
Run Code Online (Sandbox Code Playgroud)
问题是我无法编译armv6和armv7.我试过这个命令,但报告错误.有人有解决方案吗?
./configure \
CFLAGS="-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk" \
CC="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv6" \
--prefix=/Volumes/Data/test/arm6 \
--host="arm-apple-darwin9"
make && make install
Run Code Online (Sandbox Code Playgroud)
错误是:
console.c:25:21: error: curses.h: No such file or directory
console.c:27:20: error: term.h: No such file or directory
console.c: In function ‘get_termcap_string’:
console.c:92: warning: implicit declaration of function ‘tgetstr’
console.c:92: warning: assignment makes pointer from integer without a cast
console.c: In function ‘get_termcap_number’:
console.c:102: warning: …Run Code Online (Sandbox Code Playgroud) 我很好奇如果我在Mac应用程序中链接到iOS模拟器框架会发生什么.所以我将UIKit复制到它自己的文件夹(因此框架搜索路径不会包含所有iOS模拟器框架,就像CoreFoundation在Mac和iOS上都有不同的标题),并将其拖入Xcode的链接部分.Xcode给我的错误是:
为MacOSX构建,但是针对架构x86_64为iOS模拟器文件'/Users/jonathan/Desktop/macuikit/UIKit.framework/UIKit'构建的dylib链接
这两种体系结构都是x86_64,所以它怎么能告诉框架是专门针对iOS模拟器的,我在Info.plist之类的东西中删除了对iOS的所有引用,甚至尝试删除除了UIKit二进制文件之外的所有内容,但同样的错误出现了.它自己的二进制文件中有什么东西可以告诉链接器它可以运行哪个平台,而不仅仅是架构?我查看了Mach-O标头但是只有CPU类型和子类型的字段,并且没有按预期的模拟器值.