Last Comment Bug 654493 - error: cannot use typeid with -fno-rtti when building with gcc 4.4
: error: cannot use typeid with -fno-rtti when building with gcc 4.4
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Build Config (show other bugs)
: Trunk
: All Linux
: -- normal (vote)
: mozilla6
Assigned To: Mike Hommey [:glandium]
:
:
Mentors:
Depends on:
Blocks: 650304 1261263
  Show dependency treegraph
 
Reported: 2011-05-03 10:53 PDT by Mike Hommey [:glandium]
Modified: 2016-03-31 19:03 PDT (History)
5 users (show)
bzbarsky: in‑testsuite?
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Detect gcc c++0x headers brokenness and don't use -std=gnu++0x then (2.88 KB, patch)
2011-05-03 10:53 PDT, Mike Hommey [:glandium]
benjamin: review+
Details | Diff | Splinter Review

Description Mike Hommey [:glandium] 2011-05-03 10:53:53 PDT
Created attachment 529755 [details] [diff] [review]
Detect gcc c++0x headers brokenness and don't use -std=gnu++0x then

As reported by bsmedberg on irc:

c++ -o crashreporter.o -c  -I../../../dist/system_wrappers -include ../../../../src/config/gcc_hidden.h -DOSTYPE=\"Linux2.6.34.7-61.fc13\" -DOSARCH=Linux -I../../../../src/toolkit/crashreporter/client/../google-breakpad/src -I../../../../src/toolkit/crashreporter/client -I../../../../src/toolkit/crashreporter/client -I. -I../../../dist/include -I../../../dist/include/nsprpub  -I/builds/mozilla-central/ff-debug/dist/include/nspr -I/builds/mozilla-central/ff-debug/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 -std=gnu++0x -pthread -pipe -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/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/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gtk-unix-print-2.0   -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include    -DDEBUG -D_DEBUG -DTRACING -g   -DMOZILLA_CLIENT -include ../../../mozilla-config.h -MD -MF .deps/crashreporter.pp /builds/mozilla-central/src/toolkit/crashreporter/client/crashreporter.cpp
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/memory:84,
                 from ../../../dist/system_wrappers/memory:4,
                 from /builds/mozilla-central/src/toolkit/crashreporter/client/crashreporter.cpp:50:
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/bits/shared_ptr.h: In member function ‘virtual void* std::_Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp>::_M_get_deleter(const std::type_info&)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/bits/shared_ptr.h:146: error: cannot use typeid with -fno-rtti
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/bits/shared_ptr.h: In member function ‘virtual void* std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_M_get_deleter(const std::type_info&)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/bits/shared_ptr.h:204: error: cannot use typeid with -fno-rtti
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/memory:84,
                 from ../../../dist/system_wrappers/memory:4,
                 from /builds/mozilla-central/src/toolkit/crashreporter/client/crashreporter.cpp:50:
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/bits/shared_ptr.h: In constructor ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_make_shared_tag, _Alloc, _Args&& ...)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/bits/shared_ptr.h:861: error: cannot use typeid with -fno-rtti
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/bits/shared_ptr.h: In function ‘_Del* std::get_deleter(const std::__shared_ptr<_Tp2, _Lp>&)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/bits/shared_ptr.h:1005: error: cannot use typeid with -fno-rtti
make[1]: *** [crashreporter.o] Error 1
make[1]: Leaving directory `/builds/mozilla-central/ff-debug/toolkit/crashreporter/client'
make: *** [libs] Error 2

gcc 4.4 c++0x headers are actually broken in that they require rtti. It's not the case on gcc 4.5.
Comment 1 Benoit Jacob [:bjacob] (mostly away) 2011-05-04 05:58:15 PDT
Thanks for the fix; fwiw I then also get another compilation error with gcc 4.4:

In file included from /home/bjacob/mozilla-central/xpcom/string/src/nsSubstring.cpp:55:
../../../dist/include/nsStaticAtom.h:48: error: ‘char16_t’ does not name a type
In file included from /home/bjacob/mozilla-central/xpcom/string/src/nsSubstring.cpp:55:
../../../dist/include/nsStaticAtom.h:76: error: ‘nsStaticAtomStringType’ does not name a type
Comment 2 Mike Hommey [:glandium] 2011-05-04 06:15:57 PDT
(In reply to comment #1)
> Thanks for the fix; fwiw I then also get another compilation error with gcc
> 4.4:
> 
> In file included from
> /home/bjacob/mozilla-central/xpcom/string/src/nsSubstring.cpp:55:
> ../../../dist/include/nsStaticAtom.h:48: error: ‘char16_t’ does not name a type
> In file included from
> /home/bjacob/mozilla-central/xpcom/string/src/nsSubstring.cpp:55:
> ../../../dist/include/nsStaticAtom.h:76: error: ‘nsStaticAtomStringType’ does
> not name a type

try removing config.cache before running configure.
Comment 3 Benjamin Smedberg [:bsmedberg] 2011-05-04 07:41:58 PDT
Comment on attachment 529755 [details] [diff] [review]
Detect gcc c++0x headers brokenness and don't use -std=gnu++0x then

This works locally and appears to be correct.
Comment 4 Benoit Jacob [:bjacob] (mostly away) 2011-05-04 07:54:36 PDT
(In reply to comment #2)
> (In reply to comment #1)
> try removing config.cache before running configure.

Thanks, this worked.
Comment 5 Nicholas Nethercote [:njn] 2011-05-04 22:50:55 PDT
I too hit this problem.  The patch fixed it for me, thanks Mike.
Comment 6 Boris Zbarsky [:bz] (still a bit busy) 2011-05-05 13:39:55 PDT
http://hg.mozilla.org/mozilla-central/rev/790f42440904
Comment 7 George R. Goffe 2012-01-10 13:14:46 PST
Hi, 

I just did an update to both my firefox and seamonkey beta-src directories and both have failed with this GCC flag "-fno-rtti" in /beta-src/toolkit/crashreporter/client/crashreporter.cpp. GCC versions are "gcc-4.4.real (Ubuntu 4.4.3-4ubuntu5) 4.4.3" AND "gcc (GCC) 4.7.0 20120110 (experimental)".

I would have thought that the patch would be integrated by now. Am I doing something wrong?

Is there a command to query what version/revision/trunk I'm using?

Thanks,

George...
Comment 8 George R. Goffe 2012-02-01 16:17:58 PST
Hi,

I'm still getting this error so it looks like the bug is NOT fixed.

Is anyone working on this? Looking at this?

George...

Note You need to log in before you can comment on or make changes to this bug.