[PR] checkasm: Fix building for macos/aarch64 (PR #24262)

Martin Storsjö via ffmpeg-devel <[email protected]>
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <[email protected]>
PR #24262 opened by Martin Storsjö (mstorsjo)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24262
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24262.patch

Commit 74705b3970cbc277e9366d82ee32d7c3a0a9e3b3 changed to only
compile some of the checkasm source files when they are expected
to be non-empty, but the condition for when perf/macos_kperf.c
is needed is wrong, breaking building checkasm in default macos
aarch64 configurations.

Checkasm decides whether to enable the macos kperf codepaths on
its own, irrespective of ffmpeg's configure's --enable-macos-kperf
(which defaults to disabled) - see the end of checkasm's
src/perf_internal.h for the condition.

To remedy this, replicate the condition for when the file will be
needed in ffmpeg's configure and emit a define to ffbuild/config.mak
about it, to allow controlling the conditional compilation of the
file.



From c2018ddaf170afc0a2542881deca74605d0ced26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <[email protected]>
Date: Tue, 25 Aug 2026 10:01:31 +0200
Subject: [PATCH] checkasm: Fix building for macos/aarch64

Commit 74705b3970cbc277e9366d82ee32d7c3a0a9e3b3 changed to only
compile some of the checkasm source files when they are expected
to be non-empty, but the condition for when perf/macos_kperf.c
is needed is wrong, breaking building checkasm in default macos
aarch64 configurations.

Checkasm decides whether to enable the macos kperf codepaths on
its own, irrespective of ffmpeg's configure's --enable-macos-kperf
(which defaults to disabled) - see the end of checkasm's
src/perf_internal.h for the condition.

To remedy this, replicate the condition for when the file will be
needed in ffmpeg's configure and emit a define to ffbuild/config.mak
about it, to allow controlling the conditional compilation of the
file.
---
 configure               | 15 +++++++++++++++
 tests/checkasm/Makefile |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 21128a80a0..6de8e1ab04 100755
--- a/configure
+++ b/configure
@@ -8812,6 +8812,21 @@ print_config HAVE_   "$config_files" $HAVE_LIST
 print_config CONFIG_ "$config_files" $CONFIG_LIST       \
                                      $CONFIG_EXTRA      \
 
+if enabled checkasm; then
+    # checkasm enables macos kperf on its own, irrespective of
+    # --enable-macos-kperf in ffmpeg's configure (which only affects use of
+    # macos kperf for the libavutil/timer.h macros now, and which defaults to
+    # disabled). In order to decide whether to compile the source file,
+    # replicate the condition here.
+    if enabled aarch64 and test_cpp_condition stddef.h \
+        "defined __APPLE__"; then
+        enable checkasm_macos_kperf
+    else
+        disable checkasm_macos_kperf
+    fi
+    print_config HAVE_ "ffbuild/config.mak" checkasm_macos_kperf
+fi
+
 echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
 
 # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 66e45d8830..90b5811d4f 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -115,7 +115,7 @@ EXT_CHECKASMOBJS-$(ARCH_ARM)                += ext/src/arm/checkasm_32.o \
                                                ext/src/arm/cpu.o ext/src/perf/arm.o
 EXT_CHECKASMOBJS-$(ARCH_LOONGARCH)          += ext/src/loongarch/checkasm.o
 EXT_CHECKASMOBJS-$(CONFIG_LINUX_PERF)       += ext/src/perf/linux.o
-EXT_CHECKASMOBJS-$(CONFIG_MACOS_KPERF)      += ext/src/perf/macos_kperf.o
+EXT_CHECKASMOBJS-$(HAVE_CHECKASM_MACOS_KPERF)+=ext/src/perf/macos_kperf.o
 EXT_CHECKASMOBJS-$(HAVE_RV)                 += ext/src/riscv/callcheck.o
 EXT_CHECKASMOBJS-$(ARCH_RISCV)              += ext/src/riscv/cpu.o
 EXT_CHECKASMOBJS-$(HAVE_X86ASM)             += ext/src/x86/checkasm.o
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.