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 <kaspe...@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-requ...@ffmpeg.org with subject "unsubscribe".