On Mar 26, 2009, at 9:11 AM, Scott Thompson wrote: The very odd thing about this problem is that it ONLY seems to be an issue when using xcodebuild from the command line. The same project (in the same configuration) compiles and links just fine through the IDE. Moreover, the exact same code is shared with another project and that other project compiles just fine (in the same xcodebuild command line environment).
OK, two diagnostics you can perform.
1) Capture the invocation of the file under xcodebuild and under Xcode IDE and compare them. The best way to do this is to get each in its own text file, replace each space-hyphen with a newline-hyphen, then use FileMerge to look at diffs.
If there is a difference between the way that Xcode and xcodebuild are building that file that causes it to generate different assembly code, it ought to show up there.
2) If that shows no difference, then go into Xcode, select the file, choose Get Info, and in the Build tab add -v and re-run test 1. This time you'll get verbose compiler output, including the full search paths to all headers. Again, check meticulously for differences.
The most likely cause of a difference between building from the command line and building from Xcode is that executing xcodebuild propagates all shell environment variables into the build system as build settings, while launching the IDE does not. It's extremely rare that this causes a difference, but possible,
The other thing to look at is whether you are running xcodebuild as the same user as Xcode.app. If not, you are getting different build preference settings for each build.
There is one other scenario: if on your user account you ran xcodebuild with parameters at least once before you ever ran Xcode, then those parameters are stuck in ~/Library/Preferences/xcodebuild.plist and will be used as defaults for xcodebuild forever, overriding whatever you set in Xcode. This is a particularly hairy and hard to fix bug, but is extraordinarily rare (except here in Apple where we blow away user accounts regularly when installing new builds of the OS). The solution is to delete that rogue file.
Chris |