* [FFmpeg-devel] [PATCH] configure: fix static library suffix for MSVC builds
@ 2025-11-22 23:50 Practice2001 via ffmpeg-devel
2025-11-25 4:51 ` [FFmpeg-devel] " Daniel Verkamp via ffmpeg-devel
0 siblings, 1 reply; 3+ messages in thread
From: Practice2001 via ffmpeg-devel @ 2025-11-22 23:50 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Practice2001
MSVC static builds currently always use ".a" for static library suffixes
(e.g. libavcodec.a, libavformat.a). This causes failures when linking
with Visual Studio, which expects ".lib" static libraries.
This patch adjusts configure so that when --toolchain=msvc is used,
LIBSUF is correctly set to ".lib" instead of the Unix default ".a".
This fixes linking with MSVC and Visual Studio-based build systems.
---
Environment:
- Windows 10
- MSYS2 (mingw64)
- Visual Studio 2019 / 2022
- NASM installed
- MSVC toolchain selected
Commands:
./configure --toolchain=msvc --enable-static --disable-shared
make
Resulting static libraries incorrectly have ".a" suffix, e.g.:
libavcodec.a
libavformat.a
libavutil.a
Linking test program with MSVC:
cl test_ffmpeg.c /I C:\ffmpeg-test-install\include ^
/link /LIBPATH:C:\ffmpeg-test-install\lib avcodec.lib avformat.lib avutil.lib
Error:
LINK : fatal error LNK1181: cannot open input file 'avcodec.lib'
---
Verification of the fix:
After applying this patch and rebuilding:
Generated static libraries:
avcodec.lib
avformat.lib
avutil.lib
Test program build script (build_test.bat):
cl test_ffmpeg.c ^
/I C:\ffmpeg-test-install\include ^
/link /LIBPATH:C:\ffmpeg-test-install\lib ^
avcodec.lib avformat.lib avutil.lib
Output:
D:\ffmpeg\temp>.\buid_test.bat
Microsoft (R) C/C++ Optimizing Compiler Version 19.50.35718 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
test_ffmpeg.c
Microsoft (R) Incremental Linker Version 14.50.35718.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:test_ffmpeg.exe
/LIBPATH:C:\ffmpeg-test-install\lib
avcodec.lib
avformat.lib
avutil.lib
/OUT:test.exe
test_ffmpeg.obj
=== BUILD SUCCESS ===
Running test...
FFmpeg avcodec version: 4068196
FFmpeg avformat version: 4064871
FFmpeg avutil version: 3936868
This confirms MSVC accepts the .lib suffix and the libraries function
correctly.
---
configure | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure b/configure
index 47f9b31439..596d66ce53 100755
--- a/configure
+++ b/configure
@@ -6067,7 +6067,7 @@ case $target_os in
win32|win64)
disable symver
LIBPREF=""
- LIBSUF=".lib"
+ LIBSUF=".lib"
if enabled shared; then
# Cannot build both shared and static libs with MSVC or icl.
disable static
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 3+ messages in thread* [FFmpeg-devel] Re: [PATCH] configure: fix static library suffix for MSVC builds
2025-11-22 23:50 [FFmpeg-devel] [PATCH] configure: fix static library suffix for MSVC builds Practice2001 via ffmpeg-devel
@ 2025-11-25 4:51 ` Daniel Verkamp via ffmpeg-devel
2025-11-25 11:27 ` Discord Account via ffmpeg-devel
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Verkamp via ffmpeg-devel @ 2025-11-25 4:51 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Practice2001, Daniel Verkamp
On Sat, Nov 22, 2025 at 3:51 PM Practice2001 via ffmpeg-devel
<ffmpeg-devel@ffmpeg.org> wrote:
> MSVC static builds currently always use ".a" for static library suffixes
> (e.g. libavcodec.a, libavformat.a). This causes failures when linking
> with Visual Studio, which expects ".lib" static libraries.
>
> This patch adjusts configure so that when --toolchain=msvc is used,
> LIBSUF is correctly set to ".lib" instead of the Unix default ".a".
>
> This fixes linking with MSVC and Visual Studio-based build systems.
>
[...]
Hi,
This appears to have been fixed by commit 8eca3fa619a7 ("configure:
use proper Windows-style static library naming"), and then re-shuffled
in commit 671e54d7151b ("configure: add -static suffix to internal
static libs for test programs").
> ---
> configure | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 47f9b31439..596d66ce53 100755
> --- a/configure
> +++ b/configure
> @@ -6067,7 +6067,7 @@ case $target_os in
> win32|win64)
> disable symver
> LIBPREF=""
> - LIBSUF=".lib"
> + LIBSUF=".lib"
Not really important, but I'm curious what happened here - the
original doesn't match what was in the repository, even before the
commits above.
Thanks,
-- Daniel
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 3+ messages in thread* [FFmpeg-devel] Re: [PATCH] configure: fix static library suffix for MSVC builds
2025-11-25 4:51 ` [FFmpeg-devel] " Daniel Verkamp via ffmpeg-devel
@ 2025-11-25 11:27 ` Discord Account via ffmpeg-devel
0 siblings, 0 replies; 3+ messages in thread
From: Discord Account via ffmpeg-devel @ 2025-11-25 11:27 UTC (permalink / raw)
To: Daniel Verkamp
Cc: FFmpeg development discussions and patches, Discord Account
Yeah, I just checked, it's patched. Additionally, I tested a bash script I
wrote for the configuration, and it produces files with the '.lib'
extension. So, this patch is unnecessary. Thanks for pointing it out and
referencing previous commits. It's just that it was listed in the bug
tracker under 'open' status.
configuration:
./configure \
--toolchain=msvc \
--enable-static \
--disable-shared \
--disable-programs \
--disable-doc \
--disable-swscale \
--disable-swresample \
--disable-postproc \
--disable-avfilter \
--disable-avdevice \
--disable-network \
--disable-autodetect \
--disable-d3d12va \
--disable-d3d11va \
--disable-dxva2 \
--disable-everything \
--enable-decoder=rawvideo \
--prefix=/c/ffmpeg-test-install
buid_test.bat:
@echo off
set FFMPEG=C:\ffmpeg-test-install
cl.exe /I"%FFMPEG%\include" test_ffmpeg.c ^
/link /LIBPATH:"%FFMPEG%\lib" ^
avcodec.lib avformat.lib avutil.lib ^
/OUT:test.exe
if %ERRORLEVEL% EQU 0 (
echo.
echo === BUILD SUCCESS ===
echo Running test...
test.exe
) else (
echo.
echo === BUILD FAILED ===
)
Output:
D:\ffmpeg\temp>.\buid_test.bat
Microsoft (R) C/C++ Optimizing Compiler Version 19.50.35718 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
test_ffmpeg.c
Microsoft (R) Incremental Linker Version 14.50.35718.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:test_ffmpeg.exe
/LIBPATH:C:\ffmpeg-test-install\lib
avcodec.lib
avformat.lib
avutil.lib
/OUT:test.exe
test_ffmpeg.obj
=== BUILD SUCCESS ===
Running test...
FFmpeg avcodec version: 4068196
FFmpeg avformat version: 4064871
FFmpeg avutil version: 3937124
On Tue, Nov 25, 2025 at 11:14 AM Daniel Verkamp <daniel@drv.nu> wrote:
> On Sat, Nov 22, 2025 at 3:51 PM Practice2001 via ffmpeg-devel
> <ffmpeg-devel@ffmpeg.org> wrote:
> > MSVC static builds currently always use ".a" for static library suffixes
> > (e.g. libavcodec.a, libavformat.a). This causes failures when linking
> > with Visual Studio, which expects ".lib" static libraries.
> >
> > This patch adjusts configure so that when --toolchain=msvc is used,
> > LIBSUF is correctly set to ".lib" instead of the Unix default ".a".
> >
> > This fixes linking with MSVC and Visual Studio-based build systems.
> >
> [...]
>
> Hi,
>
> This appears to have been fixed by commit 8eca3fa619a7 ("configure:
> use proper Windows-style static library naming"), and then re-shuffled
> in commit 671e54d7151b ("configure: add -static suffix to internal
> static libs for test programs").
>
> > ---
> > configure | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/configure b/configure
> > index 47f9b31439..596d66ce53 100755
> > --- a/configure
> > +++ b/configure
> > @@ -6067,7 +6067,7 @@ case $target_os in
> > win32|win64)
> > disable symver
> > LIBPREF=""
> > - LIBSUF=".lib"
> > + LIBSUF=".lib"
>
> Not really important, but I'm curious what happened here - the
> original doesn't match what was in the repository, even before the
> commits above.
>
> Thanks,
> -- Daniel
>
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-25 11:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-22 23:50 [FFmpeg-devel] [PATCH] configure: fix static library suffix for MSVC builds Practice2001 via ffmpeg-devel
2025-11-25 4:51 ` [FFmpeg-devel] " Daniel Verkamp via ffmpeg-devel
2025-11-25 11:27 ` Discord Account via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git