qt-visibility patch? (was: KDE & gcc 4.0.1)

Koos Vriezen koos.vriezen at xs4all.nl
Sun May 8 13:00:49 BST 2005


Ismail Donmez wrote:
> Today I tried to compile kdelibs with gcc 4.0.1

OT, is there a patch somewhere for qt-copy so it will compile with
-fvisibilityXXX options?

I recompiled all of my svn checkout with gcc-4.0/experimental uptodate
4.0.0-2 (which according the changelog.Debian is Update to CVS 20050503)
and I'm really happy with it. Not only does it compile faster, the apps
start faster too. Strangely enough, my previous gcc was a patched 3.4.3
w/ visibility added.

Anyhow, the patch for qt I used now still fails w/ 
 undefined reference to `qInstallPathBins()'
and a few more that are defined in src/tools/qconfig.cpp, but declared
in src/tools/qglobal.h as 
 Q_EXPORT const char *qInstallPathBins();
But this file isn't included in qconfig.cpp. Manually added this fixes
it (note this file is created with the configure script).

Koos
-------------- next part --------------
Index: src/kernel/qapplication_x11.cpp
===================================================================
--- src/kernel/qapplication_x11.cpp	(revision 409692)
+++ src/kernel/qapplication_x11.cpp	(working copy)
@@ -3795,7 +3795,7 @@
 }
 
 
-bool qt_try_modal( QWidget *widget, XEvent *event )
+Q_EXPORT bool qt_try_modal( QWidget *widget, XEvent *event )
 {
     if (qt_xdnd_dragging) {
 	// allow mouse events while DnD is active
Index: src/tools/qglobal.h
===================================================================
--- src/tools/qglobal.h	(revision 409692)
+++ src/tools/qglobal.h	(working copy)
@@ -293,6 +293,9 @@
 #    define Q_WRONG_SB_CTYPE_MACROS
 #  endif
 
+#  if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#    define Q_EXPORT __attribute__((visibility ("default")))
+#  endif
 /* ARM gcc pads structs to 32 bits, even when they contain a single
    char, or short.  We tell gcc to pack QChars to 16 bits, to avoid
    QString bloat. However, gcc 3.4 doesn't allow us to create references to
Index: tools/designer/uilib/qwidgetfactory.h
===================================================================
--- tools/designer/uilib/qwidgetfactory.h	(revision 409692)
+++ tools/designer/uilib/qwidgetfactory.h	(working copy)
@@ -48,7 +48,7 @@
 class QWidgetFactoryPrivate;
 class UibStrTable;
 
-class QWidgetFactory
+class Q_EXPORT QWidgetFactory
 {
 public:
     QWidgetFactory();
Index: tools/designer/uilib/qwidgetfactory.cpp
===================================================================
--- tools/designer/uilib/qwidgetfactory.cpp	(revision 409692)
+++ tools/designer/uilib/qwidgetfactory.cpp	(working copy)
@@ -113,13 +113,13 @@
 static QMap<QString, bool> *availableWidgetMap = 0;
 static QStringList *availableWidgetList = 0;
 
-QMap<QWidget*, QString> *qwf_forms = 0;
+Q_EXPORT QMap<QWidget*, QString> *qwf_forms = 0;
 QString *qwf_language = 0;
-bool qwf_execute_code = TRUE;
+Q_EXPORT bool qwf_execute_code = TRUE;
 bool qwf_stays_on_top = FALSE;
 QString qwf_currFileName = "";
 QObject *qwf_form_object = 0;
-QString *qwf_plugin_dir = 0;
+Q_EXPORT QString *qwf_plugin_dir = 0;
 
 static void setupPluginDir()
 {
Index: tools/designer/shared/domtool.h
===================================================================
--- tools/designer/shared/domtool.h	(revision 409692)
+++ tools/designer/shared/domtool.h	(working copy)
@@ -33,7 +33,7 @@
 class QDomElement;
 class QDomDocument;
 
-class DomTool : public Qt
+class Q_EXPORT DomTool : public Qt
 {
 public:
     static QVariant readProperty( const QDomElement& e, const QString& name, const QVariant& defValue );
Index: mkspecs/linux-g++/qmake.conf
===================================================================
--- mkspecs/linux-g++/qmake.conf	(revision 409692)
+++ mkspecs/linux-g++/qmake.conf	(working copy)
@@ -17,7 +17,7 @@
 QMAKE_YACCFLAGS_MANGLE  = -p $base -b $base
 QMAKE_YACC_HEADER       = $base.tab.h
 QMAKE_YACC_SOURCE       = $base.tab.c
-QMAKE_CFLAGS		= -pipe
+QMAKE_CFLAGS		= -pipe -march=pentium4 -fvisibility=hidden -fvisibility-inlines-hidden
 QMAKE_CFLAGS_DEPS	= -M
 QMAKE_CFLAGS_WARN_ON	= -Wall -W
 QMAKE_CFLAGS_WARN_OFF	= -w


More information about the kde-core-devel mailing list