Bug 101179
Summary: | Build failure with ICU 50 and C++11 because of a different UChar definition | ||
---|---|---|---|
Product: | WebKit | Reporter: | Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED WORKSFORME | ||
Severity: | Normal | CC: | ap, glenn, jshin, markus.icu+webkit, mcatanzaro, msaboff, srl295, zilla |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Arfrever Frehtes Taifersar Arahesis
When GCC >=4.7 (or another compiler supporting C++11) is used, then UChar type from ICU 50 is a typedef to char16_t instead of unsigned short int. This results in compilation failure in WebKit.
To reproduce this bug, you must:
1. Build ICU 50 using GCC >=4.7. ICU will automatically be built with -std=c++11 flag.
2. Build WebKit with -std=c++11 (or -std=gnu++11) manually added to CXXFLAGS.
Compilation failure does not occur with ICU 49 or older.
Last lines from `make`:
CXX Source/JavaScriptCore/API/libjavascriptcoregtk_3_0_la-JSBase.lo
CXX Source/JavaScriptCore/API/libjavascriptcoregtk_3_0_la-JSCallbackConstructor.lo
CXX Source/JavaScriptCore/API/libjavascriptcoregtk_3_0_la-JSCallbackFunction.lo
CXX Source/JavaScriptCore/API/libjavascriptcoregtk_3_0_la-JSCallbackObject.lo
CXX Source/JavaScriptCore/API/libjavascriptcoregtk_3_0_la-JSClassRef.lo
CXX Source/JavaScriptCore/API/libjavascriptcoregtk_3_0_la-JSContextRef.lo
CXX Source/JavaScriptCore/API/libjavascriptcoregtk_3_0_la-JSObjectRef.lo
CXX Source/JavaScriptCore/API/libjavascriptcoregtk_3_0_la-JSStringRef.lo
Source/JavaScriptCore/API/JSStringRef.cpp: In function ‘OpaqueJSString* JSStringCreateWithCharacters(const JSChar*, size_t)’:
Source/JavaScriptCore/API/JSStringRef.cpp:39:50: error: invalid conversion from ‘const JSChar* {aka const short unsigned int*}’ to ‘const UChar* {aka const char16_t*}’ [-fpermissive]
In file included from Source/JavaScriptCore/API/JSStringRef.cpp:30:0:
Source/JavaScriptCore/API/OpaqueJSString.h:44:39: error: initializing argument 1 of ‘static WTF::PassRefPtr<OpaqueJSString> OpaqueJSString::create(const UChar*, unsigned int)’ [-fpermissive]
Source/JavaScriptCore/API/JSStringRef.cpp: In function ‘const JSChar* JSStringGetCharactersPtr(JSStringRef)’:
Source/JavaScriptCore/API/JSStringRef.cpp:75:31: error: invalid conversion from ‘UChar* {aka char16_t*}’ to ‘const JSChar* {aka const short unsigned int*}’ [-fpermissive]
make[1]: *** [Source/JavaScriptCore/API/libjavascriptcoregtk_3_0_la-JSStringRef.lo] Error 1
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
Could you please post a snippet of how exactly ICU 5.0 defines UChar?
Jonathan Wakely
(In reply to comment #1)
> Could you please post a snippet of how exactly ICU 5.0 defines UChar?
See http://gcc.gnu.org/ml/gcc-help/2012-11/msg00018.html
Arfrever Frehtes Taifersar Arahesis
(In reply to comment #1)
> ICU 5.0
Versioning of ICU has changed since 49:
http://userguide.icu-project.org/design#TOC-ICU-Release-Version-Number-ICU-49-and-later-
(In reply to comment #2)
> See http://gcc.gnu.org/ml/gcc-help/2012-11/msg00018.html
(Undefined references mentioned in that thread will occur when building WebKit with older version of C++11 if ICU has been built with C++11.)
Arfrever Frehtes Taifersar Arahesis
(In reply to comment #3)
> older version of C++11
s/older version of C++11/older version of C++/
Steven R. Loomis
Maybe caused by http://bugs.icu-project.org/trac/ticket/9717
Steven R. Loomis
(In reply to comment #5)
> Maybe caused by http://bugs.icu-project.org/trac/ticket/9717
see there for a possible workaround.
Arfrever Frehtes Taifersar Arahesis
(In reply to comment #5)
> Maybe caused by http://bugs.icu-project.org/trac/ticket/9717
This bug in WebKit was caused by solution for ICU ticket 9469. ICU ticket 9717 only suggests temporary workaround (forceful disabling of C++11). The proper solution in WebKit is to add appropriate casts (or use char16_t in more places in WebKit code).
Markus Scherer
In ICU, I just changed UChar to not automatically become char16_t, but users can add something like CPPFLAGS=-DUCHAR_TYPE=char16_t.
See http://bugs.icu-project.org/trac/changeset/32780
If this does not work for WebKit then please reply to http://bugs.icu-project.org/trac/ticket/9728 or on the icu-support mailing list (http://site.icu-project.org/contacts).
Best regards,
markus
Michael Catanzaro
Looks like this is obsolete as per comment #8.