1

I need to create an universal library of a Cocoa Touch Static library project,

I am using

xcodebuild -target mysdsk ONLY_ACTIVE_ARCH=NO VALID_ARCHS="arm64 armv7 armv7s i386 x86_64" -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"

Even if I split the iphonesimulator as two xcodebuild still I could not get i386 for iphone4 simuator

I am getting error

Undefined symbols for architecture i386

Based on How do I determine the target architecture of static library (.a) on Mac OS X?

I tried to run the file command, it displays

mysdsk.a: Mach-O universal binary with 5 architectures
mysdsk.a (for architecture i386): current ar archive random library
mysdsk.a (for architecture armv7): current ar archive random library
mysdsk.a (for architecture armv7s): current ar archive random library
mysdsk.a (for architecture x86_64): current ar archive random library
mysdsk.a (for architecture arm64): current ar archive random library

But still I am getting error

Undefined symbols for architecture i386
Community
  • 1
  • 1
Dickens A S
  • 3,824
  • 2
  • 22
  • 45

1 Answers1

0

Whatever method you have followed, From the list of architectures I think everything is fine.

There is one issue with XCode that even if you drag an drop the mysdsk.a or change inside the linker setttings, The XCode can still pick a wrong file which is stored inside

/Users/<your username>/Library/Developer/Xcode/DerivedData/mysdsk_........ folder

You can identify from XCode warnings saying 3 slices but it is actually 5 slices

ld: warning: ignoring file /Users//Library/Developer/Xcode/DerivedData/mysdsk_......./..../mysdsk.a, missing required architecture i386 in file /Users//Library/Developer/Xcode/DerivedData/mysdsk_......./..../mysdsk.a (3 slices)

Therefore Delete the folder /Users//Library/Developer/Xcode/DerivedData/mysdsk_........

Then it should be working fine, Actually I identified this issue that the other machine works fine but my machine was not working.

Reference ignoring file [path] missing required architecture i386 in file

Community
  • 1
  • 1
Dickens A S
  • 3,824
  • 2
  • 22
  • 45
  • Found usefull but, it seems little bit work around, I will try – Dickens A S Jul 23 '15 at 07:13
  • Actually I was bit sceptical about this workaround, but the solution solved my problem, I am accepting this as an answer, If possible please provide proper Bug/Issue location if this is already addressed in apple developer forum – Dickens A S Jul 23 '15 at 07:53