سؤال

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

نصائح أخرى

Here's a link to a Makefile with the tabs, and I made a little change to separate out the target name from the library name. Thanks very much for this! This solved my problem!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top