PR #23654 opened by Martin Storsjö (mstorsjo) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23654 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23654.patch
This should fix building shared libraries on Windows with lots of external libraries enabled, and fix building with response files with busybox. From 228c714a9fe10915618f11c1cb1505abcebf81ab 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. (cherry picked from commit 32d7e9d71e2cf5d85728559de904044c520ba2c0) --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 8941ced1f4..89777c0899 100755 --- a/configure +++ b/configure @@ -5144,6 +5144,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 9d97419239ba9bc78168315f514ac513a329f26d 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, by splitting out the choice of input parameter to makedef to a variable expanded by make. This avoids relying on "echo" within makedef supporting long command lines; msys2/cygwin shells handle it fine, while busybox doesn't. (cherry picked from commit 8512161c81242e11158133bed019d5a51b089ca8) --- compat/windows/makedef | 5 +++++ configure | 9 +++++++-- ffbuild/library.mak | 5 +++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/compat/windows/makedef b/compat/windows/makedef index af42f08fd5..c5755d6cca 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 89777c0899..785e23fb16 100755 --- a/configure +++ b/configure @@ -6250,7 +6250,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 $(SLIB_CREATE_DEF_INPUTS) > $$(@:$(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" @@ -6289,7 +6289,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 $(SLIB_CREATE_DEF_INPUTS) > $$(@:$(SLIBSUF)=.def)' SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)' SLIB_INSTALL_LINKS= SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' @@ -8768,6 +8768,11 @@ SLIBNAME=${SLIBNAME} SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION} SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR} SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD} +ifeq (\$(RESPONSE_FILES),yes) +SLIB_CREATE_DEF_INPUTS=@\$\[email protected] +else +SLIB_CREATE_DEF_INPUTS=\$(OBJS) +endif SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD} SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME} SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS} 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]
