Closed Bug 416463 Opened 14 years ago Closed 14 years ago

Mozilla 1.8 fails to compile with gcc 4.3

Categories

(Core :: XPCOM, defect)

x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.9beta4

People

(Reporter: KaiE, Assigned: benjamin)

References

Details

(Keywords: fixed1.8.1.13)

Attachments

(1 file)

The latest nightly development version of Fedora (called Rawhide) fails to build the Mozilla 1.8 branch. I noticed this when trying to build SeaMonkey 1.1.8

The system uses gcc-Version 4.3.0 20080130 (Red Hat 4.3.0-0.7) (GCC)

rm -f libxpcom_compat_c.so
c++  -fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-long-long -pedantic -g -fshort-wchar -pthread -pipe  -DNDEBUG -DTRIMMED -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -fPIC -shared -Wl,-z,defs -Wl,-h,libxpcom_compat_c.so -o libxpcom_compat_c.so  nsXPCOMObsolete.o nsRegistry.o       -L../../../dist/bin -lxpcom -lxpcom_core  -L../../../dist/bin -L/lib -lplds4 -lplc4 -lnspr4 -lpthread -ldl -L../../../dist/lib -lxpcom_compat  -Wl,--version-script -Wl,../../../build/unix/gnu-ld-scripts/components-version-script -Wl,-Bsymbolic -ldl -lm   
nsXPCOMObsolete.o:(.data.rel.ro+0x18): undefined reference to `nsFileSpecImpl::Create(nsISupports*, nsID const&, void**)'
nsXPCOMObsolete.o:(.data.rel.ro+0x50): undefined reference to `nsDirectoryIteratorImpl::Create(nsISupports*, nsID const&, void**)'
/usr/bin/ld: libxpcom_compat_c.so: hidden symbol `nsFileSpecImpl::Create(nsISupports*, nsID const&, void**)' isn't defined
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
gmake[2]: *** [libxpcom_compat_c.so] Error 1
gmake[2]: Leaving directory `/builddir/build/BUILD/mozilla/xpcom/obsolete/component'
gmake[1]: *** [libs] Error 2
gmake[1]: Leaving directory `/builddir/build/BUILD/mozilla/xpcom/obsolete'
make: *** [libs] Error 2
For testing purposes I have downgraded to gcc 4.1.2, then it builds just fine.
FWIW, there are other moz bugs that are related to gcc 4.3, although they are about different failures: bug 409384, bug 411442
It appears that some sort of visibility problem has reappeared with gcc 4.3.

When I add
  ac_cv_visibility_pragma=no
to mozconfig, the build succeeds (at least it passes the reported failure, build still running).
Did this work with gcc 4.2, which added proper support for visibility pragmas?

Can I get you to
(cd xpcom/obsolete && make nsFileSpecImpl.i)
(cd xpcom/obsolete/component && make nsXPCOMObsolete.i)

and attach the two .i files? The NS_COM_OBSOLETE declaration on nsFileSpecImpl should cause the class member methods to be declared with external visibility, unless there is an overriding attribute on the method, which there shouldn't be for nsFileSpecImpl.
I think this was also broken in gcc 4.2, see Bug 410187. I duped this bug at that time to a invalid one, maybe that bug should then be re-duped to that one here (was the resolution invalid of Bug 386362 actually correct?).
Duplicate of this bug: 386362
Duplicate of this bug: 410187
(In reply to comment #5)
> Did this work with gcc 4.2, which added proper support for visibility pragmas?

Based on the dupes, no.

> Can I get you to ... attach the two .i files?

The files are big and bugzilla refused to attach the combined archive.
I've uploaded it here:
http://kuix.de/mozilla/416463i.tar.bz2

I still can't compile also 1.1.8 version with all gcc version I have installed (Debian testing)

cijoml@notas:~$ dpkg -l|grep gcc
ii  gcc                                  4:4.2.2-2                  The GNU C compiler
ii  gcc-3.3                              1:3.3.6-15                 The GNU C compiler
ii  gcc-3.3-base                         1:3.3.6-15                 The GNU Compiler Collection (base package)
ii  gcc-3.4                              3.4.6-6                    The GNU C compiler
ii  gcc-3.4-base                         3.4.6-6                    The GNU Compiler Collection (base package)
ii  gcc-4.1                              4.1.2-18                   The GNU C compiler
ii  gcc-4.1-base                         4.1.2-18                   The GNU Compiler Collection (base package)
ii  gcc-4.2                              4.2.2-7                    The GNU C compiler
ii  gcc-4.2-base                         4.2.2-7                    The GNU Compiler Collection (base package)
ii  gcc-4.3-base                         4.3-20080116-1             The GNU Compiler Collection (base package)
ii  libgcc1                              1:4.3-20080116-1           GCC support library

make[4]: Entering directory `/usr/src/seamonkey-1.1.8/content/canvas/src'
nsCanvasRenderingContext2D.cpp
c++ -o nsCanvasRenderingContext2D.o -c  -DMOZILLA_INTERNAL_API -DOSTYPE=\"Linux2.6\" -DOSARCH=\"Linux\" -DBUILD_ID=0000000000 -D_IMPL_NS_LAYOUT  -I../../../dist/include/xpcom -I../../../dist/include/string -I../../../dist/include/gfx -I../../../dist/include/layout -I../../../dist/include/widget -I../../../dist/include/dom -I../../../dist/include/js -I../../../dist/include/locale -I../../../dist/include/unicharutil -I../../../dist/include/webshell -I../../../dist/include/uriloader -I../../../dist/include/htmlparser -I../../../dist/include/necko -I../../../dist/include/view -I../../../dist/include/pref -I../../../dist/include/docshell -I../../../dist/include/xpconnect -I../../../dist/include/xuldoc -I../../../dist/include/caps -I../../../dist/include/editor -I../../../dist/include/imglib2 -I../../../dist/include/mimetype -I../../../dist/include/exthandler -I../../../dist/include/uconv -I../../../dist/include/intl -I../../../dist/include/plugin -I../../../dist/include/cairo -I../../../dist/include/libpixman -I../../../dist/include/content -I../../../dist/include -I../../../dist/include/nspr    -I../../../dist/sdk/include    -fPIC   -fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-long-long -fshort-wchar -pthread -pipe  -DNDEBUG -DTRIMMED -ffunction-sections -march=pentium4 -mfpmath=sse -O2 -I../../../dist/include/cairo -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/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12     -DMOZILLA_CLIENT -include ../../../mozilla-config.h -Wp,-MD,.deps/nsCanvasRenderingContext2D.pp nsCanvasRenderingContext2D.cpp
make[4]: c++: Command not found
make[4]: *** [nsCanvasRenderingContext2D.o] Error 127
make[4]: Leaving directory `/usr/src/seamonkey-1.1.8/content/canvas/src'
make[3]: *** [libs] Error 2
make[3]: Leaving directory `/usr/src/seamonkey-1.1.8/content/canvas'
make[2]: *** [libs] Error 2
make[2]: Leaving directory `/usr/src/seamonkey-1.1.8/content'
make[1]: *** [tier_9] Error 2
make[1]: Leaving directory `/usr/src/seamonkey-1.1.8'
make: *** [default] Error 2
Sorry wrong output because I was playing with all those compilers:

make[4]: Entering directory `/usr/src/seamonkey-1.1.8/content/canvas/src'
nsCanvasRenderingContext2D.cpp
c++ -o nsCanvasRenderingContext2D.o -c  -DMOZILLA_INTERNAL_API -DOSTYPE=\"Linux2.6\" -DOSARCH=\"Linux\" -DBUILD_ID=0000000000 -D_IMPL_NS_LAYOUT  -I../../../dist/include/xpcom -I../../../dist/include/string -I../../../dist/include/gfx -I../../../dist/include/layout -I../../../dist/include/widget -I../../../dist/include/dom -I../../../dist/include/js -I../../../dist/include/locale -I../../../dist/include/unicharutil -I../../../dist/include/webshell -I../../../dist/include/uriloader -I../../../dist/include/htmlparser -I../../../dist/include/necko -I../../../dist/include/view -I../../../dist/include/pref -I../../../dist/include/docshell -I../../../dist/include/xpconnect -I../../../dist/include/xuldoc -I../../../dist/include/caps -I../../../dist/include/editor -I../../../dist/include/imglib2 -I../../../dist/include/mimetype -I../../../dist/include/exthandler -I../../../dist/include/uconv -I../../../dist/include/intl -I../../../dist/include/plugin -I../../../dist/include/cairo -I../../../dist/include/libpixman -I../../../dist/include/content -I../../../dist/include -I../../../dist/include/nspr    -I../../../dist/sdk/include    -fPIC   -fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-long-long -fshort-wchar -pthread -pipe  -DNDEBUG -DTRIMMED -ffunction-sections -march=pentium4 -mfpmath=sse -O2 -I../../../dist/include/cairo -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/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12     -DMOZILLA_CLIENT -include ../../../mozilla-config.h -Wp,-MD,.deps/nsCanvasRenderingContext2D.pp nsCanvasRenderingContext2D.cpp
In file included from ../../../dist/include/xpconnect/nsIXPConnect.h:54,
                 from ../../../dist/include/xpconnect/nsIXPCScriptable.h:14,
                 from ../../../dist/include/dom/nsIDOMClassInfo.h:376,
                 from ../../../dist/include/dom/nsIDOMScriptObjectFactory.h:42,
                 from ../../../dist/include/content/nsContentUtils.h:47,
                 from nsCanvasRenderingContext2D.cpp:47:
../../../dist/include/xpcom/xptinfo.h: In member function 'const nsXPTCMiniVariant* nsXPTConstant::GetValue() const':
../../../dist/include/xpcom/xptinfo.h:258: warning: type-punning to incomplete type might break strict-aliasing rules
In file included from ../../../dist/include/layout/nsStyleStruct.h:42,
                 from ../../../dist/include/layout/nsIFrame.h:49,
                 from ../../../dist/include/content/nsICanvasElement.h:42,
                 from ../../../dist/include/content/nsICanvasRenderingContextInternal.h:42,
                 from nsCanvasRenderingContext2D.cpp:52:
../../../dist/include/gfx/nsCoord.h: In function 'float NS_IEEEPositiveInfinity()':
../../../dist/include/gfx/nsCoord.h:65: warning: dereferencing type-punned pointer will break strict-aliasing rules
../../../dist/include/gfx/nsCoord.h: In function 'PRBool NS_IEEEIsNan(float)':
../../../dist/include/gfx/nsCoord.h:69: warning: dereferencing type-punned pointer will break strict-aliasing rules
In file included from ../../../dist/include/layout/nsPresContext.h:46,
                 from ../../../dist/include/layout/nsStyleStruct.h:50,
                 from ../../../dist/include/layout/nsIFrame.h:49,
                 from ../../../dist/include/content/nsICanvasElement.h:42,
                 from ../../../dist/include/content/nsICanvasRenderingContextInternal.h:42,
                 from nsCanvasRenderingContext2D.cpp:52:
../../../dist/include/layout/nsIPresShell.h: In member function 'nsFrameManager* nsIPresShell::FrameManager() const':
../../../dist/include/layout/nsIPresShell.h:190: warning: type-punning to incomplete type might break strict-aliasing rules
In file included from ../../../dist/include/layout/nsStyleContext.h:43,
                 from ../../../dist/include/layout/nsIFrame.h:50,
                 from ../../../dist/include/content/nsICanvasElement.h:42,
                 from ../../../dist/include/content/nsICanvasRenderingContextInternal.h:42,
                 from nsCanvasRenderingContext2D.cpp:52:
../../../dist/include/layout/nsRuleNode.h: In member function 'nsRuleList** nsRuleNode::ChildrenListPtr()':
../../../dist/include/layout/nsRuleNode.h:356: warning: dereferencing type-punned pointer will break strict-aliasing rules
In file included from /usr/include/gtk-2.0/gdk/gdkcairo.h:25,
                 from /usr/include/gtk-2.0/gdk/gdk.h:30,
                 from nsCanvasRenderingContext2D.cpp:147:
/usr/include/pango-1.0/pango/pangocairo.h: At global scope:
/usr/include/pango-1.0/pango/pangocairo.h:71: error: 'cairo_font_type_t' was not declared in this scope
/usr/include/pango-1.0/pango/pangocairo.h:73: error: 'cairo_font_type_t' does not name a type
nsCanvasRenderingContext2D.cpp: In member function 'virtual nsresult nsCanvasRenderingContext2D::Render(nsIRenderingContext*)':
nsCanvasRenderingContext2D.cpp:951: warning: dereferencing type-punned pointer will break strict-aliasing rules
nsCanvasRenderingContext2D.cpp: In member function 'nsresult nsCanvasRenderingContext2D::DrawNativeSurfaces(nsIDrawingSurface*, nsIDrawingSurface*, const nsIntSize&, nsIRenderingContext*)':
nsCanvasRenderingContext2D.cpp:2804: warning: dereferencing type-punned pointer will break strict-aliasing rules
../../../dist/include/xpcom/nsAutoPtr.h: In member function 'void** nsAutoArrayPtr<T>::begin_assignment() [with T = unsigned char]':
../../../dist/include/xpcom/nsAutoPtr.h:650:   instantiated from 'T** nsAutoArrayPtr<T>::StartAssignment() [with T = unsigned char]'
../../../dist/include/xpcom/nsAutoPtr.h:725:   instantiated from 'nsAutoArrayPtrGetterTransfers<T>::operator T**() [with T = unsigned char]'
nsCanvasRenderingContext2D.cpp:2796:   instantiated from here
../../../dist/include/xpcom/nsAutoPtr.h:505: warning: dereferencing type-punned pointer will break strict-aliasing rules
nsCanvasRenderingContext2D.cpp: At global scope:
nsCanvasRenderingContext2D.cpp:198: warning: 'PRBool FloatValidate(double, double, double)' defined but not used
make[4]: *** [nsCanvasRenderingContext2D.o] Error 1
make[4]: Leaving directory `/usr/src/seamonkey-1.1.8/content/canvas/src'
make[3]: *** [libs] Error 2
make[3]: Leaving directory `/usr/src/seamonkey-1.1.8/content/canvas'
make[2]: *** [libs] Error 2
make[2]: Leaving directory `/usr/src/seamonkey-1.1.8/content'
make[1]: *** [tier_9] Error 2
make[1]: Leaving directory `/usr/src/seamonkey-1.1.8'
make: *** [default] Error 2
Misan, you did not say which compiler you used for comment 11, but I think it is something else. The error is:
/usr/include/pango-1.0/pango/pangocairo.h:71: error: 'cairo_font_type_t' was
not declared in this scope
/usr/include/pango-1.0/pango/pangocairo.h:73: error: 'cairo_font_type_t' does
not name a type

I ran into that failure, too, and I fixed it for me by using --enable-system-cairo.

Can you please use attachments for big blocks of text? Thanks :-)
This is my configure:

./configure --with-x --disable-tests --enable-safe-browsing --enable-storage --enable-url-classifier --enable-svg --enable-
xft --enable-crypto --enable-xinerama --disable-debug --enable-optimize="-march=pentium4 -mfpmath=sse -O2" --disable-loggin
g --enable-reorder --enable-strip --enable-timeline --enable-xterm-updates --disable-pedantic --enable-application=suite
(In reply to comment #13)
> This is my configure:
> 
> ./configure --with-x --disable-tests --enable-safe-browsing --enable-storage
> --enable-url-classifier --enable-svg --enable-
> xft --enable-crypto --enable-xinerama --disable-debug
> --enable-optimize="-march=pentium4 -mfpmath=sse -O2" --disable-loggin
> g --enable-reorder --enable-strip --enable-timeline --enable-xterm-updates
> --disable-pedantic --enable-application=suite

... which does not contain the --enable-system-cairo that I propose in comment 12 ...


The error listed in comment 11 and comment 12 is something else.
It's a msising symbol.
This is a configuration problem of library versions.
It's NOT a compiler bug.

If you disagree, please file a separate bug.
I believe this bug is being caused by an extra copy of nsFileSpecImpl.{h,cpp}

Kai, could I get you to remove xpcom/obsolete/component/nsFileSpecImpl.{h,cpp} from your source directory and rebuild?
(In reply to comment #15)
> I believe this bug is being caused by an extra copy of nsFileSpecImpl.{h,cpp}
> 
> Kai, could I get you to remove xpcom/obsolete/component/nsFileSpecImpl.{h,cpp}
> from your source directory and rebuild?


You found the bug.

After I removed those files the build completes fine.
This patch merely removes the following files:
xpcom/obsolete/component/nsFileSpecImpl.h
xpcom/obsolete/component/nsIRegistry.idl
xpcom/obsolete/component/nsIRegistryUtils.h
xpcom/obsolete/component/regExport.cpp
Assignee: nobody → benjamin
Status: NEW → ASSIGNED
Attachment #303263 - Flags: review?(ted.mielczarek)
Attachment #303263 - Flags: approval1.8.1.13?
Attachment #303263 - Flags: review?(ted.mielczarek) → review+
I landed this on trunk, because even though Firefox doesn't build xpcom-obsolete any more I think seamonkey/thunderbird still do. So marking FIXED, and we'll track the branch resolution with keywords.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment on attachment 303263 [details] [diff] [review]
Remove duplicated or unnecessary files, rev. 1

How can you remove these files without taking references out of a makefile somewhere, or, if they're not mentioned in the makefile how are they getting mixed up in a build?
nsFileSpecImpl.h is contained in both xpcom/obsolete and xpcom/obsolete/component. The xpcom/obsolete version is the "correct" one that is being sent to dist/include and so forth. the xpcom/obsolete/component one is only being picked up by nsXPCOMObsolete.cpp because it uses #include "nsFileSpecImpl.h" which prefers the source directory over -I flags.

Otherwise these files were unused and should never have existed.
Comment on attachment 303263 [details] [diff] [review]
Remove duplicated or unnecessary files, rev. 1

approved for 1.8.1.13, a=dveditz for release-drivers
Attachment #303263 - Flags: approval1.8.1.13? → approval1.8.1.13+
Keywords: checkin-needed
Removing xpcom/obsolete/component/nsFileSpecImpl.cpp;
/cvsroot/mozilla/xpcom/obsolete/component/Attic/nsFileSpecImpl.cpp,v  <--  nsFileSpecImpl.cpp
new revision: delete; previous revision: 1.2
done
Removing xpcom/obsolete/component/nsFileSpecImpl.h;
/cvsroot/mozilla/xpcom/obsolete/component/Attic/nsFileSpecImpl.h,v  <--  nsFileSpecImpl.h
new revision: delete; previous revision: 1.3
done
Removing xpcom/obsolete/component/nsIRegistry.idl;
/cvsroot/mozilla/xpcom/obsolete/component/Attic/nsIRegistry.idl,v  <--  nsIRegistry.idl
new revision: delete; previous revision: 1.2
done
Removing xpcom/obsolete/component/nsIRegistryUtils.h;
/cvsroot/mozilla/xpcom/obsolete/component/Attic/nsIRegistryUtils.h,v  <--  nsIRegistryUtils.h
new revision: delete; previous revision: 1.2
done
Removing xpcom/obsolete/component/regExport.cpp;
/cvsroot/mozilla/xpcom/obsolete/component/Attic/regExport.cpp,v  <--  regExport.cpp
new revision: delete; previous revision: 1.2
done
Target Milestone: --- → mozilla1.9beta4
Thanks!  I can build Thunderbird 2.0.0.12 now!
Mark, have you done a test compilation to make sure it all works now with gcc 4.3?
Is this fix likely to make it into a tarball anytime soon?
There are tarballs for each release, so any of the 2.0.0.13 tarballs would have it.
Status: RESOLVED → VERIFIED
Ah, so maybe it's a new bug or a return of this bug that I'm experiencing. I am using the latest 2.0.0.13 tarball (in GNOME's jhbuild on Ubuntu Hardy). The patch seemed to help but still left "undefined reference to `inflateInit_" build errors. Nevermind.
You need to log in before you can comment on or make changes to this bug.