You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Friday, June 10th 2005, 7:30pm

Qt 4.0 rc1 won't build on Mac OS X Tiger w/ XCode 2.1

I understand XCode 2.1 is a lot more anal about types than XCode 2.0 was, so I suspect that might be the issue, but....

I'm getting errors trying to build Qt 4.0 rc1 from source on Tiger. The error looks like:

---(snip!)---
c++ -c -pipe -Os -Wall -W -DQT_MOC -DQT_NO_CODECS -DQT_LITE_UNICODE -DQT_NO_COMPONENT -DQT_NO_STL -DQT_NO_COMPRESS -DQT_NO_DATASTREAM -DQT_NO_TEXTSTREAM -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_THREAD -DQT_NO_REGEXP -DQT_NO_QOBJECT -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/Users/ranger/tmp/qt-mac-opensource-desktop-4.0.0-rc1-new/mkspecs/macx-g++ -I. -I../../corelib/arch/generic -I../../../include -I. -I../../../include/QtCore -I. -o release-shared/qfsfileengine_unix.o ../../corelib/io/qfsfileengine_unix.cpp
distcc[23908] (dcc_get_hostlist) Warning: no hostlist is set; can't distribute work
distcc[23908] (dcc_build_somewhere) Warning: failed to distribute, running locally instead
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/IntlResources.h:48: error: '<anonymous enum>' is/uses anonymous type
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/IntlResources.h:48: error: trying to instantiate 'template<class T> QNoDebug operator<<(QNoDebug, const T&)'
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Script.h:767: error: '<anonymous enum>' is/uses anonymous type
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Script.h:767: error: trying to instantiate 'template<class T> QNoDebug operator<<(QNoDebug, const T&)'
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/TextCommon.h:655:
---(snip!)---

(and pages and pages more errors)

Any idea how to fix this?

2

Friday, June 10th 2005, 8:17pm

ICK -- system headers not compliant with gcc4?

So I've done some research on this.

Apparently this is a "feature" of gcc4 in that it's now implementing the spec correctly, at the expense of working code. ;) XCode 2.1 merged a ton of the gcc 4.0.0 final fixes since XCode 2.0's release.

The problem is, it's not properly casting <<'s to an integer from an enum, ie, /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/IntlResources.h contains:

Source code

1
2
3
4
5
6
7
8
9
enum {
                                        /* One more flag in the itlcFlags byte */
  itlcDisableKeyScriptSync      = 3     /*Disable font and keyboard script synchrinozation*/
};

enum {
                                        /* We should define masks, too. */
  itlcDisableKeyScriptSyncMask  = 1 << itlcDisableKeyScriptSync /*Disable font and keyboard script synchrinozation mask*/
};


...changing it to:

Source code

1
2
3
4
5
6
7
8
9
enum {
                                        /* One more flag in the itlcFlags byte */
  itlcDisableKeyScriptSync      = 3     /*Disable font and keyboard script synchrinozation*/
};

enum {
                                        /* We should define masks, too. */
  itlcDisableKeyScriptSyncMask  = 1 << int(itlcDisableKeyScriptSync) /*Disable font and keyboard script synchrinozation mask*/
};


...fixes it, but obviously, f**king with system headers is bad. Did I miss an upgrade? Did apple fail to test any of their frameworks against xcode 2.1?

Is there any way to work around this that doesn't include messing with system headers? It looks like it might be an issue with QNoDebug overloading, but I don't really know C++ enough to have any idea what's going on...

3

Friday, June 10th 2005, 8:21pm

Don't you love it when people solve their own issues?

This appears to be a bug in gcc4, qt4, or both, but I'll let trolltech worry about it. The workaround is to include the apple headers before the Qt debug headers:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--- qt-mac-opensource-desktop-4.0.0-rc1/src/corelib/io/qfsfileengine_unix.cpp   2005-06-06 10:42:40.000000000 -0400
+++ qt-mac-opensource-desktop-4.0.0-rc1-patched/src/corelib/io/qfsfileengine_unix.cpp   2005-06-10 15:19:06.000000000 -0400
@@ -22,6 +22,10 @@
 ****************************************************************************/
 
 #include <qplatformdefs.h>
+#if !defined(QWS) && defined(Q_OS_MAC)
+# include <private/qcore_mac_p.h>
+#endif
+
 #ifndef QT_NO_REGEXP
 # include <qregexp.h>
 #endif
@@ -35,9 +39,6 @@
 #include <stdlib.h>
 #include <limits.h>
 #include <errno.h>
-#if !defined(QWS) && defined(Q_OS_MAC)
-# include <private/qcore_mac_p.h>
-#endif
 
 void QFSFileEnginePrivate::init()
 {