Question

I'm using the fantastic iOS Universal Framework script to build my own framework and its worked great for some time. I'm not sure exactly when, but it seems to have stopped building i386 along the way. Apps consuming the framework produced no longer work with the simulator.

I've got VALID_ARCHS = arm64 armv7 armv7s i386 x86_64 set. And ONLY_ACTIVE_ARCH = NO. The build script isn't throwing any errors or logs. Yet I get a skinny framework in the end without i386 or x86_64 and thus any project dependent on this framework has linker errors when building for the simulator.

Extra info:

  • Using the Mk8 script latest build from main repo.
  • Archiving, not building as some errors suggest.

Any ideas?

Était-ce utile?

La solution

I was having this same problem recently. I had to tweak several build settings to get it to build for i386 and x86_64 again. The one that got it working for me was when I unchecked the "Run script only when installing" checkbox in the Run Script Build Phase.

Autres conseils

This may be one of my more vague answers, and I may not be able to specifically answer your question because you're talking about iOS Universal Framework but maybe I can shed some light on my experience.

I've found that building for both i386 and x86_64 architectures at the same time (with one xcodebuild call) even with the correct valid-archs and only-active-arch just doesn't work.

I solved the particular issue of creating a universal static library with all 5 archs in the Kiwi project by explicitly building for x86_64 and combining the output with the previous step with lipo.

Comments from my pull request are below:

Building explicitly for the x86_64 simulator required a bit of trial and error, xcodebuild seems unable to build i386 and x86_64 at the same time, so I added [additional] steps specifically for x86_64.

Restricting the VALID_ARCHS, ARCHS and IPHONEOS_DEPLOYMENT_TARGET for the 64bit simulator build seemed to do the trick.

ARCHS='x86_64' VALID_ARCHS='x86_64' IPHONEOS_DEPLOYMENT_TARGET='7.0'

Under the hood a universal framework is just creating a static library with symbolic links and a specific structure (to look like a .framework). I'd imagine iOS Universal Framework has the same issues I had the Kiwi library. I'm sure more people have this issue...

You need to build the script for all archs arm64 armv7 armv7s i386 x86_64 and then build a new file using lipo command.

To build arm64 armv7 armv7s use the iphone platform /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer and for i386 x86_64 use the simulator /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer.

I use this to generate one c++ lib.

Ex:

    $(CC) $(CFLAGS) -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer $(CPP_SRC_DIR)/*.cpp

    $(XCODE_AR) rvs $(IOS_TARGET_A_DIR)/$(LIB_NAME).x86_64.a $(IOS_TARGET_O_DIR)/x86_64/*.o
    #Build fat library
    $(XCODE_LIPO) -create $(IOS_TARGET_A_DIR)/*.a -output $(IOS_TARGET_FAT_DIR)/lib.a

I hope this helps.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top