Closed Bug 831995 Opened 11 years ago Closed 11 years ago

b2g builds fail with -std=gnu++0x: frameworks/base/include/utils/Unicode.h:26: error: redeclaration of C++ built-in type 'char16_t'

Categories

(Firefox OS Graveyard :: GonkIntegration, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: justin.lebar+bug, Unassigned)

Details

Attachments

(1 file)

At least, I presume this is happening because I happen to be tickling configure into turning on -std=gnu0x.  (I'm tweaking the build to pass -marm and a few other things.)

In the directory  /Users/jlebar/code/moz/B2G/objdir-gecko/netwerk/protocol/device
The following command failed to execute properly:
/opt/local/bin/ccache /Users/jlebar/code/moz/B2G/prebuilt/darwin-x86/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-g++ -o GonkCaptureProvider.o -c -fvisibility=hidden -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET -DIMPL_THEBES -DSTATIC_EXPORTABLE_JS_API -DNO_NSPR_10_SUPPORT -DEXCLUDE_SKIA_DEPENDENCIES -DOS_POSIX=1 -DOS_LINUX=1 -DIMPL_NS_NET -I/Users/jlebar/code/moz/ff-git2/src/netwerk/protocol/device/../../base/src/ -I/Users/jlebar/code/moz/ff-git2/src/ipc/chromium/src -I/Users/jlebar/code/moz/ff-git2/src/ipc/glue -I../../../ipc/ipdl/_ipdlheaders -I/Users/jlebar/code/moz/ff-git2/src/netwerk/protocol/device -I. -I../../../dist/include -I/Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nspr -I/Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nss -fPIC -DANDROID -isystem /Users/jlebar/code/moz/B2G/bionic/libc/arch-arm/include -isystem /Users/jlebar/code/moz/B2G/bionic/libc/include/ -isystem /Users/jlebar/code/moz/B2G/bionic/libc/kernel/common -isystem /Users/jlebar/code/moz/B2G/bionic/libc/kernel/arch-arm -isystem /Users/jlebar/code/moz/B2G/bionic/libm/include -I/Users/jlebar/code/moz/B2G/frameworks/base/opengl/include -I/Users/jlebar/code/moz/B2G/frameworks/base/native/include -I/Users/jlebar/code/moz/B2G/hardware/libhardware/include -I/Users/jlebar/code/moz/B2G/hardware/libhardware_legacy/include -I/Users/jlebar/code/moz/B2G/system -I/Users/jlebar/code/moz/B2G/system/core/include -isystem /Users/jlebar/code/moz/B2G/bionic -I/Users/jlebar/code/moz/B2G/frameworks/base/include -I/Users/jlebar/code/moz/B2G/external/dbus -I/Users/jlebar/code/moz/B2G/external/bluetooth/bluez/lib -I/Users/jlebar/code/moz/B2G/frameworks/base/services/sensorservice -I/Users/jlebar/code/moz/B2G/frameworks/base/services/camera -I/Users/jlebar/code/moz/B2G/system/media/wilhelm/include -I/Users/jlebar/code/moz/B2G/frameworks/base/include/media/stagefright -I/Users/jlebar/code/moz/B2G/frameworks/base/include/media/stagefright/openmax -I/Users/jlebar/code/moz/B2G/frameworks/base/media/libstagefright/rtsp -I/Users/jlebar/code/moz/B2G/frameworks/base/media/libstagefright/include -I/Users/jlebar/code/moz/B2G/dalvik/libnativehelper/include/nativehelper -Wall -Wpointer-arith -Woverloaded-virtual -Werror=return-type -Wtype-limits -Wempty-body -Wno-ctor-dtor-privacy -Wno-overlength-strings -Wno-invalid-offsetof -Wno-variadic-macros -Wno-long-long -mandroid -fno-short-enums -fno-exceptions -Wno-psabi -mapcs-frame -fno-omit-frame-pointer -I/Users/jlebar/code/moz/B2G/ndk/sources/cxx-stl/stlport/stlport/ -I/Users/jlebar/code/moz/B2G/external/stlport/stlport/ -march=armv7-a -marm -mfpu=neon -mfloat-abi=softfp -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -std=gnu++0x -funwind-tables -fno-omit-frame-pointer -pipe -DNDEBUG -DTRIMMED -g -Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer -DANDROID -isystem /Users/jlebar/code/moz/B2G/bionic/libc/arch-arm/include -isystem /Users/jlebar/code/moz/B2G/bionic/libc/include/ -isystem /Users/jlebar/code/moz/B2G/bionic/libc/kernel/common -isystem /Users/jlebar/code/moz/B2G/bionic/libc/kernel/arch-arm -isystem /Users/jlebar/code/moz/B2G/bionic/libm/include -I/Users/jlebar/code/moz/B2G/frameworks/base/opengl/include -I/Users/jlebar/code/moz/B2G/frameworks/base/native/include -I/Users/jlebar/code/moz/B2G/hardware/libhardware/include -I/Users/jlebar/code/moz/B2G/hardware/libhardware_legacy/include -I/Users/jlebar/code/moz/B2G/system -I/Users/jlebar/code/moz/B2G/system/core/include -isystem /Users/jlebar/code/moz/B2G/bionic -I/Users/jlebar/code/moz/B2G/frameworks/base/include -I/Users/jlebar/code/moz/B2G/external/dbus -I/Users/jlebar/code/moz/B2G/external/bluetooth/bluez/lib -I/Users/jlebar/code/moz/B2G/frameworks/base/services/sensorservice -I/Users/jlebar/code/moz/B2G/frameworks/base/services/camera -I/Users/jlebar/code/moz/B2G/system/media/wilhelm/include -I/Users/jlebar/code/moz/B2G/frameworks/base/include/media/stagefright -I/Users/jlebar/code/moz/B2G/frameworks/base/include/media/stagefright/openmax -I/Users/jlebar/code/moz/B2G/frameworks/base/media/libstagefright/rtsp -I/Users/jlebar/code/moz/B2G/frameworks/base/media/libstagefright/include -I/Users/jlebar/code/moz/B2G/dalvik/libnativehelper/include/nativehelper -DMOZILLA_CLIENT -include ../../../mozilla-config.h -MD -MF .deps/GonkCaptureProvider.o.pp /Users/jlebar/code/moz/ff-git2/src/netwerk/protocol/device/GonkCaptureProvider.cpp
make[3]: *** [GonkCaptureProvider.o] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from ../../../../frameworks/base/include/utils/String16.h:23,
                 from ../../../../frameworks/base/include/binder/IBinder.h:23,
                 from ../../../../frameworks/base/include/binder/Binder.h:21,
                 from ../../../../frameworks/base/include/binder/IInterface.h:22,
                 from ../../../../frameworks/base/include/binder/IMemory.h:27,
                 from ../../../../../ff-git2/src/netwerk/protocol/device/GonkCaptureProvider.h:30,
                 from ../../../../../ff-git2/src/netwerk/protocol/device/nsDeviceChannel.cpp:18:
../../../../frameworks/base/include/utils/Unicode.h:25: error: redeclaration of C++ built-in type 'char32_t'
../../../../frameworks/base/include/utils/Unicode.h:26: error: redeclaration of C++ built-in type 'char16_t'
Summary: b2g builds fail with -std=gnu0x: frameworks/base/include/utils/Unicode.h:26: error: redeclaration of C++ built-in type 'char16_t' → b2g builds fail with -std=gnu++0x: frameworks/base/include/utils/Unicode.h:26: error: redeclaration of C++ built-in type 'char16_t'
So...what should we do here?  We can disable gnu++0x in gecko, but there's a lot of inertia towards C++11 at Mozilla.

Can we patch this file instead?

Unfortunately it seems like the right way to detect the existence of the char16_t type is in configure.  (You can either test for char16_t directly, or you can try to include <cuchar> and, if that exists, test for __STDC_UTF_16__ [1].)  I don't know how to do such a check in this file.

[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2018.html
#if __cplusplus < 201103L ?
(In reply to Mike Hommey [:glandium] from comment #2)
> #if __cplusplus < 201103L ?

#if __cplusplus < 201103L || !defined(__GXX_EXPERIMENTAL_CXX0X__)
(In reply to Mike Hommey [:glandium] from comment #3)
> (In reply to Mike Hommey [:glandium] from comment #2)
> > #if __cplusplus < 201103L ?
> 
> #if __cplusplus < 201103L || !defined(__GXX_EXPERIMENTAL_CXX0X__)

Sure, plus the relevant C hack, I can do that if we think that's OK.
(In reply to Justin Lebar [:jlebar] from comment #4)
> (In reply to Mike Hommey [:glandium] from comment #3)
> > (In reply to Mike Hommey [:glandium] from comment #2)
> > > #if __cplusplus < 201103L ?
> > 
> > #if __cplusplus < 201103L || !defined(__GXX_EXPERIMENTAL_CXX0X__)
> 
> Sure, plus the relevant C hack, I can do that if we think that's OK.

There's a non-ifdefed extern "C" in that file, and extern "C" is not valid in C.
mwu, how do we land this?  Should I fork the repository, or try to get it into caf, or what?
Flags: needinfo?(mwu)
> There's a non-ifdefed extern "C" in that file, and extern "C" is not valid in C.

Indeed; thanks!
We override android's Unicode.h with our copy at https://github.com/mozilla-b2g/gonk-misc/blob/master/Unicode.h
Flags: needinfo?(mwu)
That file already has the C++11 guards, so I'm clearly not using it...
Did you use a different mozconfig or modify the default one?
I modified the default one (gonk-misc/default-gecko-config).
Whatever you do, don't remove the $EXTRA_INCLUDE from this line -
export CXXFLAGS="-DMOZ_ENABLE_JS_DUMP $EXTRA_INCLUDE"
Oh, duh.  I did CXXFLAGS="..." instead of CXXFLAGS="$CXXFLAGS ...".

I'd even hit this once before.

Sorry, Mike.

Perhaps I should add a warning to the top/bottom of the mozconfig.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
Attachment #703688 - Flags: feedback?(mwu)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: