Bug 111115

Summary: -fvisibility, with some GCC's causes problems with STL pools due to missing visibility push/pop pragmas in STL includes
Product: arts Reporter: Iskren Stoyanov <i.stoyanov>
Component: generalAssignee: Stefan Westerfeld <stefan>
Status: RESOLVED FIXED    
Severity: grave CC: alexandergleich, anthony, belred, bjorn, bugskde, caleb, ciocile, dehaven-radio, firelight951, fpitt_83, geekboy, hephooey_dev, i.stoyanov, ibc, ivo, kdebugsystem, madman, maksim, marcelo, mschiff, mueller, nilsarne, nitro.120, pbernstein, post, raphink, rauge, raul.redondo, sdkovacs, sjnovick, stefan.asserhall, stefan.vunckx, steveahart, tdfischer, Timorgenius, vesa.hytonen
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: testcase sources + makefile

Description Iskren Stoyanov 2005-08-19 20:25:27 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 4.0.2 
OS:                Linux

My sound card is soundblaster live 24bit,i'm using alsa 1.0.9a.

here is the debug info:

Using host libthread_db library "/lib/tls/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1216502080 (LWP 6522)]
[KCrash handler]
#3  0xb7a7233e in __gnu_cxx::__pool<true>::_M_reclaim_block ()
   from /usr/lib/libstdc++.so.6
#4  0xb7fb21b7 in __gnu_cxx::__mt_alloc<std::string, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> >::deallocate (this=0xbf9f6e28, __p=0x81067b0, 
    __n=1) at mt_allocator.h:746
#5  0xb7fb21eb in std::_Vector_base<std::string, std::allocator<std::string> >::_M_deallocate (this=0xbf9f6e28, __p=0x81067b0, __n=1) at stl_vector.h:123
#6  0xb7fb2224 in ~_Vector_base (this=0xbf9f6e28) at stl_vector.h:109
#7  0xb7fb2290 in ~vector (this=0xbf9f6e28) at stl_vector.h:273
#8  0xb7fb22c8 in ~ObjectReference (this=0xbf9f6e1c) at core.h:117
#9  0xb7fa3883 in Arts::SoundServerStartup_base::_fromString (
    objectref=@0xbf9f6ed0) at soundserver.cc:2545
#10 0x08067ff1 in SoundServerStartup (this=0xbf9f6eb0, r=@0xbf9f6eb8)
    at soundserver.h:1376
#11 0x080676e8 in Arts::SoundServerStartup_impl::cleanReference (
    this=0x8163a08) at soundserverstartup_impl.cc:54
#12 0x08067819 in Arts::SoundServerStartup_impl::lock (this=0x8163a08)
    at soundserverstartup_impl.cc:78
#13 0x080637bd in Arts::SoundServerStartup::lock (this=0xbf9f7058)
    at soundserver.h:2082
#14 0x08062cf6 in main (argc=14, argv=0xbf9f7164) at artsd.cc:293
Comment 1 Iskren Stoyanov 2005-08-19 20:33:59 UTC
I forgot to mention arts version it is 1.5 from svn 
Comment 2 Stefan Gehn 2005-08-20 13:00:23 UTC
Try with a sane gcc version, that is 3.x.
Comment 3 Thiago Macieira 2005-09-27 02:41:05 UTC
*** Bug 113365 has been marked as a duplicate of this bug. ***
Comment 4 Maksim Orlovich 2005-10-20 16:23:27 UTC
*** Bug 114650 has been marked as a duplicate of this bug. ***
Comment 5 Maksim Orlovich 2005-10-20 16:24:51 UTC
*** Bug 113364 has been marked as a duplicate of this bug. ***
Comment 6 Maksim Orlovich 2005-10-20 16:25:06 UTC
*** Bug 114706 has been marked as a duplicate of this bug. ***
Comment 7 Maksim Orlovich 2005-10-20 16:27:11 UTC
mpyne and uga both confirmed it. I think this one is a showstopper, will try to get a test for this on the weekend
Comment 8 Thiago Macieira 2005-10-21 12:18:10 UTC
*** Bug 114802 has been marked as a duplicate of this bug. ***
Comment 9 Dirk Mueller 2005-10-21 13:38:09 UTC
which distribution do you use? please make your distribution vendor apply the patch from 

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19664

which adds visibility support to libstdc++. without that your toolchain is broken. 

Comment 10 Maksim Orlovich 2005-10-21 16:58:06 UTC
Dirk: kubuntu is one of the affected distros.
Comment 11 Maksim Orlovich 2005-10-22 06:46:57 UTC
Created attachment 13110 [details]
testcase sources + makefile

Here is a testcase for the problem. It is a bit brittle, as it relies on
non-public problems, but if someone can find a static inline function in the
STL that's spec-mandated, that can be fixed. I haven't fully confirmed this on
a patched system, though, posting it for a wider dessimination..
Comment 12 Maksim Orlovich 2005-10-22 06:59:45 UTC
I guess std::numeric_limits<short>::epsilon will do.
Comment 13 Maksim Orlovich 2005-10-23 06:33:23 UTC
*** Bug 114916 has been marked as a duplicate of this bug. ***
Comment 14 Scott 2005-10-23 07:20:12 UTC
I'd filed <a href="http://bugs.kde.org/show_bug.cgi?id=114916"><s>Bug 14196<s></a> which was apparantly a duplicate of this, however 10 minutes of searching failed to get me here, hence the duplicate

But I digress...

There's supposed to be a workaround here?

What is it?
Comment 15 Maksim Orlovich 2005-10-23 07:22:32 UTC
Sorry, thought it was here. Please see http://bugs.kde.org/show_bug.cgi?id=114650#c7
Comment 16 Maksim Orlovich 2005-10-25 22:09:54 UTC
*** Bug 115083 has been marked as a duplicate of this bug. ***
Comment 17 Dirk Mueller 2005-10-26 13:22:31 UTC
SVN commit 474432 by mueller:

disable -fvisibility=hidden for all those broken distro's out there
CCBUG: 111115


 M  +20 -1     acinclude.m4.in  


--- branches/KDE/3.4/kde-common/admin/acinclude.m4.in #474431:474432
@@ -3286,7 +3286,26 @@
 [
   AC_BEFORE([AC_PATH_QT_1_3], [KDE_ENABLE_HIDDEN_VISIBILITY])
 
+  AC_MSG_CHECKING([grepping for visibility push/pop in headers])
+
   if test "x$GXX" = "xyes"; then
+    AC_LANG_SAVE
+    AC_LANG_CPLUSPLUS
+    AC_EGREP_CPP(
+       [GCC visibility push],
+       [ #include <cassert> 
+       ], 
+    [
+      AC_MSG_RESULT(yes)
+      kde_stdc_visibility_patched=yes ],
+    [ 
+      AC_MSG_RESULT(no)
+      AC_MSG_WARN([Your libstdc++ doesn't appear to be patched for 
+                   visibility support. Disabling -fvisibility=hidden])
+
+      kde_stdc_visibility_patched=no ])
+    AC_LANG_RESTORE
+
     kde_have_gcc_visibility=no
     KDE_CHECK_COMPILER_FLAG(fvisibility=hidden, 
     [
@@ -3314,7 +3333,7 @@
         ]
       )
 
-      if test x$kde_cv_val_qt_gcc_visibility_patched = "xyes"; then
+      if test x$kde_stdc_visibility_patched = "xyes" && test x$kde_cv_val_qt_gcc_visibility_patched = "xyes"; then
         CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
         KDE_CHECK_VISIBILITY_GCC_BUG
         HAVE_GCC_VISIBILITY=1
Comment 18 Dirk Mueller 2005-10-26 13:23:01 UTC
SVN commit 474433 by mueller:

disable -fvisibility=hidden for all broken distro's out there
CCBUG: 111115


 M  +20 -1     acinclude.m4.in  


--- branches/KDE/3.5/kde-common/admin/acinclude.m4.in #474432:474433
@@ -3353,7 +3353,26 @@
 [
   AC_BEFORE([AC_PATH_QT_1_3], [KDE_ENABLE_HIDDEN_VISIBILITY])
 
+  AC_MSG_CHECKING([grepping for visibility push/pop in headers])
+
   if test "x$GXX" = "xyes"; then
+    AC_LANG_SAVE
+    AC_LANG_CPLUSPLUS
+    AC_EGREP_CPP(
+       [GCC visibility push],
+       [ #include <cassert> 
+       ], 
+    [
+      AC_MSG_RESULT(yes)
+      kde_stdc_visibility_patched=yes ],
+    [ 
+      AC_MSG_RESULT(no)
+      AC_MSG_WARN([Your libstdc++ doesn't appear to be patched for 
+                   visibility support. Disabling -fvisibility=hidden])
+
+      kde_stdc_visibility_patched=no ])
+    AC_LANG_RESTORE
+
     kde_have_gcc_visibility=no
     KDE_CHECK_COMPILER_FLAG(fvisibility=hidden, 
     [
@@ -3381,7 +3400,7 @@
         ]
       )
 
-      if test x$kde_cv_val_qt_gcc_visibility_patched = "xyes"; then
+      if test x$kde_stdc_visibility_patched = "xyes" && test x$kde_cv_val_qt_gcc_visibility_patched = "xyes"; then
         CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
         KDE_CHECK_VISIBILITY_GCC_BUG
         HAVE_GCC_VISIBILITY=1
Comment 19 Dirk Mueller 2005-10-26 13:24:59 UTC
SVN commit 474434 by mueller:

disable -fvisibility=hidden if distribution is broken
BUG: 111115


 M  +30 -8     acinclude.m4.in  


--- trunk/KDE/kde-common/admin/acinclude.m4.in #474433:474434
@@ -2997,16 +2997,38 @@
 [
   AC_REQUIRE([AC_PATH_QT])
 
+  AC_MSG_CHECKING([grepping for visibility push/pop in headers])
+
   if test "x$GXX" = "xyes"; then
+    AC_LANG_SAVE
+    AC_LANG_CPLUSPLUS
+    AC_EGREP_CPP(
+       [GCC visibility push],
+       [ #include <cassert> 
+       ], 
+    [
+      AC_MSG_RESULT(yes)
+      kde_stdc_visibility_patched=yes ],
+    [ 
+      AC_MSG_RESULT(no)
+      AC_MSG_WARN([Your libstdc++ doesn't appear to be patched for 
+                   visibility support. Disabling -fvisibility=hidden])
+
+      kde_stdc_visibility_patched=no ])
+    AC_LANG_RESTORE
+
     kde_have_gcc_visibility=no
-    KDE_CHECK_COMPILER_FLAG(fvisibility=hidden, 
-    [
-      kde_have_gcc_visibility=yes
-      CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
-      KDE_CHECK_VISIBILITY_GCC_BUG
-      HAVE_GCC_VISIBILITY=1
-      AC_DEFINE_UNQUOTED(__KDE_HAVE_GCC_VISIBILITY, "$HAVE_GCC_VISIBILITY", [define to 1 if -fvisibility is supported])
-    ])
+
+    if test x$kde_stdc_visibility_patched = xyes ; then 
+      KDE_CHECK_COMPILER_FLAG(fvisibility=hidden, 
+      [
+        kde_have_gcc_visibility=yes
+        CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
+        KDE_CHECK_VISIBILITY_GCC_BUG
+        HAVE_GCC_VISIBILITY=1
+        AC_DEFINE_UNQUOTED(__KDE_HAVE_GCC_VISIBILITY, "$HAVE_GCC_VISIBILITY", [define to 1 if -fvisibility is supported])
+      ])
+    fi
   fi
 ])
 
Comment 20 Dirk Mueller 2005-10-26 18:05:09 UTC
this is the upstream bug: 

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21243
Comment 21 Thiago Macieira 2005-10-29 15:17:44 UTC
*** Bug 115299 has been marked as a duplicate of this bug. ***
Comment 22 Maksim Orlovich 2005-10-31 14:49:24 UTC
*** Bug 115422 has been marked as a duplicate of this bug. ***
Comment 23 Maksim Orlovich 2005-10-31 17:02:13 UTC
*** Bug 115430 has been marked as a duplicate of this bug. ***
Comment 24 LuRan 2005-11-03 04:59:14 UTC
I have patch gcc for pr19664, but amarok still crash when startup, and the backtrack says:

Using host libthread_db library "/lib/libthread_db.so.1".
`system-supplied DSO at 0xffffe000' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread -1243863344 (LWP 27618)]
[KCrash handler]
#4  0x081baf40 in __gnu_cxx::__mt_alloc<PluginManager::StoreItem, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> >::allocate ()
#5  0x081bb44a in std::vector<PluginManager::StoreItem, std::allocator<PluginManager::StoreItem> >::_M_insert_aux ()
#6  0x081b9cf1 in PluginManager::createFromService ()
#7  0x0811edda in EngineController::loadEngine ()
#8  0x0811fab5 in EngineController::loadEngine ()
#9  0x0808d055 in App::applySettings ()
#10 0x0808fad8 in App::App ()
#11 0x082246c4 in main ()

Is this because a vector<mytype> bug which the export patch may introduced?
Comment 25 Maksim Orlovich 2005-11-04 03:07:19 UTC
*** Bug 115648 has been marked as a duplicate of this bug. ***
Comment 26 Thiago Macieira 2005-11-04 12:41:24 UTC
*** Bug 115655 has been marked as a duplicate of this bug. ***
Comment 27 Thiago Macieira 2005-11-06 19:05:34 UTC
*** Bug 115797 has been marked as a duplicate of this bug. ***
Comment 28 Thiago Macieira 2005-11-06 23:56:01 UTC
*** Bug 115825 has been marked as a duplicate of this bug. ***
Comment 29 Thiago Macieira 2005-11-08 02:55:03 UTC
*** Bug 115881 has been marked as a duplicate of this bug. ***
Comment 30 Maksim Orlovich 2005-11-09 01:17:02 UTC
*** Bug 115961 has been marked as a duplicate of this bug. ***
Comment 31 Thiago Macieira 2005-11-10 11:42:02 UTC
*** Bug 116041 has been marked as a duplicate of this bug. ***
Comment 32 Thiago Macieira 2005-11-11 02:12:48 UTC
*** Bug 114582 has been marked as a duplicate of this bug. ***
Comment 33 Thiago Macieira 2005-11-13 14:50:57 UTC
*** Bug 116221 has been marked as a duplicate of this bug. ***
Comment 34 Maksim Orlovich 2005-11-14 00:32:03 UTC
*** Bug 116283 has been marked as a duplicate of this bug. ***
Comment 35 Maksim Orlovich 2005-11-14 16:23:02 UTC
*** Bug 116352 has been marked as a duplicate of this bug. ***
Comment 36 Maksim Orlovich 2005-11-14 21:29:39 UTC
*** Bug 116373 has been marked as a duplicate of this bug. ***
Comment 37 Thiago Macieira 2005-11-15 01:19:02 UTC
*** Bug 116307 has been marked as a duplicate of this bug. ***
Comment 38 Tommi Tervo 2005-11-16 20:39:56 UTC
*** Bug 116515 has been marked as a duplicate of this bug. ***
Comment 39 Tommi Tervo 2005-11-16 20:42:03 UTC
*** Bug 116348 has been marked as a duplicate of this bug. ***
Comment 40 Tommi Tervo 2005-11-16 20:45:12 UTC
*** Bug 116459 has been marked as a duplicate of this bug. ***
Comment 41 Thiago Macieira 2005-11-24 06:33:37 UTC
*** Bug 116943 has been marked as a duplicate of this bug. ***
Comment 42 Tommi Tervo 2005-11-25 14:07:30 UTC
*** Bug 117058 has been marked as a duplicate of this bug. ***
Comment 43 Stephan Kulow 2005-11-25 14:56:39 UTC
*** Bug 117058 has been marked as a duplicate of this bug. ***
Comment 44 Maksim Orlovich 2005-11-28 22:19:57 UTC
*** Bug 117235 has been marked as a duplicate of this bug. ***
Comment 45 Maksim Orlovich 2005-11-30 02:29:53 UTC
*** Bug 117318 has been marked as a duplicate of this bug. ***
Comment 46 Tommi Tervo 2005-12-01 11:07:15 UTC
*** Bug 117350 has been marked as a duplicate of this bug. ***
Comment 47 Thiago Macieira 2005-12-02 21:39:39 UTC
*** Bug 117417 has been marked as a duplicate of this bug. ***
Comment 48 Thiago Macieira 2005-12-03 19:13:47 UTC
*** Bug 117606 has been marked as a duplicate of this bug. ***
Comment 49 Thiago Macieira 2005-12-12 03:31:43 UTC
*** Bug 118137 has been marked as a duplicate of this bug. ***
Comment 50 Thiago Macieira 2005-12-19 00:15:27 UTC
*** Bug 118607 has been marked as a duplicate of this bug. ***
Comment 51 Thiago Macieira 2005-12-19 03:52:45 UTC
*** Bug 118613 has been marked as a duplicate of this bug. ***
Comment 52 Thiago Macieira 2005-12-20 11:37:10 UTC
*** Bug 118685 has been marked as a duplicate of this bug. ***
Comment 53 Thiago Macieira 2006-01-31 18:39:24 UTC
*** Bug 120905 has been marked as a duplicate of this bug. ***
Comment 54 Tommi Tervo 2006-02-23 19:11:37 UTC
*** Bug 120541 has been marked as a duplicate of this bug. ***
Comment 55 Thiago Macieira 2006-02-26 02:22:52 UTC
*** Bug 122563 has been marked as a duplicate of this bug. ***
Comment 56 Philip Rodrigues 2006-09-19 17:45:54 UTC
*** Bug 117972 has been marked as a duplicate of this bug. ***
Comment 57 RĂ©mi Benoit 2014-05-08 11:01:54 UTC
*** Bug 117972 has been marked as a duplicate of this bug. ***