Ask Your Question

Where to Set the environment variable SAGE_KEEP_BUILT_SPKGS to 'yes' to prevent make from removing what has built so far?

asked 2018-11-23 14:43:04 -0600

pavelsayekat gravatar image

updated 2018-12-02 05:46:40 -0600

I am building sage-8.4 on a RPI3B running Raspbian Stretch and it gets stuck in the documentation compiling section and if I terminate and redo the process with make -j4 as before then it says

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:31: recipe for target 'all-start' failed
make[1]: *** [all-start] Error 1
make[1]: Leaving directory '/home/pi/sage-8.4'
Makefile:13: recipe for target 'all' failed
make: *** [all] Error 2

So I have been able to avoid the above message by doing

$ ln -sf /usr/lib/arm-linux-gnueabihf/ /home/pi/sage-8.4/local/lib/

but then again if I redo the make process, the docs built so far removed and the process starts from beginning of documentation building.

So how do I do this? Will just putting export SAGE_KEEP_BUILT_SPKGS=yes in sage-8.4/src/bin/save-env-config suffice and if it does then how to achieve it? so far I failed to make it work.

edit retag flag offensive close merge delete


Are you building based on Python2 or Python3? For a Python3-based build, at this stage, the documentation is known not to build.

slelievre gravatar imageslelievre ( 2018-11-28 00:38:14 -0600 )edit

When running any shell command you can pass environment variables to it like:

$ SAGE_KEEP_BUILT_SPKGS=yes make build

If you want do it once for the same shell session do


If you want to keep some variables between shell sessions the way to do that is (depending on your shell) to set them in your local rc file for your shell (most shells will read .profile so you can put export <WHATEVER> there). This is just the general way to set environment variables.

Don't go modifying files in Sage's sources unless you know exactly what you're doing because they might get overwritten or otherwise not persist somehow.

It would be nice if SAGE_ variables like this were saved when running sage's ./configure, however.

Iguananaut gravatar imageIguananaut ( 2018-11-28 02:44:35 -0600 )edit

@slelievre the bare ./configure should default to python2 if not specified otherwise and that's my case, i. e. python2

@Iguananaut I tried something like that but i could not exactly understand what the dochtml.log meant in its messages even after following the suggestion.

pavelsayekat gravatar imagepavelsayekat ( 2018-11-28 08:44:39 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-11-29 03:55:11 -0600

Iguananaut gravatar image

I'm not sure what you're referring to in that log. It looks like the docs built successfully, minus one possibly spurious warning.

Upon re-reading your original post I think you're confused about the use of SAGE_KEEP_BUILT_SPKGS=yes. Your confusion is understandable--it shouldn't be outputting that message. That's just a generic message for some make target failures, but it's not applicable to the Sage documentation build.

edit flag offensive delete link more



I see now that you're saying it's getting "stuck" building the documentation. There is a known bug that the parallelized docbuild can hang in low-memory environments, which definitely is your case. You can mitigate it somewhat by running SAGE_NUM_THREADS=1 make doc. But I might suggest not building the docs on your RaspPi at all (just run make build to build everything but the docs) and, if you need to have the local HTML docs available, build them on a different system and copy them over. The Sage docbuild is very resource intensive.

Iguananaut gravatar imageIguananaut ( 2018-11-29 03:58:33 -0600 )edit

@Iguananaut among your latest two comments, the former one seems like the answer to my question. Even with the simple make command with export SAGE_KEEP_BUILT_SPKGS=yes starts building the doc from the beginning though the simple make successfully completes the doc building but make -j4 doesn't. And I'll keep in mind your second suggestion.

pavelsayekat gravatar imagepavelsayekat ( 2018-11-29 05:18:57 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-11-23 14:26:46 -0600

Seen: 141 times

Last updated: Dec 02