[X-Unix] "Bad CPU type"
Juan Manuel Palacios
jmpalaciosp at eml.cc
Mon Jun 14 13:51:18 PDT 2004
On Jun 14, 2004, at 12:36 PM, Victor Eijkhout wrote:
>> Aha! Here, this next line calls gcc with the "-fast" optimization
>> flag. Well, it turns out that Apple's gcc default configuration
>> causes this flag to produce binaries *exclusively" for the G5
>> architecture... how do you like that??
>
> Thank you so much for finding that. I don't think I'd've found it on
> my own.
Hey, my pleasure! That's exactly what this mailing lists are for...
>
> I've now replaced "-fast" by "-O2" in the makefile. Simplest solution
> and reasonably portable.
You are correct my friend, "-O2" is more portable than "-fast
-mcpu=7450" because, even though the latter encompasses the widest set
of Apple architectures, it is still an Apple only optimization flag; a
Makefile with those choices will fail miserably, say, on Linux. Have
you considered the portable topmost "-O3" flag? Reportedly it is the
highest optimization, though of course you may ask yourself if you
really need it when you start encountering compilation time trade offs.
>
> If I understood the autoconf shit (:-/) better I would repair that:
> from the log file you can clearly see that it compiles some test file
> with "-fast", and if that succeeds it accepts the option. It should
> actually run it.
Can't say much here because, honestly, haven't even touched a single
autoconf script in my life (read tons, of course)... some would praise
me and say I'm smart for that, some would say I'm an ignorant newbie...
maybe I'm both! :-) But the one thing I can tell you, is that such test
would have succeeded on a G5 and your code would still *not* be
portable; so, as you wisely say, maybe just sticking to the "-O" set of
optimization flags is the best solution
>
> Btw, elsewhere someone suggested doing "otool -h" on the executable.
> That gave me (with /usr/include/mach/machine.h) the information that
> the executable was for PowerPC 970.
Which is exactly the technical name of the G5: cputype 18
(CPU_TYPE_POWERPC) and cpusubtype 18 (CPU_SUBTYPE_POWERPC_970); with
"-fast -mcpu=7450" the binary becomes cputype 18 and cpusubtype 0
(CPU_SUBTYPE_POWERPC_ALL).
>
> Anyway. We're off and running. Thanks again!
I'm glad you are, pleasure helping you! Regards,...
Juan
More information about the X-Unix
mailing list