6

I upgraded to Xcode 4.

If I make a new iPad project in Xcode 4, everything works. If I make a project in Xcode 3 and then bring it over to Xcode 4, that works too.

One of my projects, however, would not compile. Error was:

No architectures to compile for (ARCHS=i386, VALID_ARCHS=armv7).

To get it to compile and run in the simulator, I ended up using these settings:

freaky but working settings in XCode 4

Putting i386 got the project to compile and run (thanks to this forum thread), but my other projects do not have i386 in the Valid Architectures and still work.

How can I make my project like the others?

Note: Yes, I've gone through the project quite carefully (in XCode, not the XML, though) and the non-compiling version did look exactly like its compiling friends.

Dan Rosenstark
  • 68,471
  • 58
  • 283
  • 421

2 Answers2

1

I had precisely the same issue and wrote a little shell script to programmatically edit the lines where I need to add i386 (I do this in my test harness after every git pull and tag checkout).

Place the following code in a shell script and then run it whenever you need to add i386 to all the VALID_ARCHS= entries:

sed -i -e 's/.*VALID_ARCHS = armv7;.*/VALID_ARCHS = "armv7 i386";/g' project.pbxproj

Oh, given the direct simplicity of this script, you need to be in the same directory where the project.pbxproj file is when you run it.

And, as implied, it does a global line replace. It replaces every instance of VALID_ARCHS = armv7; with VALID_ARCHS = "armv7 i386"; and the quotes are necessary or Xcode will throw an error telling you that the project.pbxproj file cannot be parsed.

Wulf
  • 379
  • 1
  • 6
  • 16
1

In the developer forums, I ran across people that edited the .pbxproj file with a text editor, and just added the entries into VALID_ARCHS that way. It seems to be a problem when XCode4 is handling some older XCode3 projects (although I've not seen that yet).

I checked a current project and this line does not exist, so if you see this problem try removing it from your project.pbxproj file and then restart XCode.

Kendall Helmstetter Gelner
  • 74,769
  • 26
  • 128
  • 150
  • On one project where I had that issue, I found it was easier to **remove** the VALID_ARCHS line in the project file, instead of trying to edit it. Doing that, Xcode will revert back to the default options (ie. i386 on Sim, armv6/7 on Device). – robc Mar 30 '11 at 22:24
  • That's what I was saying at the end, I think that is probably the best choice. I edited the last part of my question to make this more clear. – Kendall Helmstetter Gelner Mar 30 '11 at 23:26
  • Great, I'll try that. You mean "answer" by the way :) Thanks! – Dan Rosenstark Mar 30 '11 at 23:57
  • This worked. I don't want to go mucking around and editing your answer, but I just deleted the offending line `VALID_ARCHS = "armv7 i386";` (or whatever your VALID_ARCHS are) in project.pbxproj and... XCode doesn't put it back, but doesn't have problems either. – Dan Rosenstark Mar 31 '11 at 00:03