Bug 109386

Summary: Qt's Q_EXPORT macro does not support gcc's -fvisibility
Product: [Unmaintained] kdelibs Reporter: Dirk Mueller <mueller>
Component: qtAssignee: Dirk Mueller <mueller>
Status: RESOLVED FIXED    
Severity: wishlist CC: aliakc, carstenlohrke, chrsmrtn, diegoliz, flameeyes, greg_g, ismail, jlp, mattr, nicolasg, pluto, prigault, rdieter, stefan.vunckx, thiago
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: patch v1
config.log for kdebase
Re-arrange the test for hidden visibility
Re-arrange the test for hidden visibility
Extended patch for reduces symbols for libqt-mt itself
Kooka failure log
kontact-backtrace
backtrace of kmail crash when sending out mail
Add exports reported by Diego Pettenò (use at own risk :)

Description Dirk Mueller 2005-07-20 14:46:06 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 4.0.1 
OS:                Linux

This is a metabug tracking the latest visibility support patch for Qt 3.3.x, to be submitted to Trolltech and included in their next maintenance release when ready.
Comment 1 Dirk Mueller 2005-07-20 17:47:04 UTC
Created attachment 11861 [details]
patch v1
Comment 2 Jure Repinc 2005-07-21 02:13:12 UTC
I downloaded this patch, applied it to qt-copy and recompiled qt-copy. But when I try to configure kdebase I still get the message:

Your GCC supports symbol visibility, but the patch for Qt supporting visibility
was not included. Therefore, GCC symbol visibility support remains disabled.

For better performance, consider including the Qt visibility supporting patch
located at:

http://bugs.kde.org/show_bug.cgi?id=109386

and recompile all of Qt and KDE. Note, this is entirely optional and
everything will continue to work just fine without it.

Configuring and compiling arts and kdelibs did not give this message.
Comment 3 Dirk Mueller 2005-07-21 04:30:12 UTC
can't reproduce. can you attach your config.log please? you also want to make sure that your admin/ dir is up to date in kdebase and that you did run make -f Makefile.cvs first. 

Comment 4 Jure Repinc 2005-07-21 09:56:57 UTC
Created attachment 11863 [details]
config.log for kdebase

This is the config.log as requested. Before compiling I did "svn up kdebase"
and my build script does habe make -f Makefile.cvs. I also tried on another
computer and I hot the same message.
Comment 5 Jure Repinc 2005-07-22 13:36:33 UTC
After applying this patch I have similar problems compiling kdeedu:

./QueryDlgBase.moc:106: multiple definition of `QueryDlgBase::sigEditEntry(int, int)'
./query-dialogs/.libs/libquerydlg.a(QueryDlgBase.moc.o):/home/kdedev/src/kde/build/kdeedu/kvoctrain/kvoctrain/query-dialogs/QueryDlgBase.moc.cpp:106: first defined here
./query-dialogs/.libs/libquerydlg.a(QueryDlgBase.o): In function `QueryDlgBase::qt_static_property(QObject*, int, int, QVariant*)':
./QueryDlgBase.moc:140: multiple definition of `QueryDlgBase::qt_static_property(QObject*, int, int, QVariant*)'
./query-dialogs/.libs/libquerydlg.a(QueryDlgBase.moc.o):/home/kdedev/src/kde/build/kdeedu/kvoctrain/kvoctrain/query-dialogs/QueryDlgBase.moc.cpp:140: first defined here
collect2: ld returned 1 exit status
make[4]: *** [kvoctrain] Error 1
make[4]: Leaving directory `/home/kdedev/src/kde/build/kdeedu/kvoctrain/kvoctrain'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/kdedev/src/kde/build/kdeedu/kvoctrain/kvoctrain'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/kdedev/src/kde/build/kdeedu/kvoctrain'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/kdedev/src/kde/build/kdeedu'
make: *** [all] Error 2

a similar thing happens with Kopete Jabber compile.

Is this just a coincidence or is it really this patch that causes these problems?
Comment 6 Philippe Rigault 2005-07-23 18:51:02 UTC
I got the same as in comment#2

=============== configure output ==================
<snip>
checking whether g++ supports -fvisibility=hidden... yes
checking if Qt is patched for -fvisibility... no
<snip>

Your GCC supports symbol visibility, but the patch for Qt supporting visibility
was not included. Therefore, GCC symbol visibility support remains disabled.

===================================================

This is because the patch above only defines Q_EXPORT only for gcc >= 4.0 and I use GCC-3.4.3-22.fc3.
Why test only gcc >= 4.0 ?
Comment 7 Matt Rogers 2005-07-23 19:05:54 UTC
because GCC >= 4.0 is the first compiler to support visibility correctly. The 3.4.x compilers that have visibility support are just too buggy.
Comment 8 Jure Repinc 2005-07-23 19:28:46 UTC
Thanks for the explanation Matt. So it is best to just not use this visibility support on systems where you use GCC 3.3 or 3.4 and only patch on systems with 4.0. Maybe this is why I get some compiling problems on my system.
Comment 9 Philippe Rigault 2005-07-23 20:06:10 UTC
>Thanks for the explanation Matt.
... or lack thereof. I find "just too buggy" a little lacking in details, one might also say "buggy but not so much as being blacklisted" ;-)

GCC-3.4.x does have more limited support for visibility (especially with regard to the -fvisibility-inlines-hidden flag), but at least it compiles KDE fine using the right visibility flags (tested on 3.4.0 and 3.4.1 with gcc-3.4.2.fc3 and 3.4.3.fc3)

>So it is best to just not use this visibility support on systems where you
> use GCC 3.3 or 3.4 and only patch on systems with 4.0
'configure' takes care of this for you, it will disable -fvisibility options for gcc 3.x.

Your compiler errors don't look as if they are linked to this.
Comment 10 Szombathelyi György 2005-07-28 00:35:45 UTC
I encountered a problem with the visibility check for Qt
The source code snippet which checks if the Q_EXPORT macro is defined includes 
<qglobal.h>. But this should be done _after_ the QT lib checks. Now every 
test for the visibility-enabled QT is positive, since the test program aborts 
with the error that qglobal.h not found.
I'll post 2 patches for arts and kdelibs, but all modules needs similar solution, I think.
Comment 11 Szombathelyi György 2005-07-28 00:36:58 UTC
Created attachment 11958 [details]
Re-arrange the test for hidden visibility
Comment 12 Szombathelyi György 2005-07-28 00:37:20 UTC
Created attachment 11959 [details]
Re-arrange the test for hidden visibility
Comment 13 Mohd Asif Ali Rizwaan 2005-07-29 05:19:42 UTC
how do i apply the patch? 

like:
patch p1 < qtpatch.txt ?

i've tried but it won't patch.
Comment 14 Dirk Mueller 2005-07-29 17:46:35 UTC
Comment on attachment 11863 [details]
config.log for kdebase

fixed
Comment 15 Rex Dieter 2005-08-08 13:58:01 UTC
Is there any particular reason the patch enables visibility support only for gcc >= 4.  AFAIK, gcc-3.4.x supports -fvisibility too.
Comment 16 Dirk Mueller 2005-08-08 14:02:21 UTC
only that gcc 3.4.x does not support visibility unless your distro patched it. 
and those patched gcc's are more or less broken, so we're far safer off by
disabling visibility for those who happen to use such a distro. 
Comment 17 Jure Repinc 2005-09-10 00:10:19 UTC
When I try to compile kopete on computer with visibility patch and GCC 4.0.1 I get this error:

linking ./kopete/kopete/config/avdevice/kcm_kopete_avdeviceconfig.la
/bin/sh ./libtool --silent --mode=link --tag=CXX g++ -Wno-long-long -Wundef -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -g -O2 -Wformat-security -Wmissing-format-attribute -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common -fvisibility=hidden -fvisibility-inlines-hidden -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION -I/home/kdedev/src/kde/kdenetwork/kopete/libkopete -I./kopete/libkopete -I/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice -I/home/kdedev/src/kde/kdenetwork/kopete/libkopete/ui -I./kopete/libkopete/ui -I/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice -I/home/kdedev/src/kde/kdenetwork/kopete/libkopete/private -I/home/kdedev/kde-unstable/include -I/home/kdedev/src/kde/qt-copy/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -D_FILE_OFFSET_BITS=64 -no-undefined -module -avoid-version -module -no-undefined -Wl,--no-undefined -Wl,--allow-shlib-undefined -R /home/kdedev/kde-unstable/lib -R /home/kdedev/kde-unstable/lib -R /home/kdedev/src/kde/qt-copy/lib -R /usr/X11R6/lib -L/home/kdedev/kde-unstable/lib -L/home/kdedev/src/kde/qt-copy/lib -L/usr/X11R6/lib -o ./kopete/kopete/config/avdevice/kcm_kopete_avdeviceconfig.la -rpath /home/kdedev/kde-unstable/lib/kde3 ./kopete/libkopete/libkopete.la ./kopete/libkopete/avdevice/libkopete_videodevice.la -lkutils ./kopete/kopete/config/avdevice/avdeviceconfig.lo ./kopete/kopete/config/avdevice/avdeviceconfig_videoconfig.lo ./kopete/kopete/config/avdevice/avdeviceconfig.moc.lo
./kopete/kopete/config/avdevice/.libs/avdeviceconfig.o: In function `~AVDeviceConfig':
/home/kdedev/src/kde/kdenetwork/kopete/kopete/config/avdevice/avdeviceconfig.cpp:89: undefined reference to `QGLWidget::~QGLWidget()'
/home/kdedev/src/kde/kdenetwork/kopete/kopete/config/avdevice/avdeviceconfig.cpp:89: undefined reference to `QGLWidget::~QGLWidget()'
/home/kdedev/src/kde/kdenetwork/kopete/kopete/config/avdevice/avdeviceconfig.cpp:89: undefined reference to `QGLWidget::~QGLWidget()'
./kopete/kopete/config/avdevice/.libs/avdeviceconfig.o: In function `AVDeviceConfig':
/home/kdedev/src/kde/kdenetwork/kopete/kopete/config/avdevice/avdeviceconfig.cpp:47: undefined reference to `QGLWidget::QGLWidget(QWidget*, char const*, QGLWidget const*, unsigned int)'
/home/kdedev/src/kde/kdenetwork/kopete/kopete/config/avdevice/avdeviceconfig.cpp:47: undefined reference to `QGLWidget::QGLWidget(QWidget*, char const*, QGLWidget const*, unsigned int)'
collect2: ld returned 1 exit status
Error creating ./kopete/kopete/config/avdevice/kcm_kopete_avdeviceconfig.la. Exit status 1.
cd /home/kdedev/src/kde/kdenetwork && /bin/sh /home/kdedev/src/kde/kdenetwork/admin/missing --run autoheader
rm -f ./stamp-h1
touch /home/kdedev/src/kde/kdenetwork/config.h.in
cd . && /bin/sh ./config.status config.h
/home/kdedev/src/kde/qt-copy/bin/moc -o types.moc /home/kdedev/src/kde/kdenetwork/kopete/protocols/jabber/libiris/iris/xmpp-im/../xmpp-im/types.cpp
Starting installation...
installing ./kopete/libkopete/avdevice/libkopete_videodevice.la 
installing ./kopete/protocols/oscar/libkopete_oscar.la 
installing ./kopete/protocols/msn/libkopete_msn_shared.la 
linking ./kopete/libkopete/avdevice/libkvideoio.la
/bin/sh ./libtool --silent --mode=link --tag=CXX g++ -Wno-long-long -Wundef -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -g -O2 -Wformat-security -Wmissing-format-attribute -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common -fvisibility=hidden -fvisibility-inlines-hidden -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION -DKDE_NO_COMPAT -DQT_NO_COMPAT -DQT_NO_CAST_ASCII -DQT_NO_ASCII_CAST -I/home/kdedev/src/kde/kdenetwork/kopete/libkopete -I./kopete/libkopete -I/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice -I/home/kdedev/src/kde/kdenetwork/kopete/libkopete/ui -I./kopete/libkopete/ui -I/home/kdedev/src/kde/kdenetwork/kopete/libkopete/private -I/home/kdedev/src/kde/kdenetwork/kopete/libkopete/ui -I/home/kdedev/kde-unstable/include -I/home/kdedev/src/kde/qt-copy/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -D_FILE_OFFSET_BITS=64 -no-undefined -L/home/kdedev/kde-unstable/lib -L/home/kdedev/src/kde/qt-copy/lib -L/usr/X11R6/lib -version-info 1:0:0 -o ./kopete/libkopete/avdevice/libkvideoio.la -rpath /home/kdedev/kde-unstable/lib -Wl,--no-undefined -Wl,--allow-shlib-undefined -lqt-mt -lz -lpng -lz -lm -lXext -lX11 -lSM -lICE -lpthread -lkdecore -lGLU -lGL -lX11 ./kopete/libkopete/avdevice/kxv.lo ./kopete/libkopete/avdevice/qvideo.lo ./kopete/libkopete/avdevice/qvideostream.lo
./kopete/libkopete/avdevice/.libs/qvideostream.o: In function `QVideoStream':
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:131: undefined reference to `QGLFormat::hasOpenGL()'
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:131: undefined reference to `QGLFormat::hasOpenGL()'
./kopete/libkopete/avdevice/.libs/qvideostream.o: In function `QVideoStreamGLWidget':
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:540: undefined reference to `QGLFormat::QGLFormat(int, int)'
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:540: undefined reference to `QGLWidget::QGLWidget(QGLFormat const&, QWidget*, char const*, QGLWidget const*, unsigned int)'
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:540: undefined reference to `QGLFormat::QGLFormat(int, int)'
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:540: undefined reference to `QGLWidget::QGLWidget(QGLFormat const&, QWidget*, char const*, QGLWidget const*, unsigned int)'
./kopete/libkopete/avdevice/.libs/qvideostream.o: In function `~QVideoStreamGLWidget':
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:556: undefined reference to `QGLWidget::makeCurrent()'
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:560: undefined reference to `QGLWidget::~QGLWidget()'
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:560: undefined reference to `QGLWidget::~QGLWidget()'
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:556: undefined reference to `QGLWidget::makeCurrent()'
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:560: undefined reference to `QGLWidget::~QGLWidget()'
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:560: undefined reference to `QGLWidget::~QGLWidget()'
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:556: undefined reference to `QGLWidget::makeCurrent()'
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:560: undefined reference to `QGLWidget::~QGLWidget()'
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:560: undefined reference to `QGLWidget::~QGLWidget()'
./kopete/libkopete/avdevice/.libs/qvideostream.o: In function `QVideoStreamGLWidget::initializeGL()':
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:585: undefined reference to `QGLWidget::isValid() const'
./kopete/libkopete/avdevice/.libs/qvideostream.o: In function `doubleBuffer':
/home/kdedev/src/kde/qt-copy/include/qgl.h:400: undefined reference to `QGLFormat::testOption(QGL::FormatOption) const'
./kopete/libkopete/avdevice/.libs/qvideostream.o: In function `QVideoStreamGLWidget::initializeGL()':
/home/kdedev/src/kde/qt-copy/include/qgl.h:405: undefined reference to `QGLFormat::testOption(QGL::FormatOption) const'
/home/kdedev/src/kde/qt-copy/include/qgl.h:410: undefined reference to `QGLFormat::testOption(QGL::FormatOption) const'
/home/kdedev/src/kde/qt-copy/include/qgl.h:415: undefined reference to `QGLFormat::testOption(QGL::FormatOption) const'
/home/kdedev/src/kde/qt-copy/include/qgl.h:420: undefined reference to `QGLFormat::testOption(QGL::FormatOption) const'
./kopete/libkopete/avdevice/.libs/qvideostream.o:/home/kdedev/src/kde/qt-copy/include/qgl.h:425: more undefined references to `QGLFormat::testOption(QGL::FormatOption) const' follow
./kopete/libkopete/avdevice/.libs/qvideostream.o: In function `QVideoStreamGLWidget::initializeGL()':
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:595: undefined reference to `QGLFormat::plane() const'
/home/kdedev/src/kde/kdenetwork/kopete/libkopete/avdevice/qvideostream.cpp:598: undefined reference to `QGLWidget::qglClearColor(QColor const&) const'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTI20QVideoStreamGLWidget[typeinfo for QVideoStreamGLWidget]+0x8): undefined reference to `typeinfo for QGLWidget'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0xc): undefined reference to `QGLWidget::className() const'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x10): undefined reference to `QGLWidget::qt_cast(char const*)'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x14): undefined reference to `QGLWidget::qt_invoke(int, QUObject*)'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x18): undefined reference to `QGLWidget::qt_emit(int, QUObject*)'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x1c): undefined reference to `QGLWidget::qt_property(int, int, QVariant*)'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0xac): undefined reference to `QGLWidget::setMouseTracking(bool)'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x108): undefined reference to `QGLWidget::reparent(QWidget*, unsigned int, QPoint const&, bool)'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x148): undefined reference to `QGLWidget::paintEvent(QPaintEvent*)'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x150): undefined reference to `QGLWidget::resizeEvent(QResizeEvent*)'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x1c0): undefined reference to `QGLWidget::makeCurrent()'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x1c4): undefined reference to `QGLWidget::swapBuffers()'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x1c8): undefined reference to `QGLWidget::setFormat(QGLFormat const&)'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x1cc): undefined reference to `QGLWidget::setContext(QGLContext*, QGLContext const*, bool)'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x1d0): undefined reference to `QGLWidget::renderPixmap(int, int, bool)'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x1d4): undefined reference to `QGLWidget::grabFrameBuffer(bool)'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x1d8): undefined reference to `QGLWidget::makeOverlayCurrent()'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x1dc): undefined reference to `QGLWidget::updateGL()'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x1e0): undefined reference to `QGLWidget::updateOverlayGL()'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x1ec): undefined reference to `QGLWidget::paintGL()'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x1f0): undefined reference to `QGLWidget::initializeOverlayGL()'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x1f4): undefined reference to `QGLWidget::resizeOverlayGL(int, int)'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x1f8): undefined reference to `QGLWidget::paintOverlayGL()'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x1fc): undefined reference to `QGLWidget::glInit()'
./kopete/libkopete/avdevice/.libs/qvideostream.o:(.gnu.linkonce.d._ZTV20QVideoStreamGLWidget[vtable for QVideoStreamGLWidget]+0x200): undefined reference to `QGLWidget::glDraw()'
./kopete/libkopete/avdevice/.libs/qvideostream.o: In function `QGLWidget::metaObject() const':
/home/kdedev/src/kde/qt-copy/include/qgl.h:274: undefined reference to `QGLWidget::staticMetaObject()'
collect2: ld returned 1 exit status
Error creating ./kopete/libkopete/avdevice/libkvideoio.la. Exit status 1.
Comment 18 Nicolas Goutte 2005-09-10 15:58:27 UTC
As far as I have understood, Qt4 works with -fvisibility
Comment 19 Matt Rogers 2005-09-10 16:03:53 UTC
Nicolas: next time, read the bug report. This is about getting visibility support added for Qt3.
Comment 20 Nicolas Goutte 2005-09-10 16:15:45 UTC
On Saturday 10 September 2005 16:03, Matt Rogers wrote:
[bugs.kde.org quoted mail]

Do you really thing that it will be still done?

Qt 3 will probably not much updated by Trolltech anymore.

KDE 3.5 is in feature freeze and can handle a unpatched Qt.

So I do not know why thi sbug is still open.

Have a nice day!
Comment 21 Thiago Macieira 2005-09-10 18:01:48 UTC
Nicolas: TT has promised an updated version of Qt3 with visibility support. Besides, we *do* want to support patched Qt as in qt-copy with visibility support, and that's what this bug is about.
Comment 22 Jure Repinc 2005-09-13 09:44:33 UTC
Is this patch stil OK for the new Qt 3.3.5? Or is visibility support now integrated officialy by Trolltech?
Comment 23 Dirk Mueller 2005-09-13 09:52:02 UTC
still applying against Qt 3.3.5
Comment 24 Diego Elio Pettenò 2005-09-27 13:51:30 UTC
The test seems to pass, at least for arts and kdelibs from within emerge, using Gentoo, QT 3.3.5 and GCC 4, so -fvisibility=hidden *is* enabled, but then arts crashes within STL, because neither STL is safe wrt -fvisibility=hidden.
Disabling the visibility check entirely made it work fine (but it required to rebuild both arts and kdelibs).

Also, kmail linked against the broken kdelibs started crashing within library calls, recompiled, and worked fine.

-fvisibility=hidden creates problem not only to Qt but also to every C++ library which KDE apps links against, it's probably not safe to enable at least on some cases. Having at least a --disable-visibility switch on configure would help, I think.
Comment 25 Dirk Mueller 2005-09-27 14:11:59 UTC
thats nonsense, you're facing a libstdc++ bug that is already fixed for ages,
so feel free to report it against your distro
Comment 26 Diego Elio Pettenò 2005-09-27 14:23:42 UTC
It's not limited to Gentoo (btw I'm using a 4.0.2 snapshot now, but the same problem was on alpha1, after which I updated to this version, so the problem should not be in gcc) as seems like KUbuntu's binaries are suffering from the same problem.
Comment 27 Christopher Martin 2005-10-01 16:00:24 UTC
Diego is correct. Without certain patches for gcc used by Mandrake and SuSE, even the latest gcc 4.0.2 does not generate good code when using -fvisibility=hidden. See:

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

Since Debian (and most other distros, especially Debian derivatives, I imagine) does not use the relevant gcc visibility patches applied by Mandrake and SuSE, enabling KDE visibility results in aRts crashes, amongst others, exactly as Diego reported. More generally, many shared objects become marked with TEXTREL, suggesting rather strongly that something is wrong, and apparently causing linking problems on architectures that don't support non-PIC libs.
Comment 28 Koos Vriezen 2005-10-02 15:36:58 UTC
Created attachment 12809 [details]
Extended patch for reduces symbols for libqt-mt itself

This patch extends Dirk's by also applying -fvisibility to Qt itself. It saves
about 6000 symbols, mainly W types. This patch was posted on kde-core-devel 8
may '05 but that one needed manual tweaking in src/tools/qconfig.cpp after
'configure', that is now fixed in this version. Works for me since 8 may, but I
only build Qt with 'make sub-tools'
(According to Christopher bug links above, don't use this on amd64 systems
while these still open for your compiler)
Comment 29 Diego Elio Pettenò 2005-10-05 00:39:33 UTC
I'm going to test with this patch and newly patched GCC, maybe this time it will work (hopefully?).

Just to know then, what would happen if some KDE program with visibility enabled links to a C++ library that is not aware of visibility?
If that crashes (as does libstdc++), is enough of a reason to disable it, from my point of view.
Nobody can ensure that all and every library used by KDE and KDE software is visibility aware :/
Comment 30 Dirk Mueller 2005-10-05 09:47:12 UTC
it requires to patch the inclusion of those header files to reset visibility to default. usually things don't crash (e.g. libFAM), when they are in C++ but only export a C interface. There is only a problem when a C++ library exports a C++ interface that needs to be casted upstream. 

Comment 31 Diego Elio Pettenò 2005-10-05 13:33:47 UTC
Created attachment 12862 [details]
Kooka failure log

FWIW, after patching qt, enabling the support and recompiling KDE, kooka fails
with the attached log.
Have to look if it's just Kooka or if the visibility stuff broke something.

At least, artsplay now doesn't segfault, so that problem seems resolved.
Comment 32 Koos Vriezen 2005-10-05 21:11:46 UTC
Strange, KDE_ENABLE_HIDDEN_VISIBILITY macro isn't defined in configure.in.in in kdegraphics (at least not in the 3.5 branch .. or 3.4 branch). Did you add it yourself?
Comment 33 Diego Elio Pettenò 2005-10-05 21:21:58 UTC
No, just gone through with emerge, after removing the tinkering with visibility in the eclass to have a mostly "as configure say" environment.
If it does not inherit CXXFLAGS from one of its dependencies (after the configure), the only cause can be a problem of mixing libraries with visibility enabled with code that does not support it.
I'll retry after all of the rest of the packages are compiled, but that might mean that something else needs to be fixed before enabling the feature for stable users.

Still no hope to get a --disable-visibility option, with an enabled default?
Comment 34 Dirk Mueller 2005-10-05 22:23:43 UTC
ok, then you screwed something up. there is no visibility enabled in kdegraphics because the module doesn't support it, so if you have visibility enabled in your ebuild then your ebuild is broken. 
Comment 35 Diego Elio Pettenò 2005-10-05 22:31:47 UTC
If configure does not enable it, the ebuild does not enable it for sure.
So the problem is not this side, it might be a problem of a system partially upgraded to visibility and partially still to update, or it might be a problem with kdegraphics and the other libraries, still to see which one it is, as soon as I'll be clear of what the cause is, I'll report back.
Comment 36 Diego Elio Pettenò 2005-10-06 10:59:37 UTC
Ok the kooka problem was probably unrelated or due to the mixed environment, re-tried compiling after the rest of KDE compiled, and it gone fine.

Still, I have Kontact crashing while loading gpg-signed mails (but KMail on its own works fine) and artsd crash again (GCC is 4.0.2-r1, patched with Fedora's patches as Christopher told).
Comment 37 Koos Vriezen 2005-10-07 13:45:28 UTC
Are backtraces of these crashes available somewhere? Probably overlooked, but what is your KDE version? And your arch is x64, right?
Comment 38 Diego Elio Pettenò 2005-10-07 13:55:27 UTC
Created attachment 12906 [details]
kontact-backtrace

Here is the kontact one, arts doesn't call Dr Konqui so it's a bit tricky, gdb
gets mostly ?? because I haven't built it with debug enabled, yet.

Yep I'm on amd64, with patched GCC as said, KDE version 3.5_beta1.
Comment 39 Ali Akcaagac 2005-10-09 14:13:32 UTC
Hello,

I was compiling KDE 3.5 SVN over night and saw this stuff being mentioned in the configure process. Could someone please inform me, which of the patches listed here is the correct one to apply and maybe tell me why this hasn't been added to the qt-copy/patches subdir for automagic apply ? Would save a lot of trouble in case someone forgets to manually patch it as I did for example.
Comment 40 Diego Elio Pettenò 2005-10-12 01:20:59 UTC
At least other patches are needed to Qt.

pinentry (from GnuPG project) breaks because it can't find qt_hebrew_keyboard_hack (and doesn't compile) as it's not exported.

Also, koffice-libs is killed this way:

.libs/korichtext.o: In function `KoTextString::checkBidi() const':
korichtext.cpp:(.text+0x2704): undefined reference to `QTextEngine::QTextEngine(QString const&, QFontPrivate*)'
korichtext.cpp:(.text+0x273e): undefined reference to `QTextEngine::itemize(int)'
korichtext.cpp:(.text+0x2747): undefined reference to `QTextEngine::attributes()'
korichtext.cpp:(.text+0x288b): undefined reference to `QTextEngine::~QTextEngine()'
korichtext.cpp:(.text+0x2934): undefined reference to `QTextEngine::~QTextEngine()'
collect2: ld returned 1 exit status
make[4]: *** [libkotext.la] Error 1

the same goes for both koffice 1.4.1 and 1.4.2.

Comment 41 Dirk Mueller 2005-10-12 09:07:47 UTC
not really, this is not what the bug report is about. I don't know why somebody added a patch to compile Qt with -fvisibility=hidden, but that is binary incompatible and shouldn't be done. If you do that, its your own fault. 
Comment 42 Diego Elio Pettenò 2005-10-12 12:54:24 UTC
If something is not being exported properly, we'll fall in the same problem we had with 3.4.0 and 3.4.1 releases with dynamic_cast.
Comment 43 Dirk Mueller 2005-10-12 13:14:40 UTC
sure, thats why Q_EXPORT has been fixed. however this has nothing to do with missing exports from a visibility-patched libqt.
Comment 44 Koos Vriezen 2005-10-12 21:08:44 UTC
"why somebody added a patch to compile Qt with -fvisibility=hidden, but that is binary incompatible"
I was hoping for some more testing for this patch. I've recompiled debian's libqt-mt/unstable package and everything _seems_ to work quite nicely for the KDE apps I use. Which isn't much more than kdelibs/kdebase actually, but are not recompiled by me. That's why I considered extending the v1 patch on topic.
So why is it BIC (besides the missed exports of course)?
Comment 45 Stefan Vunckx 2005-10-17 15:10:10 UTC
Created attachment 13025 [details]
backtrace of kmail crash when sending out mail

I have KDE/Qt compiled from SVN with the visibility patch, and when I try to
send mail, kmail crashes :/

Its due to visibility; when I re-compile Qt+kdelibs+kmail, the problem
disappears ... Ive attached the backtrace.

There's also another problem (dont know if its related, but it IS related to
visibility); I cant edit the to/cc field in kmail's composer, it crashes if I
try to do so (or if I push the select button for addressbook), but drkonqui
isnt called then, so I cant produce backtrace; only lo from console output:
...
kabc: StdAddressBook::self()
kmail: RecipientsPicker::insertCollection() Distribution Lists	index: 2
*** KMail got signal 11 (Crashing)
Comment 46 Rex Dieter 2005-10-17 15:13:34 UTC
Re: comment #45, Stephan, if you've found a kmail bug/crash, IMO, then file it against kmail... it has no place being mentioned here against kdelibs/qt.
Comment 47 Raul Bob 2005-10-19 12:43:30 UTC
I have tried "patch v1" against qt3.3.5 but it seems to me that this release is already patched.
[root@qt-x11-free-3.3.5]# patch < ./qt_visibility.txt
can't find file to patch at input line 5
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Index: src/kernel/qgplugin.h
|===================================================================
|--- src/kernel/qgplugin.h      (revision 423270)
|+++ src/kernel/qgplugin.h      (working copy)
--------------------------
File to patch: src/kernel/qgplugin.h
patching file src/kernel/qgplugin.h
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file src/kernel/qgplugin.h.rej
can't find file to patch at input line 55
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Index: src/tools/qglobal.h
|===================================================================
|--- src/tools/qglobal.h        (revision 423270)
|+++ src/tools/qglobal.h        (working copy)
--------------------------
File to patch: src/tools/qglobal.h
patching file src/tools/qglobal.h
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file src/tools/qglobal.h.rej
Comment 48 Koos Vriezen 2005-10-19 20:30:57 UTC
Created attachment 13069 [details]
Add exports reported by Diego Pettenò (use at own risk :)
Comment 49 Dirk Mueller 2008-08-18 01:30:58 UTC
qt 4.x implements visibility macros now.