问题描述
我一直在尝试构建一个静态库,然后在Xamarin中创建一个绑定项目。一切正常,直到iOS 7出现。我不得不抓住最新版本的本机库并尝试在XCode 5中构建它,但它一直给我各种各样的问题。我认为它可能与构建过程有关,或者可能与XCode 5中的某些更改设置有关(对比4),但我不确定。
这个一个用于构建通用二进制文件的脚本,该二进制文件基于此问题的工作:
我注意到的一件事就是之前,在我的二进制版本的旧版iOS 6.1版本(内置在XCode 4中)中,我的二进制文件大约是24 Mb,现在使用XCode 5,它已经膨胀到接近50 Mb!这让我觉得编译和链接步骤有问题。
有什么想法吗?有没有其他人在XCode 5(vs 4)中遇到通用二进制文件的问题?
我正在使用下面的makefile库甚至使用XCode 5和iOS7 SDK也能完美无缺。
XBUILD = / Applications / Xcode.app / Contents / Developer / usr / bin / xcodebuild
PROJECT_ROOT =。
PROJECT = $(PROJECT_ROOT)/GIFLibFrontEnd.xcodeproj
TARGET = GIFLibFrontEnd
all:libUniversal.a
libi386.a:
$(XBUILD)-project $(PROJECT)-target $(TARGET)-sdk iphonesimulator -configuration发布clean build
-mv $(PROJECT_ROOT)/ build / release-iphonesimulator / lib $(TARGET).a $ @
libArmv7.a:
$(XBUILD)-project $(PROJECT)-target $(TARGET)-sdk iphoneos -arch armv7 -configuration Release clean build
-mv $ (PROJECT_ROOT)/ build / Release-iphoneos / lib $(TARGET).a $ @
libArmv7s.a:
$(XBUILD)-project $(PROJECT)-target $(TARGET )-sdk iphoneos -arch armv7s -configuration发布清理版本
-mv $(PROJECT_ROOT)/ build / Release-iphoneos / lib $(TARGET).a $ @
libArm64.a:
$(XBUILD)-project $(PROJECT)-target $(TARGET)-sdk iphoneos -arch arm64 -configuration发布clean build
-mv $(PROJECT_ROOT)/ build / release-iphoneos / lib $ (TARGET).a $ @
libUniversal.a:libi386.a libA rmv7.a libArmv7s.a libArm64.a
lipo -create -output lib $(TARGET)Universal.a $ ^
clean:
-rm -f * .a * .dll
-rm -rf build
I've been trying to build a static library and then create a binding project from it in Xamarin. Everything was working fine until iOS 7 hit. I had to grab the latest version of the native library and try and build it in XCode 5, but it's been giving me all kinds of problems. I think it might be related to the build process or possibly some changed setting in XCode 5 (vs. 4) but I'm not sure.
I was using this script to build a universal binary which is based of work in this question:
Build fat static library (device + simulator) using Xcode and SDK 4+
One thing I did notice is that previous, in the old iOS 6.1 version of my binary (built in XCode 4), my binary was about 24 Mb, now with XCode 5 it's ballooned to almost 50 Mb! Which is leading me to think that there is something wrong with the compiling and linking step.
Any ideas? Has anybody else encountered problems with universal binaries in XCode 5 (vs 4)?
I'm using the makefile below for my library and it works flawless even with XCode 5 and the iOS7 SDK.
XBUILD=/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
PROJECT_ROOT=.
PROJECT=$(PROJECT_ROOT)/GIFLibFrontEnd.xcodeproj
TARGET=GIFLibFrontEnd
all: libUniversal.a
libi386.a:
$(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphonesimulator -configuration Release clean build
-mv $(PROJECT_ROOT)/build/Release-iphonesimulator/lib$(TARGET).a $@
libArmv7.a:
$(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphoneos -arch armv7 -configuration Release clean build
-mv $(PROJECT_ROOT)/build/Release-iphoneos/lib$(TARGET).a $@
libArmv7s.a:
$(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphoneos -arch armv7s -configuration Release clean build
-mv $(PROJECT_ROOT)/build/Release-iphoneos/lib$(TARGET).a $@
libArm64.a:
$(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphoneos -arch arm64 -configuration Release clean build
-mv $(PROJECT_ROOT)/build/Release-iphoneos/lib$(TARGET).a $@
libUniversal.a: libi386.a libArmv7.a libArmv7s.a libArm64.a
lipo -create -output lib$(TARGET)Universal.a $^
clean:
-rm -f *.a *.dll
-rm -rf build
这篇关于XCode 5中的胖库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!