On Mar 2, 2007, at 3:36 AM, Bennett Helm wrote:
On Mar 1, 2007, at 5:40 PM, Trenton Schulz wrote:
Trenton> Is there any reason why LyX isn't built universal?
Mostly ignorance on my part. (My standard disclaimer: I am not a
developer.) Also some have thought that having separate binaries is
preferable because it results in smaller file sizes (about 22.5 MB
uncompressed).
Am I wrong that a "universal binary" is just a LyX.app bundle
with two
different binaries in it?
Sort of. They are the the binary for each architecture stitched
together. For example:
file Designer.app/Contents/MacOS/Designer
Designer.app/Contents/MacOS/Designer: Mach-O fat file with 2
architectures
Designer.app/Contents/MacOS/Designer (for architecture ppc):
Mach-O executable ppc
Designer.app/Contents/MacOS/Designer (for architecture i386):
Mach-O executable i386
If you don't have any compile time defines for endianess or things
like that, you /could/ just add -arch ppc -arch i386 to the CFLAGS
and LFLAGS and things would work on an intel box. If you were
building on PowerPC, you would need to pass an SDK, which is
another argument to the CFLAGS and LFLAGS, other than doubling
your compile time (since it runs the compiler for each arch), you
get. Alternatively, you can build each binary separately and use
the lipo command to put them together, e.g. using Lyx-1.4.4:
cp LyX-Intel.app/Contents/MacOS/lyx LyX-PPC.app/Contents/MacOS/lyx-
intel
lipo -create LyX-PPC.app/Contents/MacOS/lyx LyX-PPC.app/Contents/
MacOS/lyx-intel -o LyX-PPC.app/Contents/MacOS/lyx-uni
mv LyX-PPC.app/Contents/MacOS/lyx-uni LyX-PPC.app/Contents/MacOS/lyx
Of course you need to repeat with the other binaries and libraries
in the bundle. But the nice advantage is the you only have to
distribute one bundle and it causes less confusion for end users.
It's your call though. I don't have any skill with autoconf or
automake and don't have time to learn at the moment.
OK. I've played around with this with LyX-1.5. I have Qt-4.2.2
compiled with the -universal flag. Setting CFLAGS, LDFLAGS, and
CXXFLAGS to include "-arch ppc", and configuring lyx with "--
host=ppc-apple-darwin8.8.1 --target=ppc-apple-darwin8.8.1" enables
me to produce ppc binaries on my Intel Mac. Using lipo, I can then
create a universal binary, which runs on at least one Intel and one
PPC Mac. I intend to compile the next 1.5 beta as a universal
binary to see what the response is.
(Am I right that the only files affected by this are those that end
up in the LyX.app/Contents/MacOS folder? -- I couldn't find any
other contenders.)
If you have any libraries in the bundle, they would need to be lipo'd
too. But, yes, in general, it's just the executables.
However, I can't get it to work on 1.4.x because I get errors at
the final linking stage. (Is this because Qt-3 wasn't compiled for
PPC Mac?)
Qt 3 is a bit of a bugaboo to get working universal (it is possible,
but it's more work since it existed long before the idea of universal
mac binaries did). Personally, I would just leave it.
I will try to check out the performance issue sometime next week
as I am away for the weekend and report back.
Still planning on doing this.
-- Trenton
Performance on a 1GHz PPC Mac is acceptable (for the 5 minutes I
tried it). It pushes processor usage up to 70%+ when typing fast,
but I don't get significant lag. I suspect it would be problematic
for something much slower than this.
(I don't know about endianness or troubles it might cause. I didn't
notice any problems, though.)
Bennett