PR #24588 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24588
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24588.patch

This reverts commit 59dd21047e86badeb1b142dff03f18acbbd074fa.

The new tool does not properly resolve relative paths on MSYS2, and
potentially other targets.
It tries to make paths relative that are outside of the virtual MSYS
root dir, trying to .. below it. Resulting in invalid paths that send
MSYS make into an infinite loop somehow.


>From fddc59cf34b303a269493aaf7ec7c80e390f25f5 Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <[email protected]>
Date: Sun, 20 Sep 2026 21:15:41 +0200
Subject: [PATCH] Revert "Makefile: output MSVC dependency files as a byproduct
 of compilation"

This reverts commit 59dd21047e86badeb1b142dff03f18acbbd074fa.

The new tool does not properly resolve relative paths on MSYS2, and
potentially other targets.
It tries to make paths relative that are outside of the virtual MSYS
root dir, trying to .. below it. Resulting in invalid paths that send
MSYS make into an infinite loop somehow.
---
 Makefile                | 13 -------------
 configure               | 10 +++++++++-
 ffbuild/common.mak      | 19 +++++++++----------
 libswscale/x86/Makefile |  2 +-
 tools/Makefile          | 16 ++++++++--------
 5 files changed, 27 insertions(+), 33 deletions(-)

diff --git a/Makefile b/Makefile
index b8ecf5be42..1fe6549ba8 100644
--- a/Makefile
+++ b/Makefile
@@ -47,19 +47,6 @@ SKIPHEADERS = compat/w32pthreads.h
 # first so "all" becomes default target
 all: all-yes
 
-# cl.exe cannot write make dependency files directly, the mscl helper
-# converts its -showIncludes output into .d files.
-MSCL := $(if $(filter -showIncludes,$(CC_DEPFLAGS) $(CXX_DEPFLAGS) 
$(OBJCC_DEPFLAGS) $(AS_DEPFLAGS) $(HOSTCC_DEPFLAGS)),ffbuild/mscl$(HOSTEXESUF))
-ifneq ($(MSCL),)
-MSCLCC := $(HOSTCC)
-$(foreach V,CC CXX OBJCC HOSTCC AS,\
-    $(if $(filter -showIncludes,$($(V)_DEPFLAGS)),$(eval $(V) := $(MSCL) 
$($(V)))))
-HOSTPROGS += ffbuild/mscl
-
-ffbuild/mscl.o: $(SRC_PATH)/compat/windows/mscl.c
-       $(MSCLCC) $(HOSTCCFLAGS) $(HOSTCC_C) $(HOSTCC_O) $<
-endif
-
 include $(SRC_PATH)/tools/Makefile
 include $(SRC_PATH)/ffbuild/common.mak
 
diff --git a/configure b/configure
index 035d4d090a..6901344317 100755
--- a/configure
+++ b/configure
@@ -5388,7 +5388,15 @@ probe_cc(){
         else
             _ident=$($_cc --version 2>/dev/null | head -n1 | tr -d '\r')
         fi
-        _depflags='-showIncludes'
+        if [ -x "$(command -v wslpath)" ]; then
+            _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk 
'\''/including/ { sub(/^.*file: */, ""); if (!match($$0, / /)) { print $$0 } 
}'\'' | xargs -r -d\\n -n1 wslpath -u | awk '\''BEGIN { printf "%s:", "$@" }; { 
sub(/\r/,""); printf " %s", $$0 }; END { print "" }'\'' > $(@:.o=.d)'
+
+        else
+            _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk 
'\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) 
print "$@:", $$0 }'\'' > $(@:.o=.d)'
+        fi
+        _DEPFLAGS='$(CPPFLAGS) -showIncludes -Zs'
+        _DEPCCFLAGS='$(CFLAGS)'
+        _DEPCXXFLAGS='$(CXXFLAGS)'
         _cflags_speed="-O2"
         _cflags_size="-O1"
         if $_cc -nologo- 2>&1 | grep -q Linker; then
diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index d03764df7d..1f6c5a7522 100644
--- a/ffbuild/common.mak
+++ b/ffbuild/common.mak
@@ -22,7 +22,7 @@ INSTALL_FILES = $(INSTALL) $(1) $(2) "$(3)"
 ifndef V
 Q      = @
 ECHO   = printf "$(1)\t%s\n" $(2)
-BRIEF  = CC CXX OBJCC HOSTCC HOSTLD AS X86ASM AR LD LDXX STRIP CP WINDRES 
GLSLC NVCC BIN2C METALCC METALLIB MSCLCC
+BRIEF  = CC CXX OBJCC HOSTCC HOSTLD AS X86ASM AR LD LDXX STRIP CP WINDRES 
GLSLC NVCC BIN2C METALCC METALLIB
 SILENT = DEPCC DEPCXX DEPHOSTCC DEPAS DEPX86ASM RANLIB RM
 
 MSG    = $@
@@ -82,22 +82,22 @@ COMPILE_LASX = $(call COMPILE,CC,LASXFLAGS)
 %_lasx.o: %_lasx.c
        $(COMPILE_LASX)
 
-%.o: %.c | $(MSCL)
+%.o: %.c
        $(COMPILE_C)
 
-%.o: %.cpp | $(MSCL)
+%.o: %.cpp
        $(COMPILE_CXX)
 
-%.o: %.m | $(MSCL)
+%.o: %.m
        $(COMPILE_M)
 
-%.s: %.c | $(MSCL)
+%.s: %.c
        $(CC) $(CCFLAGS) -S -o $@ $<
 
-%.o: %.S | $(MSCL)
+%.o: %.S
        $(COMPILE_S)
 
-%_host.o: %.c | $(MSCL)
+%_host.o: %.c
        $(COMPILE_HOSTC)
 
 %.o: %.asm
@@ -107,7 +107,7 @@ COMPILE_LASX = $(call COMPILE,CC,LASXFLAGS)
 %.o: %.rc
        $(WINDRES) $(IFLAGS) $(foreach ARG,$(CC_DEPFLAGS),--preprocessor-arg 
"$(ARG)") -o $@ $<
 
-%.i: %.c | $(MSCL)
+%.i: %.c
        $(CC) $(CCFLAGS) $(CC_E) $<
 
 %.h.c:
@@ -243,8 +243,7 @@ checkheaders: $(HOBJS)
 .SECONDARY:   $(HOBJS:.o=.c) $(SPVOBJS:.o=.c) $(SPVOBJS:.o=.gz) $(SPVOBJS:.o=) 
$(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=)
 alltools: $(TOOLS)
 
-# ffbuild/mscl.o is excluded as it has its own bootstrap rule in Makefile
-$(filter-out ffbuild/mscl.o,$(HOSTOBJS)): %.o: %.c | $(MSCL)
+$(HOSTOBJS): %.o: %.c
        $(COMPILE_HOSTC)
 
 $(HOSTPROGS): %$(HOSTEXESUF): %.o
diff --git a/libswscale/x86/Makefile b/libswscale/x86/Makefile
index 5fae34a832..4467fd877d 100644
--- a/libswscale/x86/Makefile
+++ b/libswscale/x86/Makefile
@@ -31,6 +31,6 @@ $(SUBDIR)x86/ops_common.o: $(SUBDIR)x86/uops_macros.gen.asm
 $(SUBDIR)x86/ops_int.o: $(SUBDIR)x86/uops_macros.gen.asm
 $(SUBDIR)x86/ops_float.o: $(SUBDIR)x86/uops_macros.gen.asm
 $(SUBDIR)x86/uops_macros.gen.asm: $(SRC_PATH)/libswscale/x86/uops_macros.asm.h 
\
-                                  $(SRC_PATH)/libswscale/uops_macros.h | 
$(MSCL)
+                                  $(SRC_PATH)/libswscale/uops_macros.h
        $(HOSTCC) $(HOSTCC_E) $(HOSTCPPFLAGS) $<
 endif
diff --git a/tools/Makefile b/tools/Makefile
index 9ed3251ff9..7ae6e3cb75 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -2,28 +2,28 @@ TOOLS = enc_recon_frame_test enum_options qt-faststart 
scale_slice_test trasher
 TOOLS-$(CONFIG_LIBMYSOFA) += sofa2wavs
 TOOLS-$(CONFIG_ZLIB) += cws2fws
 
-tools/target_dec_%_fuzzer.o: tools/target_dec_fuzzer.c | $(MSCL)
+tools/target_dec_%_fuzzer.o: tools/target_dec_fuzzer.c
        $(COMPILE_C) -DFFMPEG_DECODER=$*
 
-tools/target_enc_%_fuzzer.o: tools/target_enc_fuzzer.c | $(MSCL)
+tools/target_enc_%_fuzzer.o: tools/target_enc_fuzzer.c
        $(COMPILE_C) -DFFMPEG_ENCODER=$*
 
-tools/target_bsf_%_fuzzer.o: tools/target_bsf_fuzzer.c | $(MSCL)
+tools/target_bsf_%_fuzzer.o: tools/target_bsf_fuzzer.c
        $(COMPILE_C) -DFFMPEG_BSF=$*
 
-tools/target_dem_%_fuzzer.o: tools/target_dem_fuzzer.c | $(MSCL)
+tools/target_dem_%_fuzzer.o: tools/target_dem_fuzzer.c
        $(COMPILE_C) -DFFMPEG_DEMUXER=$* -DIO_FLAT=0
 
-tools/target_dem_fuzzer.o: tools/target_dem_fuzzer.c | $(MSCL)
+tools/target_dem_fuzzer.o: tools/target_dem_fuzzer.c
        $(COMPILE_C) -DIO_FLAT=1
 
-tools/target_io_dem_fuzzer.o: tools/target_dem_fuzzer.c | $(MSCL)
+tools/target_io_dem_fuzzer.o: tools/target_dem_fuzzer.c
        $(COMPILE_C) -DIO_FLAT=0
 
-tools/target_sws_fuzzer.o: tools/target_sws_fuzzer.c | $(MSCL)
+tools/target_sws_fuzzer.o: tools/target_sws_fuzzer.c
        $(COMPILE_C)
 
-tools/target_swr_fuzzer.o: tools/target_swr_fuzzer.c | $(MSCL)
+tools/target_swr_fuzzer.o: tools/target_swr_fuzzer.c
        $(COMPILE_C)
 
 tools/enc_recon_frame_test$(EXESUF): tools/decode_simple.o
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to