Closed Bug 666951 Opened 13 years ago Closed 13 years ago

Will not compile in Mac OS X due to sizeof wchar_t

Categories

(Firefox Build System :: General, defect)

All
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: jerry, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1
Build Identifier: XULRunner 2.0, 5.0, 6.0, 7.0 for Mac OS X

Using the Mac OS X 10.5 SDK, and presumably 10.6 and 10.7, the XULRunner versions 2.0, 5.0, 6.0 and 7.0 will not compile due to the line PR_STATIC_ASSERT(sizeof(wchar_t) == 2); in nsStringAPI.h. 

Reproducible: Always

Steps to Reproduce:
1.  In Xcode, create a target to build something, for example a binary XPCOM, that requires linking to XULRunner.
2.  Download any of the XULRunner  versions 2.0, 5.0, 6.0 or 7.0 from mozilla.org.
3.  Add the xulrunner/include subdirectoy of XULRunner directory to the target's Header Search Paths and User Header Search Paths.
4.  Build

Actual Results:  
Compiler errors wherever you've included xulrunner/include/nsStringAPI.h, around line 1100 or so, at the line

  PR_STATIC_ASSERT(sizeof(wchar_t) == 2);

Error: Size of array 'arg' is negative

which makes sense if you look at the wacky PR_STATIC_ASSERT macro, but I don't care about that. 

Expected Results:  
Project should compile.

When I log sizeof(wchar_t), I get 4, not 2.  That's why the assertion fails.
It is necessary to compile with -fshort-wchar.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
Yes, that fixes the problem.
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.