Opened 6 years ago
Last modified 6 years ago
#21480 closed enhancement
Keep src/ clean by using --build-base when building sagelib — at Version 36
Reported by: | mkoeppe | Owned by: | |
---|---|---|---|
Priority: | blocker | Milestone: | sage-7.4 |
Component: | build | Keywords: | |
Cc: | felixs, jdemeyer, fbissey, embray, leif, vbraun, dimpase, jhpalmieri, vdelecroix, saraedum, slabbe, nthiery, mmezzarobba | Merged in: | |
Authors: | Matthias Koeppe | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | u/mkoeppe/keep_src__clean_by_using___build_base_when_building_sagelib (Commits, GitHub, GitLab) | Commit: | a854831e3274b69eadc52eb4642b8c0bd221a391 |
Dependencies: | Stopgaps: |
Description (last modified by )
Currently, building sagelib creates the src/build
directory, with subdirectories cython_debug
, cythonized
, lib.UNAME
, temp.UNAME
.
In preparation for VPATH builds of sage-the-distribution (#21469), let's keep src/
clean by using setup.py --build-base=$SAGE_BUILD_DIR/sagelib
($SAGE_BUILD_DIR
defaults to $SAGE_ROOT/var/tmp/sage/build/
)
As a second goal of this ticket, setup.sh
is put in charge of ALL sagelib building.
Some possibly useful information:
- Documentation on distutils (https://docs.python.org/2/install/), describing use of
--build-base
to do VPATH builds. pip install
keeps the source directory clean, building instead in a temporary directory, by copying the sources.pip install
also offers options--build
to select a build directory, but there are some pip issues: 2060, 2053, 804 that affect this- #14807 has some tricks to making VPATH builds work without copying all python source files. But it uses automake instead of setup.sh; we will not do this in our ticket.
Change History (36)
comment:1 Changed 6 years ago by
comment:2 in reply to: ↑ description ; follow-up: ↓ 4 Changed 6 years ago by
comment:3 Changed 6 years ago by
... and sagelib
perhaps with a version suffix.
comment:4 in reply to: ↑ 2 ; follow-up: ↓ 6 Changed 6 years ago by
Replying to leif:
Replying to mkoeppe:
In preparation for VPATH builds of sage-the-distribution (#21469), let's keep
src/
clean by usingsetup.py --build-base=$SAGE_ROOT/var/tmp/sage/build/sagelib
Please use
--build-base=$SAGE_BUILD_DIR/sagelib
.
Yes, the plan *after* #21469 is to use the Sage builddir -- not just for sagelib, but also for other packages.
*Before* #21469 is merged, I want to use $SAGE_ROOT/var/tmp/sage/build/sagelib
to match what other packages do.
comment:5 Changed 6 years ago by
- Description modified (diff)
Ah, I see what you meant, now I've found $SAGE_BUILD_DIR. Changed description accordingly.
comment:6 in reply to: ↑ 4 ; follow-up: ↓ 7 Changed 6 years ago by
Replying to mkoeppe:
Replying to leif:
Replying to mkoeppe:
In preparation for VPATH builds of sage-the-distribution (#21469), let's keep
src/
clean by usingsetup.py --build-base=$SAGE_ROOT/var/tmp/sage/build/sagelib
Please use
--build-base=$SAGE_BUILD_DIR/sagelib
.Yes, the plan *after* #21469 is to use the Sage builddir -- not just for sagelib, but also for other packages.
??? SAGE_BUILD_DIR
exists since years already... (Its default is $SAGE_ROOT/var/tmp/sage/build/
.)
*Before* #21469 is merged, I want to use
$SAGE_ROOT/var/tmp/sage/build/sagelib
to match what other packages do.
comment:7 in reply to: ↑ 6 Changed 6 years ago by
Replying to leif:
???
SAGE_BUILD_DIR
exists since years already... (Its default is$SAGE_ROOT/var/tmp/sage/build/
.)
Yes, thanks, see my other comment.
comment:8 Changed 6 years ago by
Ah ok, race condition.
comment:9 Changed 6 years ago by
By the way, help with implementing this change would be appreciated. I haven't looked at the sagelib build system at all so far.
comment:10 Changed 6 years ago by
- Branch set to u/mkoeppe/keep_src__clean_by_using___build_base_when_building_sagelib
comment:11 Changed 6 years ago by
- Commit set to e399bf41d805da7ea602daa5b554e0c7ecf2e7b5
New commits:
e399bf4 | First, wishful step
|
comment:12 Changed 6 years ago by
- Description modified (diff)
comment:13 Changed 6 years ago by
Really sagelib-$SAGE_VERSION
? Do you want to fill up everybody's hard disks with Sage build directories? Not to mention that this would require to rebuild everything whenever the Sage version changes.
comment:14 Changed 6 years ago by
- Description modified (diff)
comment:15 Changed 6 years ago by
Fine with me without $SAGE_VERSION; I was just following leif's suggestion in comment 3.
comment:16 follow-up: ↓ 17 Changed 6 years ago by
i understand that SAGE_BUILD_DIR is the srcdir for toplevel configure.
as long as sagelib is rooted in $(toplevel)/src, it might be less confusing to choose $SAGE_BUILD_DIR/src (not $SAGE_BUILD_DIR/sagelib) as the builddir for sagelib.
(future: replace src by sagelib, but on both ends)
i dont know exactly how the approach using setup.py will emulate VPATH builds. i think it should imitate "what automake would do", where applicable.
comment:17 in reply to: ↑ 16 Changed 6 years ago by
Replying to felixs:
i understand that SAGE_BUILD_DIR is the srcdir for toplevel configure.
No, it's $SAGE_ROOT/var/tmp/sage/build/
comment:18 Changed 6 years ago by
ok, nevermind (i meant to write "SAGE_BUILD_DIR is the *builddir* for toplevel"). that does not seem to be the case either.
still i am wondering why "src" does not (simply) translate to "src". (sure, i am slightly autotools biased).
comment:19 Changed 6 years ago by
- Commit changed from e399bf41d805da7ea602daa5b554e0c7ecf2e7b5 to a73fa065f5030c3b260c04a7e36867fd7f89362f
comment:20 Changed 6 years ago by
- Status changed from new to needs_review
Here's a first version for review. It seems to work for me.
There are still some to-do items (see comments in src/Makefile
):
- I am now using
--build-base
, but setup.sh also depends onSAGE_CYTHONIZED
, defined insrc/sage/env.py
.
I think it would be better if
setup.sh
instead inferred that location from the build-base that was passed to it.
However, setup.sh already does a lot of stuff depending on
SAGE_CYTHONIZED
beforedistutils.core.setup
is even called. Can this be fixed?
I think I could use some help from the Python experts in the cc list of this ticket on this.
sage/libs/pari/auto_gen.pxi
andsage/ext/interpreters/__init__.py
still need to be taken care of in preparation for the VPATH build.
comment:21 Changed 6 years ago by
- Description modified (diff)
comment:22 follow-ups: ↓ 26 ↓ 28 Changed 6 years ago by
- Status changed from needs_review to needs_work
Thinking about it more, I disagree with building in $SAGE_BUILD_DIR/sagelib
by default.
$SAGE_LOCAL
(which contains $SAGE_BUILD_DIR
) is meant as install directory, not as build directory.
Let's keep $SAGE_LOCAL
to be exactly the install directory and nothing else (*).
I do agree with making the build directory configurable for VPATH
builds. For typical packages however, if you do not do a VPATH
build, the build directory is the same as the source directory. Sage should follow the same model. This means that the build directory should be $SAGE_SRC
by default.
(*) One could argue that
$SAGE_BUILD_DIR
is currently used as build directory for packages. That is true, but they are only used temporarily, they are not meant to actually store stuff. So this isn't so bad.
comment:23 follow-ups: ↓ 24 ↓ 27 Changed 6 years ago by
Let's keep $SAGE_LOCAL to be exactly the install directory and nothing else (*).
this is part of the problem with the current "build system". SAGE_LOCAL is *not* the install directory. it is where stuff ends up during the build process.
outside sage, an install directory is typically what you pass to --prefix, and where stuff is put into by "make install". you do that (if you are a sysadmin), after assuring that "make check" passes...
yes i know why SAGE_LOCAL exists, but it should be clear that it's not necessary and that it only has "evolved" that way. having simplified things in the past, now it is falling on your feet.
note how i tried to fix/work\ around that in my attempt to autotoolize sage (both the library and the distribution)... my point: the best approach will be to *not use SAGE_LOCAL* at all. here's the chance to cleanup sagelib, as a start.
that said: keep up the good and interesting work @mkoeppe. i hope i will have some more time later this year ...
comment:24 in reply to: ↑ 23 Changed 6 years ago by
Replying to felixs:
this is part of the problem with the current "build system". SAGE_LOCAL is *not* the install directory.
Why do you think that $SAGE_LOCAL
is not the install directory? It is the directory where everything is installed, which by definition makes it the install directory. The fact that Sage does not (yet) support --prefix
doesn't change this fact.
the best approach will be to *not use SAGE_LOCAL* at all.
I like to know why you think that.
that said: keep up the good and interesting work @mkoeppe. i hope i will have some more time later this year ...
To be clear: I didn't say that this branch needs to be thrown out. I am just saying: keep the build directory configurable but keep the default what it currently is.
comment:25 follow-up: ↓ 29 Changed 6 years ago by
Why do you think that $SAGE_LOCAL is not the install directory?
you wrote it. "--prefix" is not implemented/supported. (but it should be). there's no way to really "install" stuff in the usual sense. e.g., there is no way to *install stuff after make check has passed*. (i don't know if toplevel make check is currently implemented at all, just a thought).
where everything is installed, which by definition makes it the install directory
actually nothing gets installed. what is done is mostly overhead. working around the fact that some packages don't work right after the build alone. when i was done with the "package content lists" for spkg-install, i noticed that it was a huge waste of time... don't repeat that, better just skip the "install" step.
I like to know why you think that [SAGE_LOCAL should not be used].
every instance/use of SAGE_LOCAL breaks sagelib on (lets call it) foreign distros a bit. that's not helpful. it will as well interfere with any attempt on rewriting sage-the-distribution (be it autotools based, or pip or ebuild). the autotools approach (not a necessary step, but an example) provides a transition path to anything...
sage-the-distribution is a platform for sage (core) development. no more, no less. other platforms will come and go. what is needed is sagelib without the dependency on this (and on SAGE_LOCAL). why: because developers should be able to use sagelib and develop sage extensions on *their own platforms*, with *their own* tools and *their own* review policies.
so: please embrace contributions that reduce the use of SAGE_LOCAL.
(yes, its getting off-topic. but i hope, this answers the question.)
comment:26 in reply to: ↑ 22 Changed 6 years ago by
Replying to jdemeyer:
Thinking about it more, I disagree with building in
$SAGE_BUILD_DIR/sagelib
by default.
$SAGE_LOCAL
(which contains$SAGE_BUILD_DIR
) is meant as install directory, not as build directory.Let's keep
$SAGE_LOCAL
to be exactly the install directory and nothing else (*).
I agree with you; see #21479.
comment:27 in reply to: ↑ 23 Changed 6 years ago by
Replying to felixs:
outside sage, an install directory is typically what you pass to --prefix, and where stuff is put into by "make install". you do that (if you are a sysadmin), after assuring that "make check" passes...
See #21479 for a discussion of --prefix
and make
vs. make install
.
But let's keep the discussion of the present ticket focused on the task at hand.
comment:28 in reply to: ↑ 22 Changed 6 years ago by
Replying to jdemeyer:
I do agree with making the build directory configurable for
VPATH
builds. For typical packages however, if you do not do aVPATH
build, the build directory is the same as the source directory. Sage should follow the same model. This means that the build directory should be$SAGE_SRC
by default.
I agree on this as well. #21469 (VPATH for distro) will do that.
In this ticket, I first want to make the --build-base
work. In particular, get rid of SAGE_CYTHONIZED.
This also works towards the eventual goal of making 'sagelib' pip-installable.
The actual location used is a detail that will be easy to change later.
(*) One could argue that
$SAGE_BUILD_DIR
is currently used as build directory for packages. That is true, but they are only used temporarily, they are not meant to actually store stuff. So this isn't so bad.
Yes, the current patch follows this practice. But this is temporary until #21469 is done.
comment:29 in reply to: ↑ 25 ; follow-up: ↓ 30 Changed 6 years ago by
Replying to felixs:
Why do you think that $SAGE_LOCAL is not the install directory?
you wrote it. "--prefix" is not implemented/supported.
The fact that the installation process does not implement ./configure --prefix
does not mean that it's not an installation process...
every instance/use of SAGE_LOCAL breaks sagelib
But why?
Of course, it's all a matter of definition. I consider the process of copying files to $SAGE_LOCAL
an "installation" and you do not (for reasons which are still unclear to me). I think things will become much simpler for you if you accept the fact that $SAGE_LOCAL
is the installation directory and that copying files to $SAGE_LOCAL
is an installation.
but i hope, this answers the question
I absolutely does not. You are just saying "it breaks stuff" but not explaining why.
comment:30 in reply to: ↑ 29 ; follow-up: ↓ 32 Changed 6 years ago by
Replying to jdemeyer:
Replying to felixs:
[...]
but i hope, this answers the question
I absolutely does not. You are just saying "it breaks stuff" but not explaining why.
One reason why is that in many deployment scenarios you will want to test what you have built before installing it. And Sage does not support this.
comment:31 follow-up: ↓ 34 Changed 6 years ago by
indeed. in "build"-"check"-"install" there is not much room for definitions of "build" and "install".
this is drifting towards the question of whether or not sage should stick to common practices and terminology. you know i think it should.
apologies for being off-topic again, this may be more related to #15105 -- there is no ticket for just "practices and terminology".
comment:32 in reply to: ↑ 30 Changed 6 years ago by
Replying to dimpase:
One reason why is that in many deployment scenarios you will want to test what you have built before installing it. And Sage does not support this.
How does this relate to the existence of $SAGE_LOCAL
?
comment:33 Changed 6 years ago by
- Commit changed from a73fa065f5030c3b260c04a7e36867fd7f89362f to a854831e3274b69eadc52eb4642b8c0bd221a391
Branch pushed to git repo; I updated commit sha1. New commits:
a854831 | Put setup.sh in charge of all sagelib building
|
comment:34 in reply to: ↑ 31 Changed 6 years ago by
Replying to felixs:
this is drifting towards the question of whether or not sage should stick to common practices and terminology. you know i think it should.
If those "common" practices and terminology make sense, of course it should.
Anyway, I am completely not following what you are trying to say. I feel that you are always wandering around my questions instead of answering them.
comment:35 Changed 6 years ago by
I have created #21495 as a place for such discussions.
comment:36 Changed 6 years ago by
- Description modified (diff)
Am interesting issue is that technically
cython_debug
has to be installed somewhere (preferably somewhere standard) to be accessible at runtime separately from the source.I do something in sage-on-gentoo but that's not really satisfactory.