Can I prevent gcc building code for later processors?

Dr. David Kirkby david.kirkby@onetel.net
Sat Jul 31 04:48:00 GMT 2010


I wish to compile Sage, which is a huge bit of maths software (300 MB source code)

http://www.sagemath.org/

Many of the parts in that code try to optimise the software for the particular 
processor. Usually they select the fastest options for the CPU. Since Sage 
consists of about 100 different packages, I can't easily control the flags each 
part gets built with. (CFLAGS will be ignored by much of Sage)

Building for the current CPU is fine if one wishes to build on the same machine 
as one wants to run on, but is a pain if you want to distribute a binary for 
someone else to use.

I hit this problem, when I built Sage on an UltraSPARC III+ processor and 
someone tried to use it on an older UltraSPARC IIe processor. He got an error, 
which looks to me like its due to code for an inappropiate processor

ImportError: ld.so.1: python: fatal:
 >/user/hilbert/bin/sage-4.5.1-Solaris_10_SPARC-sun4u-SunOS/local/lib//libgmp.so.3:
 >:
 >   bad ELF flags value: [ EF_SPARC_32PLUS EF_SPARC_SUN_US1 EF_SPARC_SUN_US3 ]

I'm guessing the EF_SPARC_SUN_US3 if or an UltraSPARC III processor, which this 
person did not have.

Is there any way I can configure gcc whilst building it, so that it positively 
will *never* generate code for later processors, irrespective of what options 
might be sent to the compiler?

Dave



More information about the Gcc-help mailing list