ext2sim: fix native "finds" build; drop phantom sim2simp target

Two long-standing breakages in `make -C ext2sim main`:

* finds.c included <string.h> *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) <noreply@anthropic.com>
This commit is contained in:
Darryl L. Miles 2026-07-22 15:27:08 +00:00 committed by R. Timothy Edwards
parent 88411e3387
commit 03ddc11d25
2 changed files with 7 additions and 3 deletions

View File

@ -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}

View File

@ -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
* <string.h> is pulled in afterwards, so include the C library headers before
* magic.h. */
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <ctype.h>
#include <string.h>
#include "utils/magic.h"
#include "utils/hash.h"
char *
token(