Closed Bug 645469 Opened 13 years ago Closed 13 years ago

[gcc 4.6] Build process is broken while working on embedding/browser/gtk/src/EmbedPrivate.cpp

Categories

(Core :: General, defect)

x86_64
Linux
defect
Not set
critical

Tracking

()

RESOLVED DUPLICATE of bug 623126

People

(Reporter: fredbezies, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:2.2a1pre) Gecko/20100101 Firefox/4.2a1pre
Build Identifier: 

As of today, archlinux (using testing repository) give access to gcc 4.6

Build process goes well until embedding/browser/gtk/src/EmbedPrivate.cpp is processed.

An uninitialized const ‘kDirectoryProvider’ stops building process immediately.

Reproducible: Always

Steps to Reproduce:
1.Have a clean and up to date source code
2.Build it using gcc 4.6
3.wait until embedding/browser/gtk/src/EmbedPrivate.cpp is processed
Actual Results:  
Build process is broken.

Expected Results:  
Going on and finish build process ?

.mozconfig used :

#
# See http://www.mozilla.org/build/ for build instructions.
#

export AUTOCONF=autoconf-2.13

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../objdir-fx
mk_add_options MOZ_MAKE_FLAGS=-j4

# Options for ‘configure’ (same as command-line options).
ac_add_options --enable-application=browser
ac_add_options --enable-optimize
ac_add_options --disable-debug
ac_add_options --disable-tests
ac_add_options --disable-crashreporter
ac_add_options --with-ccache

Will add error log asap.
Error log :

EmbedWindowCreator.cpp
/home/fred/logs/fox/src/embedding/browser/gtk/src/EmbedPrivate.cpp:107:40: erreur: uninitialized const ‘kDirectoryProvider’ [-fpermissive]
/home/fred/logs/fox/src/embedding/browser/gtk/src/EmbedPrivate.cpp:99:7: note: ‘const class GTKEmbedDirectoryProvider’ has no user-provided default constructor

In the directory  /home/fred/logs/fox/objdir-fx/embedding/browser/gtk/src
The following command failed to execute properly:
/usr/bin/ccache c++ -o EmbedPrivate.o -c -I../../../../dist/stl_wrappers -I../../../../dist/system_wrappers -include /home/fred/logs/fox/src/config/gcc_hidden.h -DIMPL_XREAPI -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 -DOSTYPE="Linux2.6" -DOSARCH=Linux -D_IMPL_GTKMOZEMBED -I. -I/home/fred/logs/fox/src/embedding/browser/gtk/src -I. -I../../../../dist/include -I../../../../dist/include/nsprpub -I/home/fred/logs/fox/objdir-fx/dist/include/nspr -I/home/fred/logs/fox/objdir-fx/dist/include/nss -fPIC -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -pedantic -Wno-long-long -fno-strict-aliasing -fshort-wchar -pthread -pipe -DNDEBUG -DTRIMMED -g -Os -freorder-blocks -fomit-frame-pointer -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng14 -I/usr/include/gtk-unix-print-2.0 -DMOZILLA_CLIENT -include ../../../../mozilla-config.h -MD -MF .deps/EmbedPrivate.pp /home/fred/logs/fox/src/embedding/browser/gtk/src/EmbedPrivate.cpp
there are more places that are affected. i got it in:

c++ -o nsIInterfaceRequestorUtils.o -c -I../../dist/stl_wrappers -I../../dist/system_wrappers -include /build/src/mozilla-2.0/config/gcc_hidden.h -DOSTYPE=\"Linux2.6\" -DOSARCH=Linux -DTARGET_XPCOM_ABI=\"x86_64-gcc3\" -I/build/src/mozilla-2.0/xpcom/glue/../build  -I/build/src/mozilla-2.0/xpcom/glue -I. -I../../dist/include -I../../dist/include/nsprpub  -I/usr/include/nspr -I/usr/include/nss       -fPIC  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -fno-strict-aliasing -fshort-wchar -pthread -pipe  -DNDEBUG -DTRIMMED -Os -freorder-blocks -fomit-frame-pointer    -DMOZILLA_CLIENT -include ../../mozilla-config.h -MD -MF .deps/nsIInterfaceRequestorUtils.pp /build/src/mozilla-2.0/xpcom/glue/nsIInterfaceRequestorUtils.cpp
/build/src/mozilla-2.0/xpcom/glue/nsEnumeratorUtils.cpp:115:27: error: uninitialized const 'EmptyEnumeratorImpl::kInstance' [-fpermissive]
/build/src/mozilla-2.0/xpcom/glue/nsEnumeratorUtils.cpp:50:7: note: 'const class EmptyEnumeratorImpl' has no user-provided default constructor
On archlinux bugtracker, Rémy Oudompheng give an idea to workaround this (I'm testing this right now) :

"Probably related to "G++ no longer allows objects of const-qualified type to be default initialized unless the type has a user-declared default constructor." in latest GCC changes. g++ has become more strict in its checking, add -fpermissive to your CXXFLAGS to work around this."

Added this to .mozconfig :

export CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fpermissive"

I will see if it could go well or not.
It worked, but it is a workaround. The real answer will be to fix source code, or am I wrong ?
You are correct. Fixing the code is simple:

const EmptyEnumeratorImpl EmptyEnumeratorImpl::kInstance = EmptyEnumeratorImpl();
and for the first failure:

static const GTKEmbedDirectoryProvider kDirectoryProvider
    = GTKEmbedDirectoryProvider();
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.