I am wanting to build a calculator similar in form to the TI-92 using a Raspberry Pi Model B. Its most popular, Raspbian (based on Debian), comes with Wolfram Mathematica preinstalled, and I intend to have Octave, Maxima, and possibly other mathematical packages installed. I have decided that SAGE would be a great addition since it can provide a single interface to all of those tools and comes with numerous others. I found a binary of SAGE for the RPi, but it is old and I wanted to gain experience in compiling large packages.
I have installed all of the prerequisites. In order to save time in the compilation process, I have installed GCC 4.8 and ATLAS via apt-get.
raspberrypi
description: Computer
product: Raspberry Pi Model B
width: 32 bits
*-core
description: Motherboard
physical id: 0
capabilities: brcm_bcm2708
*-memory
description: System memory
physical id: 0
size: 435MiB
*-cpu
physical id: 1
bus info: cpu@0
size: 700MHz
capacity: 700MHz
capabilities: cpufreq
processor : 0
model name : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS : 2.00
Features : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7
Hardware : BCM2708
Revision : 000e
Serial : 000000006ae395ee
My list of installed apt-get
packages can be found in pkgs.log
. I am trying to compile
Linux raspberrypi 3.18.7+ #755 PREEMPT Thu Feb 12 17:14:31 GMT 2015 armv6l GNU/Linux
Raspbian GNU/Linux 7 \n \l
gcc-4.8 (Raspbian 4.8.2-21~rpi3rpi1) 4.8.2
g++-4.8 (Raspbian 4.8.2-21~rpi3rpi1) 4.8.2
GNU Fortran (Raspbian 4.8.2-21~rpi3rpi1) 4.8.2
This is the tree of my ATLAS installation.
/usr/lib/atlas-base
├── atlas
│ ├── libblas.so.3 -> libblas.so.3.0
│ ├── libblas.so.3.0
│ ├── liblapack.so.3 -> liblapack.so.3.0
│ └── liblapack.so.3.0
├── libatlas.so.3 -> libatlas.so.3.0
├── libatlas.so.3.0
├── libcblas.so.3 -> libcblas.so.3.0
├── libcblas.so.3.0
├── libf77blas.so.3 -> libf77blas.so.3.0
├── libf77blas.so.3.0
├── liblapack_atlas.so.3 -> liblapack_atlas.so.3.0
└── liblapack_atlas.so.3.0
1 directory, 12 files
I have created a script to run the build process…
#!/bin/sh
export CC='gcc-4.8' \
CXX='g++-4.8' \
FC='gfortran-4.8' \
SAGE_KEEP_BUILD_SPKGS='yes'
SAGE_INSTALL_GCC='no' \
SAGE_ATLAS_LIB='/usr/lib/atlas-base'
#Install prerequisites
sudo apt-get install gcc-4.8 g++-4.8 gfortran-4.8 \
libatlas3-base libatlas-dev libatlas-test libatlas-doc \
liblapack3 libblas3 libblas-dev \
tcl tk-dev dpkg-dev binutils \
texlive dvipng imagemagick
read -p "Prerequisites installed. Continue [y/n]? " cont
if [ "$cont=y" ]; then
cd sage-*
./configure | tee -a config.log
make | tee -a build.log
fi
Here is the output of Make starting at the first sign of error. I have attached iml-1.0.4p1.log
and atlas-3.10.2.log
.
...
checking for CBLAS... configure: WARNING: CBLAS not found!
Please make sure that --with-cblas=<linker flags> and optional --with-cblas-include=<path> and --with-cblas-lib=<path> are correctly set.
Trying legacy ATLAS configuration.
checking for ATLAS >= 3.0... configure: error: ATLAS not found!
ATLAS version 3.0 or greater is required for this library to compile. Please make sure ATLAS is installed and specify the header and libraries location with the options --with-atlas-include=<path> and --with-atlas-lib=<path> respectively when running configure.
Error configuring IML.
real 1m13.834s
user 0m34.830s
sys 0m11.480s
************************************************************************
Error installing package iml-1.0.4p1
************************************************************************
Please email sage-devel (http://groups.google.com/group/sage-devel)
explaining the problem and including the relevant part of the log file
/home/pi/Desktop/sage-6.5/logs/pkgs/iml-1.0.4p1.log
Describe your computer, operating system, etc.
If you want to try to fix the problem yourself, *don't* just cd to
/home/pi/Desktop/sage-6.5/local/var/tmp/sage/build/iml-1.0.4p1 and type 'make' or whatever is appropriate.
Instead, the following commands setup all environment variables
correctly and load a subshell for you to debug the error:
(cd '/home/pi/Desktop/sage-6.5/local/var/tmp/sage/build/iml-1.0.4p1' && '/home/pi/Desktop/sage-6.5/sage' --sh)
When you are done debugging, you can type "exit" to leave the subshell.
************************************************************************
Makefile:658: recipe for target '/home/pi/Desktop/sage-6.5/local/var/lib/sage/installed/iml-1.0.4p1' failed
make[2]: *** [/home/pi/Desktop/sage-6.5/local/var/lib/sage/installed/iml-1.0.4p1] Error 1
make[2]: Leaving directory '/home/pi/Desktop/sage-6.5/build'
Makefile:391: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/pi/Desktop/sage-6.5/build'
real 1m24.092s
user 0m41.020s
sys 0m12.750s
***************************************************************
Error building Sage.
The following package(s) may have failed to build:
package: iml-1.0.4p1
log file: /home/pi/Desktop/sage-6.5/logs/pkgs/iml-1.0.4p1.log
build directory: /home/pi/Desktop/sage-6.5/local/var/tmp/sage/build/iml-1.0.4p1
The build directory may contain configuration files and other potentially
helpful information. WARNING: if you now run 'make' again, the build
directory will, by default, be deleted. Set the environment variable
SAGE_KEEP_BUILT_SPKGS to 'yes' to prevent this.
Makefile:19: recipe for target 'build' failed
make: *** [build] Error 1
Note: libcblas
is clearly listed in /usr/lib/atlas-base
, and I believe it meets the requirements of these instructions. Specifically, this excerpt…
SAGE_ATLAS_LIB
- if you have an installation of ATLAS on your system and you want Sage to use it instead of building and installing its own version of ATLAS, set this variable to be the directory containing your ATLAS installation. It should contain the fileslibatlas
,liblapack
,libcblas
,libf77blas
(and optionally libptcblas and libptf77blas for multi-threaded computations), with extensions.a
,.so
, or.dylib
. For backward compatibility, the libraries may also be in the subdirectorySAGE_ATLAS_LIB/lib/
.
It still doesn’t work. I have also tried changing SAGE_ATLAS_LIB
to /usr/lib
. There are three possibilities I can think of: (1) the preprocessor can’t find the header files, (2) there is a permissions issue preventing the compiler from accessing the library files, or (3) the compiler is not finding the files because version numbers are appended to the extensions (ex: libcblas.so.3
instead of libcblas.so
). Any ideas?
I’ve tried all of those ideas, and none of them have worked. I have also found this discussion and tried some of its suggestions.