Error building Sage on Ubuntu Mate 16.04 LTS

73 views
Skip to first unread message

Christopher Phoenix

unread,
Jul 12, 2017, 9:12:18 PM7/12/17
to sage-support
I got an error building Sage due to a package failing to be built. I have a Lenovo Thinkpad 11e running Ubuntu Mate 16.04 LTS. Before beginning the build, I checked that I had all the dependencies and suggested packages installed beforehand. Then I pulled the code in through git and ran `make`. I set `MAKE='make -j5 -l4` to make the process a bit faster, since my cpu has 4 physical cores. Make ran for about 45 minutes or so before it stopped and reported this error:

Error building Sage.

The following package(s) may have failed to build (not necessarily
during
this run of 'make all'):

* package: openblas-0.2.19.p0
  log file
: /home/christopher/sagemath/sage/logs/pkgs/openblas-0.2.19.p0.log
  build directory
: /home/christopher/sagemath/sage/local/var/tmp/sage/build/openblas-0.2.19.p0

So I checked the log file and found a list of errors. The log reports that detecting the CPU failed and instructs me to set my cpu target explicitly.

make[3]: *** [getarch_2nd] Error 1
Makefile:123: *** OpenBLAS: Detecting CPU failed. Please set TARGET explicitly,
e
.g. make TARGET=your_cpu_target. Please read README for the detail..  Stop.
make
[3]: Leaving directory '/home/christopher/sagemath/sage/local/var/tmp/sage/build/openblas-0.2.19.p0/src'
Error building OpenBLAS

Above this I found a bunch of errors prefaced by `getarch_2nd.c`. To inexperienced me this looks consistent with what the log report said. It looks fixable, but this is my first time installing anything from source and I'm not entirely sure how to proceed. I'm guessing I have to set the TARGET env variable to my CPU manually for OpenBLAS, but still a bit hazy on how to do that!

My cpu is an Intel Celeron N2940 with 4 cores and a base clock of 1.83 Ghz, inxi reports this:

me@thinkpad11e:~$ inxi -C
CPU
:       Quad core Intel Celeron N2940 (-MCP-) cache: 1024 KB
           clock speeds
: max: 2249 MHz 1: 1140 MHz 2: 1569 MHz 3: 2245 MHz 4: 2247 MHz

Hope we can get this figured out soon! I'm eager to try Sagemath.

David Lowry-Duda

unread,
Jul 13, 2017, 7:51:23 PM7/13/17
to sage-support
Hello!

Firstly, if you are just trying to try Sagemath, you might consider installing a pre-built binary. See for instance: http://doc.sagemath.org/html/en/installation/binary.html
The first time I tried sage, I used a prebuilt binary on Ubuntu, and that worked very well for me.

Concerning OpenBLAS, you might try to enter the following command in the same terminal in which you are building sage.

export OPENBLAS_CONFIGURE="TARGET=ATOM"

This resolved the problem as reported in this other thread: https://groups.google.com/forum/#!topic/sage-devel/zQsZsivts0I

Good luck!

David Lowry-Duda

unread,
Jul 13, 2017, 8:23:19 PM7/13/17
to sage-support
I should also add a link to an old github issue, where I think this particular setting originally came from: https://github.com/xianyi/OpenBLAS/issues/983

Christopher Phoenix

unread,
Jul 15, 2017, 8:39:00 PM7/15/17
to sage-support
Thanks for the reply. I actually double-posted this, thinking that my first post was eaten (not having read that the posts from new members are held for moderation). Someone linked a discussion on sage-devel touching on the CPU detection issue. I think the OpenBLAS build issue is an up-stream issue regarding CPU detection.

I indeed set OPENBLAS_CONFIGURE="TARGET=ATOM" on my second attempt at building Sage, and it worked just fine. Just finished testing the installation yesterday. Three doctests timed-out but all the rest run a-ok, so I consider that a win. :-)

I wanted to try building a package from source, so I'm happy that I took this route. But having done it, I'd definitely recommend the pre-built binaries to anyone who isn't fairly familiar with the terminal. And it can take a looooong time. On my fairly modest hardware, it took over 4 hours to build Sage. Running all the doctests took several hours more.

I'd definitely do it again, though!
Reply all
Reply to author
Forward
0 new messages