This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Failure to build out of source from a not clean source
Type: behavior Stage: resolved
Components: Build Versions: Python 3.7, Python 3.6, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, vstinner, xdegaye
Priority: normal Keywords: patch

Created on 2017-11-03 14:10 by xdegaye, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 4255 merged xdegaye, 2017-11-03 14:24
PR 4340 merged xdegaye, 2017-11-08 15:31
PR 4342 merged xdegaye, 2017-11-08 15:52
Messages (12)
msg305486 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-11-03 14:10
The error message when building out of a not clean source tree:

renaming build/scripts-3.7/2to3 to build/scripts-3.7/2to3-3.7
renaming build/scripts-3.7/pyvenv to build/scripts-3.7/pyvenv-3.7
gcc -pthread   -Xlinker -export-dynamic -o Programs/_testembed Programs/_testembed.o libpython3.7m.a -lpthread -ldl  -lutil   -lm
gcc: error: Programs/_testembed.o: No such file or directory
make[1]: *** [Makefile:707: Programs/_testembed] Error 1
msg305492 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2017-11-03 18:03
What's "unclean" in this case? I mean you can always re-run Make after making changes and the build succeeds, so I'm not quite sure what leads to this state.
msg305521 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-11-03 23:11
When you build out of the source tree and this source tree has been built previously (by running 'make' in the source tree), then you get the error msg printed in msg305486 when you try to build *out* of this not clean source tree. The solution is to run 'make clean' in the source tree first.

The reason that one must use a clean source tree is that otherwise 'make' finds an existing Programs/_testembed.o file in the source tree as the prerequisite to the Programs/_testembed target, but cannot build this target since Programs/_testembed.o does not exist locally.

It is not obvious from the error message to understand the reason for the build failure and one can waste quite some time finding the solution.
msg305524 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-11-03 23:24
To build out of the 'src' source tree (a subdirectory of the current directory) in a 'build' subdirectory:

$ ls -ld src
drwxr-xr-x 21 xavier xavier 4.0K Nov  3 23:50 src/
$ mkdir build
$ cd build
$ $(cd ../src && pwd)/configure && make

This is useful when you build for multiple platform configurations. For example on Android one can build for multiple API versions and multiple architectures (x86_64, armv7, aarch64, ...).
msg305655 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-06 16:51
Note for myself: Xavier proposed PR 4255 fix :-)
msg305853 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-11-08 15:04
New changeset 0de92859caf25e65fc968d4bb68626e9ba21b851 by xdegaye in branch 'master':
bpo-31934: Abort when building out of a not clean source tree (GH-4255)
https://github.com/python/cpython/commit/0de92859caf25e65fc968d4bb68626e9ba21b851
msg305862 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-11-08 15:54
New changeset 0c4785bf39b4e86dea3a70b651e5d5db2f2cf017 by xdegaye in branch '3.6':
[3.6] bpo-31934: Abort when building out of a not clean source tree (GH-4255). (#4340)
https://github.com/python/cpython/commit/0c4785bf39b4e86dea3a70b651e5d5db2f2cf017
msg305864 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-08 15:57
I tested manually the commit 0c4785bf39b4e86dea3a70b651e5d5db2f2cf017 merged into Python 3.6: it works as expected ;-)
msg305870 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-11-08 16:01
I also tested the 2.7 and 3.6 PRs before submitting them.
Thanks for testing and for your reviews Victor :-)
msg305871 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-08 16:02
> I also tested the 2.7 and 3.6 PRs before submitting them.

Oh, I don't trust anyone, including myself :-) Since there is no automated, I chose to ("double") test manually your PRs.
msg305874 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-11-08 16:05
Oh I understand, there is no practical way to test that feature except manually.
msg305875 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-11-08 16:10
New changeset fbdd3eeba3e526e162f2eb54d224cf36ed8cfea1 by xdegaye in branch '2.7':
[2.7] bpo-31934: Abort when building out of a not clean source tree (GH-4255). (#4342)
https://github.com/python/cpython/commit/fbdd3eeba3e526e162f2eb54d224cf36ed8cfea1
History
Date User Action Args
2022-04-11 14:58:54adminsetgithub: 76115
2017-11-08 16:25:49vstinnersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-11-08 16:10:19xdegayesetmessages: + msg305875
2017-11-08 16:05:47xdegayesetmessages: + msg305874
2017-11-08 16:02:27vstinnersetmessages: + msg305871
2017-11-08 16:01:07xdegayesetmessages: + msg305870
2017-11-08 15:57:35vstinnersetmessages: + msg305864
2017-11-08 15:54:09xdegayesetmessages: + msg305862
2017-11-08 15:52:14xdegayesetpull_requests: + pull_request4298
2017-11-08 15:31:21xdegayesetpull_requests: + pull_request4294
2017-11-08 15:04:02xdegayesetmessages: + msg305853
2017-11-06 16:51:21vstinnersetnosy: + vstinner
messages: + msg305655
2017-11-03 23:24:09xdegayesetmessages: + msg305524
2017-11-03 23:11:14xdegayesetmessages: + msg305521
2017-11-03 18:03:02brett.cannonsetnosy: + brett.cannon
messages: + msg305492
2017-11-03 14:24:41xdegayesetkeywords: + patch
stage: patch review
pull_requests: + pull_request4217
2017-11-03 14:10:57xdegayecreate