Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XCode and error messages




On 9 aug 2006, at 23:28, Tommy Nordgren wrote:

When writing custom development tools, exactly how should error messages be formatted,
so that XCode can parse and display them?

a) error/warning messages produced by a custom build rule are never picked up properly by Xcode (rdar://problem/4343667)
b) error/warning messages produced by a "Run Script" phase are picked up by Xcode if they conform to gcc's error/warning message formatting, although the exact regex they have to conform to is not public. This means that you have to watch out when giving more info than gcc -- e.g., we also give the column in which the error occurs, but the extra colon resulting from that seemed to break Xcode's parsing (so now I replace that colon with a dash).


To work around a), you can do something like I do in the Free Pascal project templates, available from
ftp://ftp.freepascal.org/pub/fpc/beta/2.0.4-rc3/powerpc-macosx/fpc- xcode-2.0.4-rc3.dmg


Basically, I create a dummy target which contains all the source files. In the custom build rule for my source files I write out the file names of all these files to a temporary file. Then, in the main target (which is dependent on this dummy target), I have a Run Script phase which reads these file names back from that temporary file and does the actual compilation (so error messages are picked up by Xcode).

Note that the Run Script phase only compiles to assembler and not to object code. In the same main target with the Run Script phase, there is also a "custom build rule" for the Pascal source files which does nothing, but sets the output file to "$(PROJECT_DERIVED_FILE_DIR)/$ (INPUT_FILE_BASE).s" (which has been produced during the preceding Run Script phase already). Xcode will then do the assembling for you.

The reason is that Xcode will only link in object files is allowed to assemble itself. If you do it yourself and specify an object file as output, Xcode ignores it (didn't file a bug for that yet).

You can probably ignore the "fpcrtl" target from those templates; it just creates a static library from all installed Run Time Library object files for Xcode to be able to link it in easily.


Jonas _______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden
References: 
 >XCode and error messages (From: Tommy Nordgren <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.