Skip to content

make clean is not enough for out-of-source builds #110704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
antocuni opened this issue Oct 11, 2023 · 3 comments · May be fixed by #112610
Open

make clean is not enough for out-of-source builds #110704

antocuni opened this issue Oct 11, 2023 · 3 comments · May be fixed by #112610
Labels
build The build process and cross-build type-bug An unexpected behavior, bug, or error

Comments

@antocuni
Copy link
Contributor

antocuni commented Oct 11, 2023

Bug report

Bug description:

  1. First, do a regular in-tree build:
cpython $ ./configure && make
  1. Then, try to make an out-of-tree build:
cpython $ mkdir debug
cpython $ cd debug
cpython/debug $ ../configure --with-pydebug && make
[...]
Error: The source directory (..) is not clean
Building Python out of the source tree (in /home/antocuni/pypy/misc/cpython/debug) requires a clean source tree (/home/antocuni/pypy/misc/cpython/debug/..)
Try to run: make -C ".." clean
  1. Now, if you try to run a top-level make clean as suggested, it's not enough:
cpytohn/debug $ make -C ".." clean
[...]
cpython/debug $ make
Error: The source directory (..) is not clean
Building Python out of the source tree (in /home/antocuni/pypy/misc/cpython/debug) requires a clean source tree (/home/antocuni/pypy/misc/cpython/debug/..)
Try to run: make -C ".." clean

(I also tried to cd .. && make clean).
The problem seems to be that check-clean-src checks for the presence of the ./python binary, which is not removed by make clean:
https://github.com/python/cpython/blob/982f1b7d6dc2f13b9607ce092e36e32972e3702c/debug/Makefile#L773-L785

If I remove it manually, the out-of-tree make works as expected

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

@antocuni antocuni added the type-bug An unexpected behavior, bug, or error label Oct 11, 2023
@Eclips4 Eclips4 added the build The build process and cross-build label Oct 11, 2023
@SnoopJ
Copy link
Contributor

SnoopJ commented Dec 1, 2023

I just had this problem while trying to run the WASI build using the script introduced by #112473, running make distclean resolved the problem.

Seems to me that the check target should recommend distclean instead of clean for the reasons you've identified.

@brettcannon
Copy link
Member

Do note I put the cleanup under distclean because it was easiest. If someone is motivated enough they could potentially get it moved.

@SnoopJ
Copy link
Contributor

SnoopJ commented Jan 30, 2024

Do note I put the cleanup under distclean because it was easiest. If someone is motivated enough they could potentially get it moved.

I opened #112610 because I think having a more helpful suggestion would probably be enough to resolve confusion for the case I ran into (i.e. hinting the user towards the alternate target they need). I don't know if it would be better to move this cleanup to another target, but the suggestion text is an easy change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants