OSXHorrors » History » Version 21

Chris Cannam, 2011-03-24 10:05 AM

1 21 Chris Cannam
{{toc}}
2 1 Chris Cannam
3 1 Chris Cannam
4 21 Chris Cannam
5 21 Chris Cannam
h1. OS/X version, hardware platform, and Qt version compatibility
6 18 Chris Cannam
7 6 Chris Cannam
*Executive summary:* For a program like EasyHg that demands the widest possible compatibility, we currently want to hit the following targets:
8 6 Chris Cannam
9 6 Chris Cannam
* 10.4 PPC 32-bit Carbon
10 6 Chris Cannam
* 10.4 Intel 32-bit Carbon
11 6 Chris Cannam
* 10.6 Intel 64-bit Cocoa
12 1 Chris Cannam
13 8 Chris Cannam
To do this, we currently need at least two builds of Qt:
14 8 Chris Cannam
15 12 Chris Cannam
* 10.6 gcc-4.2 Cocoa x86_64
16 8 Chris Cannam
* 10.4 gcc-4.0 Carbon PPC and i386
17 1 Chris Cannam
18 15 Chris Cannam
This should mean the Qt 4.7.1 default distribution plus a separate Carbon build will do.  BUT see Qt Plugins and Python sections below.
19 9 Chris Cannam
20 1 Chris Cannam
Note it is not possible to cover all platforms in a single build step, we always need to do at least two separate builds plus lipo.
21 12 Chris Cannam
22 12 Chris Cannam
If we are going to make a 3-way universal binary, we need to ensure the 10.4 build gets selected for i386 -- i.e. to pull only the x86_64 architecture from any 10.5 or 10.6 SDK build we do.  The inability to select between different i386 versions from a single universal binary is a strong incentive to stick to a single 10.4+ Carbon build for all 32-bit platforms.
23 1 Chris Cannam
24 5 Chris Cannam
h2. OS/X 10.6
25 5 Chris Cannam
26 1 Chris Cannam
h3. As target
27 1 Chris Cannam
28 11 Chris Cannam
* By far the most common version as of Feb 2011 (apparently >80%)
29 5 Chris Cannam
* Not supported on PPC
30 5 Chris Cannam
* Runs in 64-bit mode by default where possible
31 10 Chris Cannam
* Note Python is also 64-bit by default, so PyQt needs to be as well
32 5 Chris Cannam
* Is _not_ always 64-bit -- it is supported on 32-bit-only hardware such as Core Duo (first Intel Macs)
33 1 Chris Cannam
34 1 Chris Cannam
h3. As build host
35 1 Chris Cannam
36 5 Chris Cannam
* Builds 64-bit by default
37 5 Chris Cannam
* Can be used to do 32-bit Intel and PPC builds
38 1 Chris Cannam
39 1 Chris Cannam
h2. OS/X 10.5
40 1 Chris Cannam
41 1 Chris Cannam
h3. As target
42 1 Chris Cannam
43 2 Chris Cannam
* Not all that much more widely used than 10.4 -- if we were dropping 10.4, we probably might as well drop 10.5 as well
44 1 Chris Cannam
* Last version supported for PPC platforms
45 1 Chris Cannam
* Runs in 32-bit mode by default
46 1 Chris Cannam
* Can build for it from 10.5, 10.6
47 1 Chris Cannam
* Requires SDK @/Developer/SDKs/MacOSX10.5.SDK@
48 1 Chris Cannam
* First version to support Objective-C 2.0
49 1 Chris Cannam
* Qt Cocoa supported
50 1 Chris Cannam
51 1 Chris Cannam
h3. As build host
52 1 Chris Cannam
53 1 Chris Cannam
* Builds 32-bit by default
54 1 Chris Cannam
* Can be used to do 64-bit builds
55 1 Chris Cannam
56 5 Chris Cannam
h2. OS/X 10.4
57 1 Chris Cannam
58 1 Chris Cannam
h3. As target
59 1 Chris Cannam
60 5 Chris Cannam
* Oldest version still apparently in use as of Feb 2011: not very widespread (low single digit %age of Mac users), but at least two researchers here use it
61 5 Chris Cannam
* Appears in PPC and i386 systems
62 5 Chris Cannam
* Runs in 32-bit mode only
63 5 Chris Cannam
* Can build for it from 10.4, 10.5, 10.6
64 5 Chris Cannam
* Requires SDK @/Developer/SDKs/MacOSX10.4u.SDK@
65 5 Chris Cannam
* Requires @-mmacosx-version-min=10.4@ on 10.5+
66 5 Chris Cannam
* Requires gcc-4.0 to be requested explicitly on 10.6
67 5 Chris Cannam
* Does not support Objective-C 2.0
68 5 Chris Cannam
* Not a supported target for Qt's Cocoa builds, Qt Carbon needed
69 2 Chris Cannam
70 2 Chris Cannam
h3. As build host
71 2 Chris Cannam
72 5 Chris Cannam
* Does not support Objective-C 2.0
73 5 Chris Cannam
* 10.4u SDK can be used to build 64-bit executables of simple C/C++ programs such as plugins, but not of GUIs or anything using Core frameworks
74 13 Chris Cannam
75 15 Chris Cannam
h2. Qt Plugins
76 1 Chris Cannam
77 15 Chris Cannam
Qt will by default load any plugins for e.g. image format support that it finds in the system.  There are various ways to block plugin loading (e.g. through build key) but I can't see any way that will prevent Qt from at least dlopen()ing the shared object and rifling through its drawers.
78 15 Chris Cannam
79 15 Chris Cannam
This is a problem, because the plugins have dependencies on the Qt framework components, so we may end up with two different versions of Qt (the one in our bundle and the system one) being loaded at once.  Result: mysterious crashes.
80 15 Chris Cannam
81 17 Chris Cannam
For the moment we "fix" this by applying the following elegant patch to our Qt build:
82 15 Chris Cannam
83 16 Chris Cannam
<pre>
84 16 Chris Cannam
--- src/corelib/plugin/qfactoryloader.cpp_	2011-03-14 12:21:11.000000000 +0000
85 16 Chris Cannam
+++ src/corelib/plugin/qfactoryloader.cpp	2011-03-14 12:22:04.000000000 +0000
86 16 Chris Cannam
@@ -104,7 +104,7 @@
87 16 Chris Cannam
 
88 16 Chris Cannam
 void QFactoryLoader::update()
89 16 Chris Cannam
 {
90 16 Chris Cannam
-#ifdef QT_SHARED
91 16 Chris Cannam
+#ifdef NO_WE_DONT_WANT_PLUGINS_THANKS
92 16 Chris Cannam
     Q_D(QFactoryLoader);
93 16 Chris Cannam
     QStringList paths = QCoreApplication::libraryPaths();
94 16 Chris Cannam
     QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
95 16 Chris Cannam
--- src/corelib/plugin/qpluginloader.cpp_	2011-03-14 12:23:31.000000000 +0000
96 16 Chris Cannam
+++ src/corelib/plugin/qpluginloader.cpp	2011-03-14 12:23:53.000000000 +0000
97 16 Chris Cannam
@@ -285,7 +285,7 @@
98 16 Chris Cannam
 */
99 16 Chris Cannam
 void QPluginLoader::setFileName(const QString &fileName)
100 16 Chris Cannam
 {
101 16 Chris Cannam
-#if defined(QT_SHARED)
102 16 Chris Cannam
+#if defined(NO_WE_DONT_WANT_PLUGINS_THANKS)
103 16 Chris Cannam
     QLibrary::LoadHints lh;
104 16 Chris Cannam
     if (d) {
105 16 Chris Cannam
         lh = d->loadHints;
106 16 Chris Cannam
</pre>
107 15 Chris Cannam
108 15 Chris Cannam
h2. Python versions
109 15 Chris Cannam
110 15 Chris Cannam
Python versioning and compatibility is a bit of a nightmare.  We need to load a Python module with C components (using PyQt) in Mercurial, so we need to take into account both the Python version and the architecture.
111 15 Chris Cannam
112 15 Chris Cannam
The system Python is 2.5 on 10.4/10.5 and 2.6 on 10.6.  If we're using PyQt, we need to build for 2.5 if it's to work across all our targets.
113 14 Chris Cannam
114 14 Chris Cannam
On 10.6, Python is 32-/64-bit universal which runs in 64-bit by default on a 64-bit system, so any modules need to be available both ways as well (troubleshooting this when it goes wrong is quite tricky).  There is an environment variable @VERSIONER_PYTHON_PREFER_32_BIT@ which you can set to cause it always to run in 32-bit.
115 13 Chris Cannam
116 13 Chris Cannam
Where things get complicated is when users install additional versions of Python from other ports repositories; this seems to be quite common around these parts.  Then your user-installed Python is likely to get picked up before the system one, and you don't know whether it's going to be 32- or 64-bit, and it won't support the versioning environment variable.  My impression is that people get custom Python installs dragged in as dependencies of other packages, and that tends to break quite a lot of things.
117 13 Chris Cannam
118 13 Chris Cannam
Some 10.6 system Pythons have a problem loading modules, apparently something getting broken during the upgrade from 10.5 -- this affects my home machine, but I haven't had time to look into it properly yet.