Visitar URL original
bpo-35921: Use ccache if available by pitrou · Pull Request #11773 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20250626021549/https://github.com/python/cpython/pull/11773
Skip to content

bpo-35921: Use ccache if available #11773

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

Closed
wants to merge 1 commit into from

Conversation

pitrou
Copy link
Member

@pitrou pitrou commented Feb 6, 2019 •

Once the compile cache is primed, compilation becomes much faster
("make" finishes in 4 seconds here)

https://bugs.python.org/issue35921

Once the compile cache is primed, compilation becomes much faster
("make" finishes in 4 seconds here)
@tiran
Copy link
Member

tiran commented Feb 6, 2019

-1

The preferred way to enable ccache is to modify PATH env var. I have been using ccache for many years that way. On Fedora ccache PATH is automatically handled by the ccache package. On Debian you may have to modify PATH yourself.

@matrixise
Copy link
Member

Hi @pitrou and @tiran

For my part, I use this script for the compilation step

#!/usr/bin/env fish

set number_of_cpu (python3 -c "import os; print(os.sysconf('SC_NPROCESSORS_ONLN'))")

./configure --prefix=$PWD-build --with-pydebug --silent -C > stdout.txt ^ stderr.txt
make CC="/usr/bin/ccache gcc" --jobs $number_of_cpu --silent > stdout.txt ^ stderr.txt 

I use the cache of configure and ccache with make. really useful.

@nascheme
Copy link
Member

nascheme commented Feb 7, 2019

On Debian, I do:

CC='ccache gcc' ../configure [...]

Seems quite simple to me. I also have the following shell function:

    # run make with -j4 if inside CPython build dir
    make () {
        if test -e pyconfig.h; then
            /usr/bin/make -j4 "$@"
        else
            /usr/bin/make "$@"
        fi
    }

Years ago I totally rewrote the Python Makefile to make parallel builds useful. Now that we use setup.py for more stuff, some of that parallelism is lost. Also, over the years people have been making changes to the Makefile without understanding how to do dependancies correctly (or they just didn't care). So, the Makefile itself is a lot less parallizable compared to previous versions.

@pitrou
Copy link
Member Author

pitrou commented Feb 7, 2019

Yes, it's always possible to have your own build scripts etc. It just makes things more manual. But I won't claim this PR is revolutionary ;-)

@nascheme setup.py is supposed to handle parallelization. But I think that depends if the _multiprocessing extension is already built when running it (i.e. it will work in a rebuild scenario).

@remilapeyre
Copy link
Contributor

Hi @pitrou, one shortcoming of the current PR is that it uses ccache if it is available, but you did not add any mention in the build instructions or the dev guide about it.

It will only be useful for people that have installed ccache without knowing (is that possible?) and newcomers won't be able to benefit from it.

Maybe a mention in the build instructions and the dev guide would be enough to accomplish what you are trying to do.

@pitrou
Copy link
Member Author

pitrou commented Feb 8, 2019

@remilapeyre Yes, that makes sense, but first I'll wait to see whether this PR gains traction or not.
(also, it produces weird build failures on Travis, which would have to be diagnosed and fixed)

@ambv
Copy link
Contributor

ambv commented Sep 24, 2021

Per consensus on the issue and here, I'm closing this.

@ambv ambv closed this Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants