From: "Kacper Michajłow" <kasper93-at-gmail.com@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Cc: "Kacper Michajłow" <kasper93@gmail.com> Subject: [FFmpeg-devel] [PATCH 1/2] configure: use proper Windows-style static library naming Date: Fri, 20 Jun 2025 01:31:11 +0200 Message-ID: <20250619233112.711-1-kasper93@gmail.com> (raw) On Windows, static libraries are typically named with a .lib extension. An exception to this is MinGW targets, which are treated as a distinct target-os. Using Windows-style naming allows Clang to be used as the linker driver, instead of invoking link or lld-link directly. The latter approach requires manually specifying standard libraries, which may be error-prone or incomplete. This change also improves support for LTO and sanitizer builds, where it's significantly easier to let the compiler driver manage the necessary linker flags. It fixes issues where Clang is asked to `-lavcodec`, which gets passed to the linker as avcodec.lib, resulting in an error like: lld-link: error: could not open 'avcodec.lib': no such file or directory This happens because `libavcodec.a` were unexpectedly generated, not `avcodec.lib` expected by tooling. Note that this doesn't affect mingw build. MSVC builds work the same, because there libraries are passed as files directly to linker command. This also removes LD_LIB from Win32/64 target as there is one type of .lib in practice. We cannot build both shared and static as noted by the next line. Signed-off-by: Kacper Michajłow <kasper93@gmail.com> --- configure | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/configure b/configure index e2e9fc26d8..c57da316cc 100755 --- a/configure +++ b/configure @@ -5062,6 +5062,7 @@ probe_cc(){ _depflags='-MMD -MF $(@:.o=.d) -MT $@' _cflags_speed='-O3' _cflags_size='-Oz' + _ld_lib='-l%' elif $_cc -V 2>&1 | grep -q Sun; then _type=suncc _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-) @@ -5107,7 +5108,7 @@ probe_cc(){ _cc_o='-Fo$@' _cc_e='-P' _flags_filter=icl_flags - _ld_lib='lib%.a' + _ld_lib='%.lib' _ld_path='-libpath:' # -Qdiag-error to make icl error when seeing certain unknown arguments _flags='-nologo -Qdiag-error:4044,10157' @@ -5125,7 +5126,7 @@ probe_cc(){ _ident=$($_cc -flavor gnu --version 2>/dev/null) _ld_o='-out:$@' _flags_filter=msvc_flags - _ld_lib='lib%.a' + _ld_lib='%.lib' _ld_path='-libpath:' elif $_cc -nologo- 2>&1 | grep -q ^Microsoft || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then _type=msvc @@ -5152,7 +5153,7 @@ probe_cc(){ _cc_o='-Fo$@' _cc_e='-P -Fi$@' _flags_filter=msvc_flags - _ld_lib='lib%.a' + _ld_lib='%.lib' _ld_path='-libpath:' _flags='-nologo' disable stripping @@ -5931,9 +5932,6 @@ case $target_os in win32|win64) disable symver if enabled shared; then - # Link to the import library instead of the normal static library - # for shared libs. - LD_LIB='%.lib' # Cannot build both shared and static libs with MSVC or icl. disable static fi @@ -5941,6 +5939,8 @@ case $target_os in enabled x86_32 && check_ldflags -LARGEADDRESSAWARE add_cppflags -DWIN32_LEAN_AND_MEAN shlibdir_default="$bindir_default" + LIBPREF="" + LIBSUF=".lib" SLIBPREF="" SLIBSUF=".dll" SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' -- 2.45.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2025-06-19 23:31 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-06-19 23:31 Kacper Michajłow [this message] 2025-06-19 23:31 ` [FFmpeg-devel] [PATCH 2/2] configure: add -Wl when linker is called indirectly Kacper Michajłow
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20250619233112.711-1-kasper93@gmail.com \ --to=kasper93-at-gmail.com@ffmpeg.org \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=kasper93@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
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