50

Recently, I switched to Xcode4 and when I compile my project I got following error.

ld: warning: ignoring file /Users/myname/Library/Developer/Xcode/DerivedData/appname-hezrgyqimckztgbdlslkavphdclw/Build/Products/Debug-iphoneos/libTapkuLibrary.a, file was built for archive which is not the architecture being linked (armv6)
Undefined symbols for architecture armv6:
  "_OBJC_CLASS_$_TKLoadingView", referenced from:
      objc-class-ref in RootViewController.o

I opened the TapkuLibrary and checked that it's Architectures set to 'Standard (armv6 armv7)'.

What can I do to fix this problem?

Seunghoon
  • 5,632
  • 5
  • 35
  • 41

17 Answers17

111

I figured out what caused the problem. I changed 'Build Active Architecture Only' of TapkuLibrary from Yes to No and it compiles with no problem.

Seunghoon
  • 5,632
  • 5
  • 35
  • 41
35

I was able to solve this problem by doing the opposite of the accepted answer - I changed the 'Build Active Architecture Only' from NO to YES.

Community
  • 1
  • 1
Josh Brown
  • 52,385
  • 10
  • 54
  • 80
11

I met this problem when I upgraded the XCode to 4.5 and iOS to iOS6. For GMGridView, it just happened. Not for simulator, but only for device.

I fixed this by the following steps: 1) Go to GMGridView project -> Build Settings 2) Under Setting -> Architectures, select "Standard (armv7, armv7s)"

Then clean all (including DerivedData) and rebuild.

Hope it helps!

sonoshin
  • 241
  • 3
  • 6
11

Had the same problem. But the reason was different I suppose. I was using the library.a file built for simulator and trying to run it on device.. came to know that i need different .a files for simulator and device. I hope this helps someone ;)

For example, here I have imported different library files for device and simulator

Zaraki
  • 3,720
  • 33
  • 39
  • I am having this exact problem. What do you mean different .a files for simulator? – Luda Jul 23 '12 at 10:53
  • here i attached a screenshot for you. If you have .a library files in your project that you imported, then there need to be two of them. One is for simulator and one is for device. import as per your requirements. – Zaraki Jul 24 '12 at 07:21
  • you can use the lipo command line tool to compile both libraries (simulator and device) into the same file. build both separately (simulator and build for archive for release), cd to the Build/Products directory where they were built and use `lipo -create Release-iphoneos/libsbjson.a Debug-iphonesimulator/libsbjson.a -output libsbjson.a` – Dan Sandland Oct 04 '12 at 00:39
  • i did what you suggested.. and got this error message instead: `ld: file is universal (2 slices) but does not contain a(n) armv7s slice: /Users/admin/dev/iphone/buildOutput/Debug-iphoneos/libThree20Core.a for architecture armv7s` -> keep in mind that i replaced the .a file inside the device directory.. – abbood Jan 21 '13 at 11:11
6

Try to remove the armv6 architecture, and compile it only for armv7.

Cthutu
  • 8,713
  • 7
  • 33
  • 49
Macmade
  • 52,708
  • 13
  • 106
  • 123
  • 3
    That also fixed the problem but I don't want to limit my App to new devices which supports armv7. Thanks! – Seunghoon Mar 14 '11 at 20:29
  • This works for me, but I still want to support older devices, do you have any other solutions. – Tuyen Nguyen Jun 21 '12 at 15:21
  • How can I remove the armv6 or x86_64 archs in a static library in Xcode? I can do this by command line like here - http://atnan.com/blog/2012/01/12/avoiding-duplicate-symbol-errors-during-linking-by-removing-classes-from-static-libraries - but how can it be done by Xcode? – Khaled Annajar Nov 24 '14 at 09:58
2

This solved the problem for me:

Some external library like three20 did extra settings for

Build Settings->Architectures->Any iOS SDK

the value is "armv6 armv7" that different from standard "armv7 armv7s"

drop down and select "Standard", it worked for me.

Val
  • 21,938
  • 10
  • 68
  • 86
2

I managed it by clicking the "unfriendly" Project's (in my case GMGridView). In tab "Architectures", I changed the value from something (I don't remember exactely anymore, I guess it was:) "armv7, armv6s" to "armv7, armv7". After that it worked for me.

tmighty
  • 10,734
  • 21
  • 104
  • 218
2

Something else that worked for me was making sure that all sub projects had the architecture set to be armv6 and armv7, making sure to set both the TARGET and the PROJECT of each sub project. After cleaning and rebuilding everything, it worked without a problem.

AndyDunn
  • 1,074
  • 1
  • 12
  • 19
1

This worked for me :

  1. Click on the offending framework's 'Project' file (xcodeproj).

  2. Go to the "Info" tab for the framework's 'Project' (not 'Target').

  3. Expand 'Configurations' and make sure that both 'Debug' and 'Release' have 2 configurations set--one for the framework's 'Project' and another for the framework's 'Target'. In the case of frameworks the 'Target' compiles to a Library and not an application, so it's easy to get confused.

  4. 'Debug' should have the Project set to 'Debug' and the Library set to 'Shared'

  5. 'Release' should have the Project set to 'Release' and the Library set to 'Shared'

  6. Compile, run, and enjoy.

  7. If you ended up mangling your entire project trying to figure this out, then you might want to double-check your Application's Project build phases (as Gon suggested). The Library should be there highlighted in red, even if it doesn't exist on your drive. If not, as long as it's set to 'Shared' you should be able to add it back again.

  8. If you really really really mangled your project, then you may be forced to blow out your DerivedData folder, as russes suggested. Also, check the 'Organizer', since Xcode has a way of saving crap all over the place.

  9. Oh, and you checked to make sure that 'armv6' is there right? :)

1

If I get the ignore file warning - I would run lipo -info on ignored file to find it's architecture as below

lipo -info libTapkuLibrary.a

That would print either of i386, armv6, armv7, armv7s, x86_64 etc. In general, that architecture has to match with your target build platform. E.g.

  • i386 = ios simulator or 32 bit build on mac os x
  • armv6 armv7 arm7s = ios device
  • x86_64 = 64 bit build on mac os x

Depending on the mismatch, either you have to rebuild your library for your target platform or change your target platform.

Note: For fat binaries, lipo -info will print a combination of above architectures.

kiranpradeep
  • 10,859
  • 4
  • 50
  • 82
1

I managed to resolve this by just creating a adhoc configuration inside the Tapku info settings ...

XCODE 4, Project > Archive = library not found for -lTapkuLibrary - Issues - devinross/tapkulibrary - GitHub

Wladimir Palant
  • 56,865
  • 12
  • 98
  • 126
epinom
  • 11
  • 2
1

Make sure the build variants on your projects are set to "normal".

If you are building a project which includes other projects, take a look inside the DerivedData folder for the main project. Examine the archive files with the "lipo -info yourarchive.a". Also, examine the timestamps on these archives. You may find that these libraries are not getting rebuilt or you are trying to link against an old version of the archive which is the wrong architecture.

In my case, I shutdown Xcode and deleted the DerivedData folder for my main project. This forced a full rebuild when I reopened the main project in Xcode 4. The full rebuild caused the i386 archives to be created (or the correct version to be found) & the simulator version to link correctly.

russes
  • 1,110
  • 11
  • 17
0

I had this problem with the Three20 library. The thing that finally did it for me was switching the Project Format from Xcode 3.1 to Xcode 3.2 - leaving 'build active arch only' as "no".

FishStix
  • 4,994
  • 9
  • 38
  • 53
0

Had the same problem, and tried diverse solutions from the page to no avail. I still had a message telling me my library was not build for arm64.

Finally how I resolved it :

  • opened the project.pbxproj for the library in a text editor
  • searched for VALID_ARCHS
  • there were 4 occurrences, 2 of which did not contain arm64
  • I manually added arm64 in the chain (VALID_ARCHS = "arm64 i386 armv7 armv7s")
  • rebuild the lib and it was all right

Seems sometimes the build settings displayed by XCode is incomplete, and doesn't correspond precisely to the make file.

Eino Gourdin
  • 4,169
  • 3
  • 39
  • 67
0

I fixed this problem thanks to another thread where they show that armv6/armv7 is actually a little different than what you think it is: Upgrading to xcode 4 error No architectures to compile for

Community
  • 1
  • 1
pottedmeat
  • 3,391
  • 1
  • 18
  • 9
0

I tried all the options above and none worked.

This is the right answer:

simply dragging a framework in your project won't link it properly (or something along these lines, in any case)

what you need to do is select the framework you want to add in Build Phases (click on your project's blue icon, then select your project's name under Targets, then the tab Build Phases), see here for more reference.

Community
  • 1
  • 1
Gon
  • 1
  • your answer fixes a separate problem. In this case the library is linked properly, but it is not compiled for the desired architecture. – Loyal Tingley Jun 03 '13 at 03:44
0

None of these answers worked for me. (Similar warning message, different static library project). For me it was having configured XCode to honor the build directories of the targets and then having targets build in a local build/ directory that caused the problem. Configuring XCOde to use "Derived data" folder fixed it.

PEZ
  • 16,821
  • 7
  • 45
  • 66