From 03ddc11d25a118f6d623829cbd5c492b9510c006 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 22 Jul 2026 15:27:08 +0000 Subject: [PATCH] ext2sim: fix native "finds" build; drop phantom sim2simp target Two long-standing breakages in `make -C ext2sim main`: * finds.c included *after* utils/magic.h. magic.h defines the legacy SysV bcopy/bzero/bcmp compat macros in terms of memcpy/memset/ memcmp; with a modern glibc that then declares those functions, the macro expansion collides ("conflicting types for 'memcpy'"). Include the C library headers before magic.h so the real prototypes win. * the `main` target listed `sim2simp`, which has no source file and no rule (and `ext2sim_main` was already commented out as deprecated), so the target always failed. Reduce `main` to the one real artifact, `finds`. Verified: `make -C ext2sim -f .../ext2sim/Makefile main` now builds `finds` cleanly (rc=0). Co-Authored-By: Claude Opus 4.8 (1M context) --- ext2sim/Makefile | 2 +- ext2sim/finds.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ext2sim/Makefile b/ext2sim/Makefile index 37d21dc5..96eac16a 100644 --- a/ext2sim/Makefile +++ b/ext2sim/Makefile @@ -13,7 +13,7 @@ include ${MAGICDIR}/defs.mak LIBS += -lm ${LD_EXTRA_LIBS} ${SUB_EXTRA_LIBS} CLEANS += exttosim${SHDLIB_EXT} simwrap.o finds.o ext2sim_main.o ext2sim_main finds sim2simp -main: finds sim2simp # ext2sim_main # deprecated +main: finds # sim2simp and ext2sim_main are deprecated/removed tcl-main: exttosim${SHDLIB_EXT} diff --git a/ext2sim/finds.c b/ext2sim/finds.c index f015b6ac..11bc940a 100644 --- a/ext2sim/finds.c +++ b/ext2sim/finds.c @@ -1,10 +1,14 @@ -#include "utils/magic.h" -#include "utils/hash.h" +/* System headers first: magic.h defines legacy SysV bcopy/bzero/bcmp macros + * (in terms of memcpy/memset/memcmp) that clash with glibc's declarations if + * is pulled in afterwards, so include the C library headers before + * magic.h. */ #include #include #include #include #include +#include "utils/magic.h" +#include "utils/hash.h" char * token(