PR #23591 opened by Martin Storsjö (mstorsjo) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23591 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23591.patch
The first patch is mostly straightforward. The second patch supersedes https://lists.ffmpeg.org/archives/list/[email protected]/thread/QREREIX6LWJCV7PAJIMBWR5OCTFAOTP5/. That patch had the drawback that it relies on `echo` being handled within an msys2/cygwin shell where the `echo` command isn't limited by the Windows path length limit. In most cases of having a working shell to run shell scripts, it would be msys2/cygwin - so the cases in #23221, where `echo` was length limited due to what shell GNU make used to execute commands probably shouldn't apply here. But if using busybox instead of msys2/cygwin, the length limit does apply here as well. So to avoid that problem entirely, reuse the same response file for the makedef invocation as well. This requires moving the use of `$(SLIB_CREATE_DEF_CMD)` into the middle of the `ifeq ($(RESPONSE_FILES),yes)` block - this isn't ideal and isn't very neat. But all Windows targeting toolchains do support response files at least... From 7b60f4781a05148e5e477f11f0aba9ac9ec7717c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <[email protected]> Date: Mon, 8 Jun 2026 09:34:00 +0000 Subject: [PATCH 1/2] configure: Test for response file support in a way that works with busybox-w32 Don't use /dev/null as test input file for the test for response file support. Busybox on Windows does provide POSIX utilities to the point of being able to build and test ffmpeg, but it doesn't provide full POSIX emulation like msys2 and cygwin do. Busybox utils do handle paths like /dev/null themselves. But when busybox invokes a native Windows executable (like the "$ar" tool in this test), it passes such a path as-is. Msys2 on the other hand rewrites unixy paths in command line parameters - even when prefixed; e.g. "@/dev/null" gets rewritten into "@nul". Instead of testing with a /dev/null input, test with a real temp file instead. --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 2bf25e9755..a93e2f90f9 100755 --- a/configure +++ b/configure @@ -5143,6 +5143,7 @@ tmpfile TMPO .o tmpfile TMPS .S tmpfile TMPSH .sh tmpfile TMPV .ver +tmpfile TMPRSP .rsp unset -f mktemp @@ -8268,7 +8269,8 @@ esac if [ "$response_files" != "no" ]; then ar_out=${FFTMPDIR}/test$LIBSUF - respfile="@/dev/null" + echo > "$TMPRSP" + respfile="@$TMPRSP" out_arg="$(echo $ar_o | sed "s;\$@;$ar_out;g")" if test_cmd $ar $arflags $out_arg $respfile; then response_files="yes" -- 2.52.0 From f3ab7ac3fb3c6e41a8b3cca730fb03de51864c39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <[email protected]> Date: Wed, 24 Jun 2026 11:39:18 +0000 Subject: [PATCH 2/2] configure: Pass the .objs response file to makedef This fixes generating shared libraries with a toolchain that requires makedef (MSVC, or mingw toolchains with LLD, that lacks support for --version-script). This uses the existing response file generated for linking. This implicitly assumes that any toolchain that requires makedef supports response files (which all Windows toolchains do). This avoids relying on "echo" within makedef supporting long command lines; msys2/cygwin shells handle it fine, while busybox doesn't. --- compat/windows/makedef | 5 +++++ configure | 4 ++-- ffbuild/library.mak | 5 +++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/compat/windows/makedef b/compat/windows/makedef index af42f08fd5..99a4d1216a 100755 --- a/compat/windows/makedef +++ b/compat/windows/makedef @@ -33,6 +33,11 @@ if [ ! -f "$vscript" ]; then fi for object in "$@"; do + case $object in + @*) + object=${object#@} + ;; + esac if [ ! -f "$object" ]; then echo "Object does not exist: ${object}" >&2 exit 1 diff --git a/configure b/configure index a93e2f90f9..cf0cbb4af9 100755 --- a/configure +++ b/configure @@ -6249,7 +6249,7 @@ case $target_os in SLIB_INSTALL_LINKS= SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)' - SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)' + SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver @[email protected] > $$(@:$(SLIBSUF)=.def)' SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--disable-auto-image-base $$(@:$(SLIBSUF)=.def)' enabled x86_64 && objformat="win64" || objformat="win32" dlltool="${cross_prefix}dlltool" @@ -6288,7 +6288,7 @@ case $target_os in SLIBSUF=".dll" SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)' - SLIB_CREATE_DEF_CMD='LDFLAGS="$(LDFLAGS)" EXTERN_PREFIX="$(EXTERN_PREFIX)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)' + SLIB_CREATE_DEF_CMD='LDFLAGS="$(LDFLAGS)" EXTERN_PREFIX="$(EXTERN_PREFIX)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver @[email protected] > $$(@:$(SLIBSUF)=.def)' SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)' SLIB_INSTALL_LINKS= SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' diff --git a/ffbuild/library.mak b/ffbuild/library.mak index 93b3b2e5a7..2759a73a5c 100644 --- a/ffbuild/library.mak +++ b/ffbuild/library.mak @@ -86,14 +86,15 @@ $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR) $(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME) $(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SHLIBOBJS) $(SUBDIR)lib$(NAME).ver - $(SLIB_CREATE_DEF_CMD) ifeq ($(RESPONSE_FILES),yes) ifeq ($(HAVE_BUILTIN_FILE),yes) $$(file >[email protected],$$(filter %.o,$$^)) else $(Q)echo $$(filter %.o,$$^) > [email protected] endif - +endif + $(SLIB_CREATE_DEF_CMD) +ifeq ($(RESPONSE_FILES),yes) $$(call LINK,$$(call $(NAME)LINK_SO_ARGS) $$(LD_O) @[email protected] $$(call $(NAME)LINK_EXTRA)) else $$(call LINK,$$(call $(NAME)LINK_SO_ARGS) $$(LD_O) $$(filter %.o,$$^) $$(call $(NAME)LINK_EXTRA)) -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
