Termux compilation failure

Abierto Apto para principiantes
#9,122 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
android, cmake, cpp
Área
build-system

Línea de trabajo

Start with src/include/86box/plat_dir.h, especially the platform condition around lines 20–21, and check the Termux build output included in the issue. Verify whether the conditional still needs to define its own dirent and DIR types now that the header includes <dirent.h>. Done means the project builds in Termux without the redefinition errors.

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

Descripción

bug
Checklist
  • I have searched the issue tracker and was unable to find an open or closed issue matching what I'm seeing.
  • I have verified that the issue is happening in the latest nightly build, or the latest commit, if building from source.
What happened?
~/86Box $ cmake --build build -j$(nproc)
[1/2] Building CXX o...sd.dir/osd_core.cpp.
FAILED: [code=1] src/osd/CMakeFiles/osd.dir/osd_core.cpp.o
/data/data/com.termux/files/usr/bin/c++ -DCMAKE -DUSE_DYNAREC -I/data/data/com.termux/files/usr/include/freetype2 -I/data/data/com.termux/files/home/86Box/build/src/include -I/data/data/com.termux/files/home/86Box/src/include -I/data/data/com.termux/files/home/86Box/src/cpu -I/data/data/com.termux/files/home/86Box/src/codegen -I/data/data/com.termux/files/home/86Box/src/osd -I/data/data/com.termux/files/home/86Box/src/osd/imgui -O3 -DNDEBUG -std=gnu++17 -fomit-frame-pointer -Wall -fno-strict-aliasing -march=armv8-a -g0 -O3 -MD -MT src/osd/CMakeFiles/osd.dir/osd_core.cpp.o -MF src/osd/CMakeFiles/osd.dir/osd_core.cpp.o.d -o src/osd/CMakeFiles/osd.dir/osd_core.cpp.o -c /data/data/com.termux/files/home/86Box/src/osd/osd_core.cpp
In file included from /data/data/com.termux/files/home/86Box/src/osd/osd_core.cpp:50:
In file included from /data/data/com.termux/files/home/86Box/src/osd/osd_explorer.hpp:8:
In file included from /data/data/com.termux/files/home/86Box/src/osd/filesystem.hpp:17:
/data/data/com.termux/files/home/86Box/src/include/86box/plat_dir.h:29:8: error: redefinition of 'dirent'
   29 | struct dirent {
      |        ^
/data/data/com.termux/files/usr/bin/../../usr/include/dirent.h:78:8: note: previous definition is here
   78 | struct dirent { __DIRENT64_BODY };
      |        ^
In file included from /data/data/com.termux/files/home/86Box/src/osd/osd_core.cpp:50:
In file included from /data/data/com.termux/files/home/86Box/src/osd/osd_explorer.hpp:8:
In file included from /data/data/com.termux/files/home/86Box/src/osd/filesystem.hpp:17:
/data/data/com.termux/files/home/86Box/src/include/86box/plat_dir.h:45:3: error: typedef redefinition with different types ('struct DIR_t' vs 'struct DIR')
   45 | } DIR;
      |   ^
/data/data/com.termux/files/usr/bin/../../usr/include/dirent.h:94:20: note: previous definition is here
   94 | typedef struct DIR DIR;
      |                    ^
2 errors generated.
ninja: build stopped: subcommand failed.

The root cause is here:
https://github.com/86Box/86Box/blob/fc7603abcf04b09aa7cf178e8c703daf8ec104f6/src/include/86box/plat_dir.h#L20-L21

|| defined(__TERMUX__) was introduced in 2023 when plat_dir.h still included <sys/dir.h>, which was a legacy BSD compatibility header, apparently not available in Termux. Now that the standard POSIX <dirent.h> is included instead, this workaround is no longer necessary and actually breaks the build.

Configuration file
None
Operating system

Android 17

86Box version

v7.0 master

Build architecture

Linux - ARM (64-bit)

Build type
  • New recompiler
  • Debug build
Additional context

No response

Lenguaje dominante
C
Estrellas
4.9k
Forks
620
Merge medio
5 h 56 min
PR fusionados (30 d)
458

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

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 86Box/86Box

Todos los issues de 86Box/86Box

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.