[X-Unix] "Bad CPU type"

Juan Manuel Palacios jmpalaciosp at eml.cc
Mon Jun 14 07:53:05 PDT 2004


	Hi Victor. The offending command is difficult to catch, but I got it! 
(scroll down with me...)

On Jun 14, 2004, at 10:05 AM, Victor Eijkhout wrote:
>
> I've found mention of that message on 
> <http://www.hmug.org/man/2/intro.html> but that doesn't help me any. 
> All .o and .a files were compiled by me, and I think it all uses the 
> same gcc.
>
> make  all-recursive
> Making all in Library
> source='aca.c' object='aca.lo' libtool=yes \
> depfile='.deps/aca.Plo' tmpdepfile='.deps/aca.TPlo' \
> depmode=gcc3 /bin/sh ../depcomp \

	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?? If you're not on a G5 when compiling gcc will 
not complain or bail out with an error, it'll just compile along 
producing a binary which can only be used on G5s. You can still use the 
flag on other than G5 Apple architectures, but to get usable binaries 
you need to add "-mcpu=7450", right after the "-fast" flag. You can try 
this yourself: write a simple, one liner, test.c C program and compile 
it with "gcc -fast test.c -o test", then use file(1) on it (you'll 
simply get "Mach-O executable ppc", thus revealing nothing) and try to 
execute it... see? now compile the same thing with "gcc -fast 
-mcpu=7450 test.c -o test" and try to execute it... what do you get? It 
looks like you have some autoconf script editing to do (lines trimmed 
for reasons of message size):

> /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. 
> -fast   -Wall -Wno-unknown-pragmas -pedantic -c -o aca.lo `test -f 
> 'aca.c' || echo './'`aca.c

	This next line also uses the "-fast" flag without "-mcpu=7450"....

> gcc -DHAVE_CONFIG_H -I. -I. -I.. -fast -Wall -Wno-unknown-pragmas 
> -pedantic -c aca.c -MT aca.lo -MD -MP -MF .deps/aca.TPlo -o aca.o

	Another one following...

> /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. 
> -fast   -Wall -Wno-unknown-pragmas -pedantic -c -o basic.lo `test -f 
> 'basic.c' || echo './'`basic.c

	Yet another one....

> gcc -DHAVE_CONFIG_H -I. -I. -I.. -fast -Wall -Wno-unknown-pragmas 
> -pedantic -c basic.c -MT basic.lo -MD -MP -MF .deps/basic.TPlo -o 
> basic.o
>
> [whole bunch of similar lines deleted]


	And probably a whole bunch of "-fast" flags without the corresponding 
"-mcpu=7450" !

	Another one following...

> /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. 
> -fast   -Wall -Wno-unknown-pragmas -pedantic -c -o uniformmatrix.lo 
> `test -f 'uniformmatrix.c' || echo

	And another one...

> gcc -DHAVE_CONFIG_H -I. -I. -I.. -fast -Wall -Wno-unknown-pragmas 
> -pedantic -c uniformmatrix.c -MT uniformmatrix.lo -MD -MP -MF 
> .deps/uniformmatrix.TPlo -o

	And another one...

> /bin/sh ../libtool --mode=link gcc  -fast   -Wall -Wno-unknown-pragmas 
> -pedantic  -release 1.2 -o libhmatrix.la -rpath /usr/local/lib  aca.lo 
> basic.lo bem3d.lo

	Should I keep on going? :-)

> /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. 
> -fast   -Wall -Wno-unknown-pragmas -pedantic -I../Library -c -o 
> netcdfsupport.lo `test -f 'netcdfsupport.c' || echo 
> './'`netcdfsupport.c

	As I was saying...

> gcc -DHAVE_CONFIG_H -I. -I. -I.. -fast -Wall -Wno-unknown-pragmas 
> -pedantic -I../Library -c netcdfsupport.c -MT netcdfsupport.lo -MD -MP 
> -MF .deps/

	What were we talking about?

> /bin/sh ../libtool --mode=link gcc  -fast   -Wall -Wno-unknown-pragmas 
> -pedantic -I../Library   -o libhcontrib.la -rpath /usr/local/lib  
> netcdfsupport.lo mkdir .libs

	I think I see something here....

> gcc -DHAVE_CONFIG_H -I. -I. -I..     -fast   -Wall 
> -Wno-unknown-pragmas -pedantic -I../Library -c `test -f 
> 'example_netcdf.c' || echo './'`example_netcdf.c

	And here....

> /bin/sh ../libtool --mode=link gcc  -fast   -Wall -Wno-unknown-pragmas 
> -pedantic -I../Library   -o example_netcdf example_netcdf.o 
> libhcontrib.la ../Library/libhmatrix.la 
> /System/Library/Frameworks/vecLib.framework/vecLib -lm

	Here...

> gcc -fast -Wall -Wno-unknown-pragmas -pedantic -I../Library -o 
> example_netcdf example_netcdf.o 
> /System/Library/Frameworks/vecLib.framework/vecLib 
> ./.libs/libhcontrib.a ../Library/.libs/libhmatrix.a -lm

	Here...

> gcc -DHAVE_CONFIG_H -I. -I. -I..     -fast   -Wall 
> -Wno-unknown-pragmas -pedantic -I../Library -c `test -f 
> 'example_simplefem.c' || echo './'`example_simplefem.c

	Here...

> /bin/sh ../libtool --mode=link gcc  -fast   -Wall -Wno-unknown-pragmas 
> -pedantic -I../Library  -static -o example_simplefem  
> example_simplefem.o ../Library/libhmatrix.la 
> /System/Library/Frameworks/vecLib.framework/vecLib -lm

	And here.

> gcc -fast -Wall -Wno-unknown-pragmas -pedantic -I../Library -o 
> example_simplefem example_simplefem.o 
> /System/Library/Frameworks/vecLib.framework/vecLib 
> ../Library/.libs/libhmatrix.a -lm
>
> [more of the same deleted]

	And more of the same you're going to have to fix! Just as the next 
line...

>
> /bin/sh ../libtool --mode=link gcc  -fast   -Wall -Wno-unknown-pragmas 
> -pedantic -I../Library  -static -o example_direct  example_direct.o 
> ../Library/libhmatrix.la 
> /System/Library/Frameworks/vecLib.framework/vecLib -lm

	And the next one...

> gcc -fast -Wall -Wno-unknown-pragmas -pedantic -I../Library -o 
> example_direct example_direct.o 
> /System/Library/Frameworks/vecLib.framework/vecLib 
> ../Library/.libs/libhmatrix.a -lm
>

	Hehe, that's a lot of editing you're going to have to do... or if you 
manage to regenerate the autoconf script with the "-mcpu=7450" flag 
passed to your compiler, it'll save you a lot of time and headaches. 
You can also use the "-O1", "-O2" or "-O3" optimization flags, which do 
not lock you into a single platform, but reportedly the "-fast" one is 
the best one out there; reading gcc's man page helps a lot in this 
respect. It was fun reading through the "autoconf shit"... ;-) Hope 
this helps you!

	Regards,...


		Juan



More information about the X-Unix mailing list