On 11/22/10 07:55 AM, Peter Jeremy wrote:
On 2010-Nov-20 19:09:00 -0800, John H Palmieri<jhpalmier...@gmail.com> wrote:
Is that the compiler flag "-m64" has no effect on other systems? Some
spkg-install files just check whether SAGE64 is set, not the platform,
and then they add -m64 to the flags. So if that does anything on
linux, then SAGE64 can be used on linux.
'-m64' is recognized by gcc and the SunPRO compilers. It's not recognized
by the HP Tru64 C compiler (which is natively 64-bit). I can't comment
on any other compilers.
-m64 is not reconised by the HP compiler on HP-UX (where one needs +DA2.OW or
+DD64 depending on the CPU type).
Neither is -m64 reconised by IBM's compiler on AIX, where one needs -q64.
So there are a few cases where -m64 is not appropriate. At some point in the
future, who knows what other systems or compilers will not want -m64?
Generically adding '-m64' when SAGE64 is set is definitely wrong because
not all compilers will support that flag. In addition, gcc treats x86
and x86_64 as different variants of the one architecture - so gcc on a
32-bit platform can compile x86_64 code. On 32-bit x86 Linux and *BSD,
using '-m64' will cause gcc to build x86_64 code - which the kernel won't
be able to execute - so this is highly undesirable.
But if SAGE64 is set to "yes", then adding an appropriate flag should not be a
problem.
If SAGE64 is set to anything other than "yes", and a compiler flag like -m64 was
added, then clearly that would be stupid.
Ideally, all skpg files should inherit {C,CPP,CXX,FC,LD}FLAGS from the
environment (adding spkg-specific options if required). This would
allow SAGE64 to be processed in one spot fairly early on in the build
- adding '-m64' or equivalent to {C,FCC,FC,LD}FLAGS, which is then
inherited by all succeeding spkg builds. This would remove a lot of
special-casing from the build.
Agreed.
I tried that before
http://trac.sagemath.org/sage_trac/ticket/7818
so every package would get a common set of flags, unless they were set
otherwise. Those flags were -g -Wall for gcc, but changed for non-GNU compilers
and 64-bit builds.
But doing this removes the -fno-strict-aliasing option from the gcc options that
Cython uses, which broke things all over the place.
IMHO, it is a fault of Cython. But that ticket caused so much hassle, I have
given up trying to fix it.
The CFLAG64 option is not an ideal solution but came about by the following set
of circumstances.
1) Micheal made the variable add -m64 *only* on OS X.
2) I change some instance of it so it worked on both Solaris and OS X, since I
knew both the Sun and GNU compilers accepted this option. At this point, I gave
no consideration to other platforms.
3) Later I since realised that (2) was a bit dumb, as potentially one could use
another operating system, and potentially the flag might not be -m64. AIX and
HP-UX are examples of this, but there may be others now or in the future.
So more recent changes made by me should allow any user-specificed flag(s) to be
set for 64-bit builds, but the will default to -m64 if SAGE64=yes.
Dave
--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org