Opened 3 months ago

Closed 2 months ago

#7642 closed defect (fixed)

Linker error in MSVC with --disable-everything --enable-shared

Reported by: thecycoone Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
For several years I have been compiling a minimal (smacker only) version of ffmpeg for packaging with CorsixTH (an open source game implementation.)

I use vcpkg with a custom portfile to compile ffmpeg. Since updating from 3.3.5 to 4.1 my minimal compile is working; but the regular compile still works.

How to reproduce:

./configure --toolchain=msvc --prefix=../../buildtrees/ffmpeg/src --enable-asm --enable-yasm --disable-doc --enable-debug --disable-ffmpeg --enable-runtime-cpudetect --disable-openssl --disable-ffplay --disable-ffprobe --disable-libx264 --disable-opencl --disable-lzma --extra-cflags=-DHAVE_UNISTD_H=0 --disable-static --enable-shared  --extra-cflags=-MD --extra-cxxflags=-MD
make -j6

Attachments (3)

build-x86-windows-rel-out.log (28.5 KB) - added by thecycoone 3 months ago.
build-x86-windows-rel-err.log (156 bytes) - added by thecycoone 3 months ago.
ffmeg_make.log (3.2 KB) - added by thecycoone 3 months ago.
make V=1 ffmpeg.exe (second run)

Download all attachments as: .zip

Change History (17)

Changed 3 months ago by thecycoone

Changed 3 months ago by thecycoone

comment:1 Changed 3 months ago by thecycoone

From build-x86-windows-rel-out.log:

dxva2.o : error LNK2019: unresolved external symbol impCoTaskMemFree@4 referenced in function _dxva2_create_decoder

libavcodec/avcodec-58.dll : fatal error LNK1120: 1 unresolved externals

comment:2 Changed 3 months ago by cehoyos

Unfortunately, the ticket title does not match the configure line you provided.
Is the issue reproducible with ./configure --toolchain=msvc --disable-everything && make ffmpeg? Or with another simplified configure line?
Please confirm that you tested current FFmpeg git head, nothing else is supported here.

comment:3 Changed 3 months ago by thecycoone

Using the latest git at this time (fccba32b4c4f16682b2c34a4c84449a84f91d4d9)

I am not able to reproduce using ./configure --toolchain=msvc --disable-everything; make or ./configure --toolchain=msvc --disable-everything --disable-programs; make

I am able to reproduce with ./configure --toolchain=msvc --disable-everything --enable-asm --enable-yasm --disable-doc --enable-debug --disable-ffmpeg --enable-runtime-cpudetect --disable-openssl --disable-ffplay --disable-ffprobe --disable-libx264 --disable-opencl --disable-lzma --extra-cflags=-DHAVE_UNISTD_H=0 --disable-static --enable-shared --extra-cflags=-MD --extra-cxxflags=-MD; make

I'm not sure what the minimal necessary set of configure options is, but I know that adding --disable-autodetect, or removing --disable-everything from the last example causes it to work.

comment:4 Changed 3 months ago by thecycoone

I can reproduce with:

./configure --toolchain=msvc --disable-everything --disable-doc --enable-debug --disable-programs --enable-runtime-cpudetect --disable-libx264 --disable-static --enable-shared
make

That's as far as I have time to take it tonight. If necessary I can spend some time later trying to get a true minimal set.

comment:5 Changed 3 months ago by thecycoone

./configure --toolchain=msvc --disable-everything --enable-shared is the minimal set of flags to trigger the error.

In case it matters:
OS: Microsoft Windows [Version 10.0.17134.472]
Compiler: Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26732.1 for x64

comment:6 Changed 3 months ago by thecycoone

  • Summary changed from Linker error in MSVC with --disable-everything to Linker error in MSVC with --disable-everything --enable-shared

comment:7 Changed 3 months ago by cehoyos

Please run make V=1 ffmpeg.exe twice and provide the console output of the second run.

Last edited 3 months ago by cehoyos (previous) (diff)

Changed 3 months ago by thecycoone

make V=1 ffmpeg.exe (second run)

comment:8 Changed 3 months ago by thecycoone

Attached (ffmpeg_make.log)

comment:9 Changed 3 months ago by thecycoone

  • Version changed from unspecified to git-master

comment:10 Changed 3 months ago by cehoyos

Please test this patch:

diff --git a/configure b/configure
index 04d3417..a636939 100755
--- a/configure
+++ b/configure
@@ -3527,7 +3527,7 @@ cws2fws_extralibs="zlib_extralibs"

 # libraries, in any order
 avcodec_deps="avutil"
-avcodec_suggest="libm"
+avcodec_suggest="libm ole32"
 avcodec_select="null_bsf"
 avdevice_deps="avformat avcodec avutil"
 avdevice_suggest="libm"
@@ -3554,7 +3554,7 @@ ffmpeg_deps="avcodec avfilter avformat"
 ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
                null_filter
                trim_filter"
-ffmpeg_suggest="ole32 psapi shell32"
+ffmpeg_suggest="psapi shell32"
 ffplay_deps="avcodec avformat swscale swresample sdl2"
 ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter"
 ffplay_suggest="shell32"

comment:11 Changed 3 months ago by thecycoone

The patch fixes the error

comment:12 Changed 3 months ago by cehoyos

Please confirm that with this patch applied, static compilation still works: ./configure --disable-everything && make ffmpeg.exe

comment:13 Changed 3 months ago by thecycoone

Confirmed

comment:14 Changed 2 months ago by jamrial

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.