kivy / kivy/python-for-android
Prepending CC with ccache confuses some build systems
- Lenguaje dominante
- Python
- Estrellas
- 8.9k
- Forks
- 2k
- Merge medio
- 12 h 20 min
- PR fusionados (30 d)
- 9
Descripción
I recently created a recipe to build python-zstandard, a Python module with a native component. I encountered an issue where the build script was attempting to run `ccache` on its own with some compiler flags, similar to #1398. This happened because:
- We have ccache installed on the host.
- In python-for-android, if `ccache` is available (and not disabled), it is prepended to `CC`: https://github.com/kivy/python-for-android/blob/develop/pythonforandroid/archs.py#L158-L195. This results in something like `CC="ccache gcc"`.
- In python-zstandard's build system, it assumes the first item in `CC` is the _compiler_, and uses that on its own, adding a new set of parameters: https://github.com/indygreg/python-zstandard/blob/main/make_cffi.py#L31-L66. This is frustrating, [but not an uncommon assumption](https://codesearch.debian.net/search?q=compiler.compiler[0]&literal=1).
Since I have the luxury of a project that only needs to build one way, this is how I worked around it on my end:
https://github.com/endlessm/kolibri-installer-android/commit/7e4eab72da2e888d59fc058f9c36ad636a64e3b8
So, instead of patching the module or changing the environment variable, I told P4A to stop thinking about ccache, and enabled it _on the host_ by setting `PATH="/usr/lib/ccache:$PATH"`. This works because `/usr/lib/ccache` is a directory full of look-alikes for different compilers, all of which point to `ccache`. It is one of two recommended ways to use ccache: https://manpages.ubuntu.com/manpages/jammy/man1/ccache.1.html.
My suggestion here is that the current approach is problematic, and perhaps dealing with ccache on the host instead of in P4A would be a good practice to recommend in general.
Guía de contribución
Línea de trabajo
Comienza con pythonforandroid/archs.py en las líneas 158-195, revisa después la discusión enlazada de #1398 y las indicaciones sobre el uso de ccache. Determina si el proyecto debe cambiar la gestión de CC o recomendar la configuración de ccache en el host; se considerará terminado cuando el enfoque elegido esté claramente documentado o implementado y se haya verificado su impacto en el build.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- android, python
- Área
- build-system, mobile-dev
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 30/100