Opened 5 years ago

Closed 5 years ago

#7642 closed defect (fixed)

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

Reported by: Stephen E. Baker 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 Stephen E. Baker 5 years ago.
build-x86-windows-rel-err.log (156 bytes ) - added by Stephen E. Baker 5 years ago.
ffmeg_make.log (3.2 KB ) - added by Stephen E. Baker 5 years ago.
make V=1 ffmpeg.exe (second run)

Download all attachments as: .zip

Change History (17)

by Stephen E. Baker, 5 years ago

by Stephen E. Baker, 5 years ago

comment:1 by Stephen E. Baker, 5 years ago

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 by Carl Eugen Hoyos, 5 years ago

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 by Stephen E. Baker, 5 years ago

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 by Stephen E. Baker, 5 years ago

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 by Stephen E. Baker, 5 years ago

./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 by Stephen E. Baker, 5 years ago

Summary: Linker error in MSVC with --disable-everythingLinker error in MSVC with --disable-everything --enable-shared

comment:7 by Carl Eugen Hoyos, 5 years ago

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

Last edited 5 years ago by Carl Eugen Hoyos (previous) (diff)

by Stephen E. Baker, 5 years ago

Attachment: ffmeg_make.log added

make V=1 ffmpeg.exe (second run)

comment:8 by Stephen E. Baker, 5 years ago

Attached (ffmpeg_make.log)

comment:9 by Stephen E. Baker, 5 years ago

Version: unspecifiedgit-master

comment:10 by Carl Eugen Hoyos, 5 years ago

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 by Stephen E. Baker, 5 years ago

The patch fixes the error

comment:12 by Carl Eugen Hoyos, 5 years ago

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

comment:13 by Stephen E. Baker, 5 years ago

Confirmed

comment:14 by James, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.