Cross-compilation of Sage ?

44 views
Skip to first unread message

Emmanuel Charpentier

unread,
Jul 14, 2013, 3:30:29 PM7/14/13
to sage-s...@googlegroups.com
I wonder how to create an i686 executable on an amd64 machine.

Rationale : I want to use sage on an an aging netbook (on which I *did* compile sage 5.9 successfully but quite slowly) refuses to compile sage 5.10 : I get bizarre crashes : the machines does an orderly shutdown ; the system log hints at an "excessive temperature" event which, given the season, does not utterly surprises me... Last time I compiled sage, we were in spring (with a rotten weather !), so it is possible that a bit of hot weather pushes the (already impressive) thermal envelope of a sage compilation a bit too far for this machine.

This kind of crash does not happen  in this machine's ordinary duty cycle (emacs, calling \LaTeX, a bit of R and sometimes a modest bit of Sage, plus the everyday chores of a notebook), so I'd like to keep this machine in active duty. But I'd rather not wait for the winter, nor emigrate to Terre Adélie...

How can I use a machine with more muscle (and a cooler head :-) to cross-compile an i686 binary tarball ? As far as I can remember, all the "other" machines I can use for this are amd64 machines.

Google is uncharacteristically mute on the subject. I found only mere  allusions to the problem of cross-compiling Sage for arm machines. Perusing the (recent) titles of sage-devel was not more helpful... The current README *does* explain how to create a "fat binary" tarball for covering (a lot of) variations of the *same* architecture, but does not contain one word on cross compilation.

Any hint ? Even "You're barking to the moon..." would be useful.

                                                     Emmanuel Charpentier

PS :of course, I could also use this problem as an excuse to get myself a better notebook :-). But that won't fly with my financer (i. e. myself...).

William Stein

unread,
Jul 14, 2013, 3:54:57 PM7/14/13
to sage-s...@googlegroups.com
On Sun, Jul 14, 2013 at 12:30 PM, Emmanuel Charpentier
<emanuel.c...@gmail.com> wrote:
> I wonder how to create an i686 executable on an amd64 machine.
>
> Rationale : I want to use sage on an an aging netbook (on which I *did*
> compile sage 5.9 successfully but quite slowly) refuses to compile sage 5.10
> : I get bizarre crashes : the machines does an orderly shutdown ; the system

Have you tried building using the system-wide ATLAS libraries, e.g.,

export SAGE_ATLAS_LIB = /usr/lib/

and something like this (you'll have to adapt it):

apt-get install libatlas3gf-base liblapack-dev
cd /usr/lib/
ln -s libatlas.so.3gf libatlas.so
ln -s libcblas.so.3gf libcblas.so
ln -s libf77blas.so.3gf libf77blas.so



> log hints at an "excessive temperature" event which, given the season, does
> not utterly surprises me... Last time I compiled sage, we were in spring
> (with a rotten weather !), so it is possible that a bit of hot weather
> pushes the (already impressive) thermal envelope of a sage compilation a bit
> too far for this machine.
>
> This kind of crash does not happen in this machine's ordinary duty cycle
> (emacs, calling \LaTeX, a bit of R and sometimes a modest bit of Sage, plus
> the everyday chores of a notebook), so I'd like to keep this machine in
> active duty. But I'd rather not wait for the winter, nor emigrate to Terre
> Adélie...
>
> How can I use a machine with more muscle (and a cooler head :-) to
> cross-compile an i686 binary tarball ? As far as I can remember, all the
> "other" machines I can use for this are amd64 machines.
>
> Google is uncharacteristically mute on the subject. I found only mere
> allusions to the problem of cross-compiling Sage for arm machines. Perusing
> the (recent) titles of sage-devel was not more helpful... The current README
> *does* explain how to create a "fat binary" tarball for covering (a lot of)
> variations of the *same* architecture, but does not contain one word on
> cross compilation.
>
> Any hint ? Even "You're barking to the moon..." would be useful.
>
> Emmanuel Charpentier
>
> PS :of course, I could also use this problem as an excuse to get myself a
> better notebook :-). But that won't fly with my financer (i. e. myself...).
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

Jean

unread,
Jul 15, 2013, 12:59:19 AM7/15/13
to sage-s...@googlegroups.com
Well, What about trying to compile Sage with your machine in your fridge? ;-)

Otherwise, try pointing a fan on your laptop (namely the keyboard portion), or install it on a large heat-conducting surface. Also, if your laptop is quite old, it may have collected an impressive amount of dust in its innards. If you can, a quick open-and-clean operation may prove beneficial.

And to answer your initial question on how to compile a 32bits executable on a 64bits machine: http://stackoverflow.com/questions/1272357/how-to-compile-a-32-bit-binary-on-a-64-bit-linux-machine-with-gcc-cmake . You will have to install all the 32 bits libraries. 

J.


Emmanuel Charpentier

unread,
Jul 15, 2013, 3:15:49 AM7/15/13
to sage-s...@googlegroups.com
Dear William,


Le dimanche 14 juillet 2013 21:54:57 UTC+2, William a écrit :
On Sun, Jul 14, 2013 at 12:30 PM, Emmanuel Charpentier
<emanuel.c...@gmail.com> wrote:
> I wonder how to create an i686 executable on an amd64 machine.
>
> Rationale : I want to use sage on an an aging netbook (on which I *did*
> compile sage 5.9 successfully but quite slowly) refuses to compile sage 5.10
> : I get bizarre crashes : the machines does an orderly shutdown ; the system

Have you tried building using the system-wide ATLAS libraries, e.g.,

  export SAGE_ATLAS_LIB = /usr/lib/

and something like this (you'll have to adapt it):

         apt-get install libatlas3gf-base liblapack-dev
         cd /usr/lib/
         ln -s libatlas.so.3gf libatlas.so
         ln -s libcblas.so.3gf libcblas.so
         ln -s libf77blas.so.3gf libf77blas.so

I do not understand how this could help  an overheating problem (on the target machine) or helping cross-compilation. Would you care to explain ?

[ Snip ... ]

                                                            Emmanuel Charpentier

Emmanuel Charpentier

unread,
Jul 15, 2013, 3:21:19 AM7/15/13
to sage-s...@googlegroups.com
Dear Jean,


Le lundi 15 juillet 2013 06:59:19 UTC+2, Jean a écrit :
Well, What about trying to compile Sage with your machine in your fridge? ;-)

Otherwise, try pointing a fan on your laptop (namely the keyboard portion), or install it on a large heat-conducting surface. Also, if your laptop is quite old, it may have collected an impressive amount of dust in its innards. If you can, a quick open-and-clean operation may prove beneficial.

I'm currently trying something a bit like this :-) And it seems to work so far...

And to answer your initial question on how to compile a 32bits executable on a 64bits machine: http://stackoverflow.com/questions/1272357/how-to-compile-a-32-bit-binary-on-a-64-bit-linux-machine-with-gcc-cmake . You will have to install all the 32 bits libraries. 

I am aware of this. But in this case, it involves also a serious wrestling session with Sage's makefiles, which are *not* that simple, to add the relevant flags. I am a bit out of my depth here...

                                                                      Emmanuel Charpentier

William Stein

unread,
Jul 15, 2013, 3:48:01 AM7/15/13
to sage-s...@googlegroups.com
Most of the build of Sage is building ATLAS, so doing something like
thew above would help with the overheating problem.

William

>
> [ Snip ... ]
>
> Emmanuel
> Charpentier

Emmanuel Charpentier

unread,
Jul 15, 2013, 4:14:35 AM7/15/13
to sage-s...@googlegroups.com
Dear William,
[ Hand slaps head ] Of course !

Which of course begs some questions :
1) Why is building ATLAS so hard|long ? (Yes, I saw wome threads on
sage-devel about this, butI was unable to get to the bottom of this).
2) Shouldn't this solution be implemented in the makefiles, at least as
an alternative (switch controlled) ?

This could also be applied to some standard packages (I'm thinking about
R, of course : the integrated version has problems on which I'll report
later...).But this might lead to some serious inconsistencies avoided by
the "batteries included" attitude. So I think that this kind of solution
cannot be standard, at best an alternative.

Emmanuel Charpentier

Jean

unread,
Jul 15, 2013, 9:46:28 AM7/15/13
to sage-s...@googlegroups.com
Also, you could install a virtual machine and install a 32bits linux to build sage.

J.


Jean-Pierre Flori

unread,
Jul 15, 2013, 12:32:27 PM7/15/13
to sage-s...@googlegroups.com
Because the point of ATLAS is to automatically tune itself and that takes a long time.
On usual systems it usually build quite fast because it can use precomputed tuning values ("architctural defaults") and will only go through a minimal amount of tuning.
But if your compiler/CPU/anything important else does not fit the set of shipped precomputed values then you'll have to go through the full tuning.
 
        2) Shouldn't this solution be implemented in the makefiles, at least as
an alternative (switch controlled) ?

As stated you can export SAGE_ATLAS_LIB=... and IIRC that's already documented in the "Install from source" part of the doc.
Reply all
Reply to author
Forward
0 new messages