Please read if you intend to edit any shell scripts, such as spkg-install.
I just tried to build Sage 4.3 on a Sun Blade 2000 running Solaris 8 - an old
operating system I know, but it shows once again how different systems can find
bugs that new ones do not.
The output from the python-2.6.2.p4.spkg is this:
---------------------------------------------------------------
python-2.6.2.p4/src/Tools/world/README
python-2.6.2.p4/src/Tools/world/world
Finished extraction
****************************************************
Host system
uname -a:
SunOS solaris8 5.8 Generic_108528-11 sun4u sparc SUNW,Sun-Blade-1000
****************************************************
****************************************************
CC Version
gcc -v
Using built-in specs.
Target: sparc-sun-solaris2.8
Configured with: ../gcc-4.0.4/configure --prefix=/usr/local/gcc-4.0.4
--enable-languages=c,c++,f95
Thread model: posix
gcc version 4.0.4
****************************************************
real 0m0.241s
user 0m0.010s
sys 0m0.020s
sage: An error occurred while installing python-2.6.2.p4
Please email sage-devel http://groups.google.com/group/sage-devel
-------------------------------------------------------------------
There is absolutely no hint of what error occurred, no message about how you
might try fixing it yourself using ./sage -sh etc. An inspection of
spkg-install, which I've reproduced below, shows a problem.
-----------------spkg-install -------------
# This tells Bash to exit the script if any statement returns a non-true
# value.
set -e
# PATCH
cp patches/ctypes__init__.py src/Lib/ctypes/__init__.py
if [ $? -ne 0 ]; then
echo "Error copying patched ctypes"
exit 1
fi
---------------------------------------------------
Should that copy fail (and I'm not saying that is the reason the Solaris 8 build
failed), the error message "Error copying patched ctypes" would NOT be shown.
The 'set -e' will cause the script to exit *immediately* the copy fails, before
the the next line, which checks for the error code.
Hence use 'set -e' with caution. It's pointless using it before any command
where you check the error code. It is worth using it before commands which you
doubt will fail, and feel the effort of testing each one individually is not
worthwhile.
In fact, looking at the python install script, it appears that every copy, with
the exception of one where an Itanium fix is applied, does actually get checked.
So on the whole, the spkg-install is reasonably robust. But adding the set -e at
the top stops all of the error checking occuring.
The way to use 'set -e' and and 'set +e' is as follows.
1) Use 'set -e' whenever you want to exit *immediately* if something fails, and
do not intend testing for any error.
2) The effect of 'set -e' can be switched off using 'set +e'
3) Put 'set -e' and 'set +e' between commands where you do not wish to bother
writing a test to catch an error. You might think its not worth checking the
following 3 commands for errors
rm -fr python/python2.6 python/python2.5
sleep 3
export LDFLAGS
in which case, wrap set -e and set +e around them. Then if they fail, the script
will exit with an error, but not indicate why the error occured.
# I doubt the following commands will fail, and if they
# do, I want to exit, and accept the user will not be told
# what the problem is.
set -e
rm -fr python/python2.6 python/python2.5
sleep 3
export LDFLAGS
set +e
It is much better to exit on errors than to simply carry on. But of course it's
better still if you can give feedback why the error occurred. But checking every
single command would be very tedious. You might find it a bit tedious to write
rm -fr python/python2.6 python/python2.5
if [ $? -ne 0 ]; then
echo "Error trying to delete some files"
exit 1
fi
sleep 3
if [ $? -ne 0 ]; then
echo "Error trying to sleep for 3 seconds, Perhaps the clock has failed!!!"
exit 1
fi
export LDFLAGS
if [ $? -ne 0 ]; then
echo "Error exporting LDFLAGS. Perhaps trade sanctions are in effect."
exit 1
fi
PS The main reason I decided to try a build on Solaris 8 was I needed more heat
in my garage to stop water pipes freezing. Last night I stuck a computer in
there, unconnected except to a mains socket. I thought that a bit of a waste of
CPU time, so are going to replace it with a machine which has an old version of
Solaris on it. If Sage builds on Solaris 8, then it should build on any Solaris
9 or Solaris 10 too. In contrast, building on Solaris 10 does not provide any
evidence it will build on Solaris 8.
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