13

I am getting this error after adding the libxml2.2.dylib file

 Linking /Users/Biranchi/Desktop/Funmovies TabBarController/build/Debug-iphonesimulator/funmovies.app/funmovies (1 error)
 in /Developer/Platforms/iphoneOS.platform/Developer/SDKs/iphoneOS3.0.sdk/lib/libobjc.A.dylib, missing required architecture i386 in file

Command /XCode3.1.4/platforms/iphoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

What is this error due to ??

All suggestions are appreciated.

Thanks Biranchi

Vladimir
  • 170,431
  • 36
  • 387
  • 313
Biranchi
  • 16,120
  • 23
  • 124
  • 161

12 Answers12

34

Make sure you import with correct extension.

I got the error when I by mistake wrote #import "AClass.m" instead of #import "AClass.h" :-)

FreeAsInBeer
  • 12,937
  • 5
  • 50
  • 82
hfossli
  • 22,616
  • 10
  • 116
  • 130
  • Same problem, would've taken forever to find this without this comment, thanks! – bmueller Oct 18 '12 at 05:15
  • Great. I compiled code in a `.cpp` file, and tried to use the function from a `.mm` file, and it failed like this. Renaming the `.cpp` file wasn't enough.. I had to actually _create a new `.mm` file_, and cut and paste the code from the old `.cpp` to the `.mm`, to make it work. – bobobobo Nov 19 '12 at 19:03
8

I had to remove this library libz.1.2.3.dylib and add this one libz.1.2.5.dylib. After that it compiled fine.

mracoker
  • 886
  • 9
  • 14
5

Try Product -> Clean. Worked for me.

Brooks Hanes
  • 51
  • 1
  • 2
3

How to add as a compiled source

Make sure if you have external classes they are added in the compile sources. I had the same error when i was trying to import a certain class. To fix it goto build phases and add it into the compiled sources.

JH95
  • 489
  • 1
  • 7
  • 24
2

Got the same error, now even when I`ve deleted libxml2 from project error still here :) This sh**y XCode wrote this:

LIBRARY_SEARCH_PATHS = (
+                    "$(inherited)",
+                    /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib,
+                );

into project`s config file "project.pbxproj" in "MyProj.xcodeproj".

You can change this path by hands to something like:

LIBRARY_SEARCH_PATHS = (
+                    "$(inherited)",
+                    /Developer/Platforms/iPhoneSimulatorOS.platform/Developer/SDKs/iPhoneSimulatorOS3.0.sdk/usr/lib,
+                );

But do not forget to change it back when compile into device. I`ll try to find more simple way to resolve this problem.

Oleksii
  • 66
  • 2
2

I had a similar problem when building a project but this time with the file timbreID.c

arm-apple-darwin10-gcc-4.2.1: timbreID.c: No such file or directory
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

After several attempts I finally looked into the 'Targets' on my XCode project and realized that the file timbreID.c was red (= not found). I right-clic on it and chose the new path manually.

After that: build succeeded!!

Cordeiro
  • 21
  • 3
2

just remove the libz1.2.3 and add the libz1.2.5 library to your build phase.

1

If this is a problem related to a specific frame work, make sure it is enabled in the build phase. For me I had to add MessageUI.framework: In Xcode 4 goto the build phases tab for your target. Make sure you see the frameworks you are using. If it's not there click + to add it.

Graham P Heath
  • 7,009
  • 3
  • 31
  • 45
1

I had the same problem and I went on checking the target info

In the library search paths there was this entry, "$(DEVELOPER_DIR)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/usr/lib"

I removed it and the app WORKED!!!

Sukitha Udugamasooriya
  • 2,268
  • 1
  • 35
  • 56
0

I was getting the same error even though none of the files in the navigation pane were red. Turns out I refactoring the name of a class throws the xcode path locations off. The solution that worked for me was to select the .h and .m files one at a time, set the location to "Absolute Path" (in the right hand menu, leftmost tab) and then browse to its location in the file system.

sur
  • 51
  • 4
0

To add to Graham Heath's answer - which I think deserves more prominence in the thread.

Checking for a missing framework is the quickest and easiest fix to try. Totally non-destructive and probably the cause of these sort of errors for most people. Just browse the list of frameworks for something that looks appropriate and try it. I think many people are fooled because XCode does not flag a problem with a class when you write the code - just when you link it.

My error was: "linker command failed with exit code 1 (use -v to see invocation)" concerning a couple of errors in CoreLocation:

"Undefined symbols for architecture armv7: "_OBJC_CLASS_$_CLLocationManager", referenced from: objc-class-ref in NPTViewController.o"

I added CoreLocation.framework and the job was done.

Tim
  • 1,108
  • 13
  • 25
0

Try to issue the failed command from the command line. There, you will see the stderr output that is not shown via GUI.

18446744073709551615
  • 16,368
  • 4
  • 94
  • 127