On 10/28/10 06:37 AM, Minh Nguyen wrote:
Hi David,
On Thu, Oct 28, 2010 at 2:51 PM, Dr. David Kirkby
<[email protected]> wrote:
The fact Sage does not reliably respect the CC and CXX variables is a pain
if you want to use a non-GNU compiler, but I just found it causes problems
on openSUSE too. There g++ installs as /usr/bin/g++-4.5, not as 'g++'. So
I've got to create a link. Note a difficult task, but it would be much
better if Sage would consistently respect CC and CXX.
First, I'm sorry for appearing to be a noob about this issue. Could
you please provide an spkg whose spkg-install script doesn't respect
the CC and CXX variables? Or an example of an installation script,
code, etc. along this line? Furthermore, could you please provide
links to relevant documentation, standards, etc. explaining how to
write installation scripts that respect the CC and CXX variables? I'm
interested in learning how to make the compilation of Sage and its
standard spkg's more respectful of the CC and CXX variables. What
better way to learn than from an experienced Unix user such as
yourself.
ATLAS
http://trac.sagemath.org/sage_trac/ticket/7048
f2c
http://trac.sagemath.org/sage_trac/ticket/7027
This to me looks like the upstream source code has been modified. SPKG.txt says
"The one change is to use cc instead of gcc in the makefiles". I think the
comment is round the other way, and they have gcc instead of cc. The best answer
is to use $CC.
Flint
http://trac.sagemath.org/sage_trac/ticket/7024
(that might be fixed now, as Bill Hart said he would add it to his TODO list)
Palp
http://trac.sagemath.org/sage_trac/ticket/7071
Tachyon
http://trac.sagemath.org/sage_trac/ticket/7069
I can see SYMPOW is partially fixed, as it sometimes uses 'cc' and other times
uses 'gcc' if the environment variable CC is set to cc
cc -c -O1 -fPIC -g -DFAST -DALLTRUE mee.c
cc -c -O1 -fPIC -g -DFAST -DALLTRUE mem.c
gcc -O3 -g -W -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -c -o Coord.o
Coord.c
but there are probably others too. I gave up after fixing several .spkg files.
The basic problem is program that use 'gcc', 'g++' rather than use variable
names. If the environment variables CC and CXX are unset, then Sage sets them to
gcc and g++, which is quite a reasonable thing to do.
Some packages will then use there variable names $CC as a C compiler and $CXX as
a C++ compiler. However, some have gcc hard-coded in them. That causes a problem
if you try to use a compiler that's not called gcc or g++. Most obviously if you
use the Sun compiler (cc), but also if gcc/g++ happen to be installed as a
different name.
Usually substituting CC will get around the problem.
If you look at the Makefile for rubiks-20070912.p12/src/dietz/solver/Makefile
you will see it has
CC=g++
$(CC) $(CFLAGS) -c cubex.cpp
so it will always use g++, irrespective of how Sage sets CC or CXX.
In that case, since it's compiling a C++ file, the variable should be called
CXX, so changing to
$(CXX) $(CFLAGS) -c cubex.cpp
and removing the line
CC=g++
makes it use Sage's variable.
In other cases the fix is even simpler. I know in one case there was a bit of
code which has
CC=cc
then someone had changed that to
CC=gcc
so then I just removed the line completely, and it would then use whatever Sage
set CC to be.
My main motivation for fixing these was so the Sun compiler could be used, but
there is so much code that it will not compile, I gave up that idea.
But now I see it would be useful if CC was respected even on Linux, as you can't
specify a compiler like /bin/gcc-4.5, which is what it's called on openSUSE.
There are so many things weird about the Sage build process.
Dave
--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org