Bug 3331 - 10.3.9 Build Failure: NSString may not respond to `+stringWithCString:encoding:'
Summary: 10.3.9 Build Failure: NSString may not respond to `+stringWithCString:encoding:'
Status: VERIFIED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 312.x
Hardware: Mac OS X 10.3
: P2 Normal
Assignee: Darin Adler
URL:
Keywords:
Depends on:
Blocks: 3354
  Show dependency treegraph
 
Reported: 2005-06-07 20:43 PDT by Alan Ruttenberg
Modified: 2005-06-19 03:17 PDT (History)
1 user (show)

See Also:


Attachments
proposed fix (656 bytes, patch)
2005-06-13 18:10 PDT, Finlay Dobbie
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Ruttenberg 2005-06-07 20:43:32 PDT
WebScriptObject.mm: In function `NSString* -[WebScriptObject stringRepresentation](WebScriptObject*, 
objc_selector*)':
WebScriptObject.mm:343: warning: `NSString' may not respond to `+stringWithCString:encoding:'
WebScriptObject.mm:343: warning: cannot find method `+stringWithCString:encoding:'; return type 
`id' assumed

Documentation says that +stringWithCString:encoding is 10.4 specific.
Comment 1 Alan Ruttenberg 2005-06-07 20:46:30 PDT
Even though these are warnings, the next thing that prints is

** BUILD FAILED **
Comment 2 Maciej Stachowiak 2005-06-07 21:48:45 PDT
There's probably a CFString function that does the same thing as this method.
Comment 3 Christopher Schmidt 2005-06-07 21:56:35 PDT
Webkit is built with -Werror by default: if you manually pull out the -Werror
flag from that build line, you can continue building Webkit -- however, there
will be a crash when you encounter that symbol.

Advice on #webkit indicates that it may be possible to rewrite this method to
use some CFString method instead. I don't know what this means, just tossing it
in in case it's helpful.
Comment 4 Maciej Stachowiak 2005-06-07 22:07:49 PDT
Review of this patch is in progress.
Comment 5 Christopher Schmidt 2005-06-07 22:09:20 PDT
Another build error: in file:
/Users/crschmidt/webkit/WebCore/khtml/ecma/kjs_window.cpp

/Users/crschmidt/webkit/WebCore/khtml/ecma/kjs_window.cpp:93: error: `isnan' not
declared
/Users/crschmidt/webkit/WebCore/khtml/ecma/kjs_window.cpp: In function `int
KJS::intFeature(const QMap<QString, QString>&, const char*, int, int, int)':
/Users/crschmidt/webkit/WebCore/khtml/ecma/kjs_window.cpp:557: error: `isnan'
undeclared (first use this function)
/Users/crschmidt/webkit/WebCore/khtml/ecma/kjs_window.cpp:557: error: (Each
undeclared identifier is reported only once for each function it appears in.)

Interestingly enough, there seems to be some kind of indication in the file of
why this might happen: 

// Must include <cmath> instead of <math.h> because of a bug in the
// gcc 3.3 library version of <math.h> where if you include both
// <cmath> and <math.h> the macros necessary for functions like
// isnan are not defined.

But <cmath> is being included. Not sure why exactly this is/isn't working, but I
do know that Panther is using gcc-3.3, whereas building on Tiger used gcc-4.0.

This one is an error, rather than a warning, so it can't be just skipped over.

I was able to continue building by pulling the isnan calls out (as well as the
using std::isnan), although obviously the code in this file will suffer as a
result. (Not sure what the end result of this really is, just trying to get it
to build to find where things which need to change are).
Comment 6 Christopher Schmidt 2005-06-07 22:19:07 PDT
10.3.9 does not include libxslt header files: it includes the library
(-rwxr-xr-x  1 root  wheel  202984 12 May 12:13 /usr/lib/libxslt.1.dylib), but
there is no /usr/include/libxslt directory.
Comment 7 Christopher Schmidt 2005-06-08 04:19:35 PDT
Comment #6 has been opened as Bug 3334.
Comment #5 has been opened as Bug 3344.
Comment 8 Christopher Schmidt 2005-06-08 20:58:40 PDT
Changing title: metabug is 3354. This is one specific aspect of said bug.
Comment 9 Finlay Dobbie 2005-06-13 18:10:00 PDT
Created attachment 2307 [details]
proposed fix

Unless I'm missing something, this fixes JavaScriptCore to build on Panther.
Comment 10 Darin Adler 2005-06-13 19:01:15 PDT
The patch is OK if the internal compiler error doesn't start happening again. My guess is that it will, and 
another solution in that case is to use the deprecated +[NSString stringWithCString:].
Comment 11 Finlay Dobbie 2005-06-13 19:03:48 PDT
What internal compiler error? I didn't really grok the comment, not knowing the background ;-)
Or of course the non-deprecated [NSString stringWithUTF8String:] or [NSString stringWithString:], but I 
don't like randomly copying strings for no good reason.
Comment 12 Maciej Stachowiak 2005-06-13 19:06:01 PDT
I just applied the patch and did not see any internal compile error building with gcc 3.3 on Tiger.
Comment 13 Finlay Dobbie 2005-06-13 19:38:49 PDT
I didn't get any internal compiler error on Panther with gcc 3.3 1671 or on Tiger with gcc 4.0 5026
Comment 14 Maciej Stachowiak 2005-06-13 21:47:06 PDT
r=me
I'm going to assume the internal compiler error is gone and land this, since Finlay and I could not repro 
under a variety of circumstances.
Comment 15 Darin Adler 2005-06-18 16:48:10 PDT
Comment on attachment 2307 [details]
proposed fix

OK. If this doesn't bring back that mysterious internal compiler error, then
it's fine.
Comment 16 Chris Petersen 2005-06-18 23:02:39 PDT
Reporter, please mark this bug as Verified if this issue has been fixed in the latest TOT Webkit.