musl-cross-make cross compiling and specifying "--with-libc=/custom/path/to/libc.so" is dismissed

Abierto
#97,842 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
python

Línea de trabajo

Comienza con la receta de compilación en modules/python y el config.log generado; después, sigue cómo configure gestiona --with-libc durante la ruta de compilación cruzada. Compara los parches de Python de OpenWrt documentados y el fallo de CircleCI para identificar dónde se selecciona la libc del host. Se considera terminado cuando se usa la libc especificada compilada de forma cruzada en lugar de /usr/lib/x86_64-linux-gnu/libc.so.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

build type-bug

Bug report

Trying to integrate CPython 3.9.2 under Heads firmware (coreboot+linux payload). This is followup of old integration issue at https://github.com/osresearch/heads/issues/689

CPython 3.9.2 (as all other modules under Heads but coreboot) is built by first building musl-cross-make and then having modules being build with musl-cross-make to have reproducible build environment, so that coreboot payload' linux kernel's initrd contains binaries needed in linux embedded environment (recovery shell and associated tools), are reproducible (this is the goal).

Your environment

  • CPython versions tested on: 3.9.2 installed to build target 3.9.2 python
  • Operating system and architecture: debian-11 host build environement

I'm experimenting with the following build recipe, and did a lot of variation without success https://github.com/osresearch/heads/blob/df50c5f7d242b502fc443157fd592b638da87af0/modules/python#L13-L33.

This results in configure script producing the following config.log output:
config.log

So above build recipe produces:

  • a correct ./configure callm specifying ./configure --enable-optimizations --with-cxx-main=/home/user/heads/crossgcc/x86/bin/x86_64-linux-musl-gcc --with-libc=/home/user/heads/crossgcc/x86/x86_64-linux-musl/lib/libc.so --host x86_64-linux-musl --build x86_64 --disable-ipv6 --prefix= --exec-prefix=
  • --with-libc="$(musl-cross_libraries)" translates into config.log, correctly, into configure:14435: result: set LIBC="/home/user/heads/crossgcc/x86/x86_64-linux-musl/lib/libc.so". This is the libc.so we need to rely on
  • Unfortunately, the build fails (See in CircleCI logs here) with libc being completely dismissed. This results into error : ImportError: /usr/lib/x86_64-linux-gnu/libc.so: invalid ELF header. This is the wrong libc.so of the host, not of the cross built environment.

Expected behavior:

  • Specifying --with-libc=/home/user/heads/crossgcc/x86/x86_64-linux-musl/lib/libc.so should result in libc.so used from /home/user/heads/crossgcc/x86/x86_64-linux-musl/lib/libc.so not /usr/lib/x86_64-linux-gnu/libc.so.

Why is the host libc used even when libc is specified and found at configure?


Was gonna investigate and adapt OpenWrt patches at https://github.com/openwrt/packages/tree/master/lang/python/python3/patches but reading about cross build issues it would be better to have this fixed upstream then downstream into all projects trying to cross build for their embedded systems.

Any insight?

Lenguaje dominante
Python
Estrellas
77.2k
Forks
36k
Merge medio
1 d 9 h
PR fusionados (30 d)
558

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de python/cpython

Todos los issues de python/cpython

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.