Will not compile in Mac OS X due to sizeof wchar_t

RESOLVED INVALID

Status

()

Core
Build Config
RESOLVED INVALID
7 years ago
7 years ago

People

(Reporter: Jerry Krinock, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
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.

Comment 1

7 years ago
It is necessary to compile with -fshort-wchar.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → INVALID
(Reporter)

Comment 2

7 years ago
Yes, that fixes the problem.
You need to log in before you can comment on or make changes to this bug.