New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 783021 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows
Pri: 3
Type: Bug

Blocking:
issue 832852



Sign in to add a comment

Use clang-cl to build ffmpeg configuration files on Linux instead of Windows.

Project Member Reported by dalecur...@chromium.org, Nov 9 2017

Issue description

I.e., get chromium/scripts/build_ffmpeg.py working with clang-cl on Linux. Possibly as a first cut try to get this working on Windows + Cygwin (was trivially unsuccessful in a recent attempt, clang-cl didn't seem to understand cygwin paths (even with cygwin-wrapper)).

If this is possible the only real hardware needed would be a mac, but hey, maybe one day we can cross-compile mac targets on Linux too :)

Notably this would require yasm assembly working too; of which it's unclear how much works with clang-cl on Linux since the chromium-dev@ e-mail mentions skia not working.

https://groups.google.com/a/chromium.org/d/msg/chromium-dev/cIA9fBb9vBE/b_041mumBQAJ

Will try to take a stab at this sometime in the new year; or whatever ffmpeg roller wants to take it upon themselves.
 
Blockedon: 762167
issue 762167 has more details on the asm issue.
Blockedon: -762167
Actually that bug is about masm not yasm, so I guess it doesn't block this after all! \o
Notably this will also allow us to enable inline assembly routines currently guarded behind HAVE_[MMX|MMXEXT|SSE|SSE2|SSSE3]_INLINE that are currently disabled on Windows builds.
Looks like someone is working on clang-cl support for ffmpeg upstream:

https://patchwork.ffmpeg.org/patch/7469/
Blocking: 803898
Linking to M67 roll in case I get time to work on it during that roll. Not truly blocking it though.
Cc: liber...@chromium.org
Some notes that seem to get this working:

First follow https://chromium.googlesource.com/chromium/src/+/master/docs/win_cross.md to get relevant SDKs, toolchain, etc.

Apply https://patchwork.ffmpeg.org/patch/7469/ to ffmpeg repository.

Use $chrome_src_dir/tools/clang/scripts/download_objdump.py to get llvm-nm, llvm-ar

export MSVC_PATH=$chrome_src_dir/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0

./configure --target-os=win64 --toolchain=msvc --cc=clang-cl --ld=lld-link --nm=llvm-nm --ar=llvm-ar --enable-cross-compile --extra-cflags="-imsvc$MSVC_PATH/win_sdk/bin/../../win_sdk/Include/10.0.15063.0/um" --extra-cflags="-imsvc$MSVC_PATH/win_sdk/bin/../../win_sdk/Include/10.0.15063.0/shared" --extra-cflags="-imsvc$MSVC_PATH/win_sdk/bin/../../win_sdk/Include/10.0.15063.0/winrt" --extra-cflags="-imsvc$MSVC_PATH/win_sdk/bin/../../win_sdk/Include/10.0.15063.0/ucrt" --extra-cflags="-imsvc$MSVC_PATH/win_sdk/bin/../../VC/Tools/MSVC/14.11.25503/include" --extra-cflags="-imsvc$MSVC_PATH/win_sdk/bin/../../VC/Tools/MSVC/14.11.25503/atlmfc/include" --extra-ldflags=-libpath:$MSVC_PATH/win_sdk/bin/../../VC/Tools/MSVC/14.11.25503/lib/x64 --extra-ldflags=-libpath:$MSVC_PATH/win_sdk/bin/../../win_sdk/Lib/10.0.15063.0/um/x64 --extra-ldflags=-libpath:$MSVC_PATH/win_sdk/bin/../../win_sdk/Lib/10.0.15063.0/ucrt/x64 --extra-ldflags=-libpath:$MSVC_PATH/win_sdk/bin/../../VC/Tools/MSVC/14.11.25503/atlmfc/lib/x64

$ ls -al *.exe
-rwxr-xr-x 1 dalecurtis primarygroup 19410432 Apr 13 14:46 ffmpeg.exe
-rwxr-xr-x 1 dalecurtis primarygroup 19410432 Apr 13 14:46 ffmpeg_g.exe
-rwxr-xr-x 1 dalecurtis primarygroup 19343872 Apr 13 14:46 ffprobe.exe
-rwxr-xr-x 1 dalecurtis primarygroup 19343872 Apr 13 14:46 ffprobe_g.exe

Wee! Next step is figuring out how to teach build_ffmpeg to gather the toolchain setup automatically. And seeing if this actually generates the same configuration files as we'd generate on windows.
@thakis: Is there a way to kick off msvc try jobs? I tried adding a couple to https://chromium-review.googlesource.com/c/chromium/src/+/1013328 to make sure this work still compiles there (since I think we're still keeping those bots green), but they end up purple:

https://ci.chromium.org/buildbot/tryserver.chromium.win/win-msvc-rel/93809

AssertionError: No bot config for master/builder [tryserver.chromium.win / win-msvc-rel]

Comment 9 by thakis@chromium.org, Apr 16 2018

re 8: You don't need to worry about this no more, https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/QtHvwq5-lOE

(...but I should remove these bots from the gerrit UI selector, thanks for the reminder.)
Thanks :)
Project Member

Comment 11 by bugdroid1@chromium.org, Apr 16 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/third_party/ffmpeg/+/64536498b405cf6900e35c0eea322030001a2c02

commit 64536498b405cf6900e35c0eea322030001a2c02
Author: Dale Curtis <dalecurtis@chromium.org>
Date: Mon Apr 16 23:16:51 2018

Comment out FFMPEG_CONFIGURATION to avoid long string in binary.

FFmpeg returns this string via the av(format|codec|utils)_configuration()
function. There's no reason for this to be present in Chrome, and even
less reason to include it 3 times... so comment it out and define it to
NULL. The string is kept in the header files for the sake of reviewing
changes more easily.

BUG= 783021 
TEST=builds

Change-Id: Idf38b6396ba6d8994a4e323cd037575053b9eaae
Reviewed-on: https://chromium-review.googlesource.com/1014494
Reviewed-by: Frank Liberato <liberato@chromium.org>

[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/linux-noasm/x64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/android/x64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/win/x64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/ChromeOS/linux/mips64el/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/linux/arm64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/ChromeOS/linux/ia32/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/linux/arm-neon/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/linux/mips64el/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/mac/x64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/win/ia32/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/linux/arm/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/android/arm64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/linux/arm64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/linux/mipsel/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/linux/ia32/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/ChromeOS/linux/x64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/android/x64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/ChromeOS/linux/arm-neon/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/ChromeOS/linux/mipsel/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/android/mips64el/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/android/mipsel/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/linux/arm/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/linux/mipsel/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/linux/mips64el/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/win/ia32/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/mac/x64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/linux-noasm/x64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/win/x64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/android/mips64el/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/linux/x64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/ChromeOS/linux-noasm/x64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/scripts/build_ffmpeg.py
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/android/ia32/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/ChromeOS/linux/arm64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/linux/ia32/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/BUILD.gn
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/android/arm-neon/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/ChromeOS/linux/arm/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/android/ia32/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/linux/arm-neon/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chrome/linux/x64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/android/arm64/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/android/mipsel/config.h
[modify] https://crrev.com/64536498b405cf6900e35c0eea322030001a2c02/chromium/config/Chromium/android/arm-neon/config.h

@thakis, setup_toolchain.py prints out most of the lib paths needed for clang-cl compilation, but notably is missing the ucrt lib path (but does print the ucrt include path), do you know if that's intentional?

https://chromium-review.googlesource.com/c/chromium/third_party/ffmpeg/+/1013323/3/chromium/scripts/build_ffmpeg.py#270

If not any objections to adding it to the script? I.e. have it print vc_lib_ucrt_path.
setup_toolchain.py prints what's needed for chrome/win builds and cross builds. I guess the ucrt lib path isn't needed, which raises the question why you need these libs while the chrome build apparently doesn't.

(Maybe https://cs.chromium.org/chromium/src/build/win/BUILD.gn?q=ucrt+file:%5C.gn&sq=package:chromium&dr=C&l=83 is related?)
Without ucrt linking fails to find the mainCRTStartup symbol during the compiler tests configure runs. It's not needed for Chrome's build of ffmpeg; just the standalone build we use for generating config files and gn includes.

I guess Chrome dynamic links ucrt given it's asking to copy the dll to the output directory?
I think chrome defaults to the static crt: https://cs.chromium.org/chromium/src/build/config/win/BUILD.gn?type=cs&q=static_crt&sq=package:chromium&l=396

out/gnwin/obj/base/base_unittests.ninja has this for linking base_unittests on a mac host:

  ldflags = /WX /MACHINE$:X64 /fastfail /FIXED$:NO /ignore$:4199 /ignore$:4221 /NXCOMPAT /DYNAMICBASE /INCREMENTAL /OPT$:NOREF /SUBSYSTEM$:CONSOLE,5.02 /DELAYLOAD$:cfgmgr32.dll /DELAYLOAD$:powrprof.dll /DELAYLOAD$:setupapi.dll /NATVIS$:../../tools/win/DebugVisualizers/chrome.natvis /manifest$:embed /manifestuac$:no /manifestinput$:../../build/win/as_invoker.manifest /manifestinput$:../../build/win/common_controls.manifest /manifestinput$:../../build/win/compatibility.manifest /LIBPATH:../../third_party/llvm-build/Release+Asserts/lib/clang/7.0.0/lib/windows /LIBPATH:../../third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/win_sdk/Lib/10.0.15063.0/um/x64 /LIBPATH:../../third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/VC/Tools/MSVC/14.11.25503/lib/x64 /LIBPATH:../../third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/VC/Tools/MSVC/14.11.25503/atlmfc/lib/x64

Can you paste the whole command you're running and the error message?
BEGIN ./ffconf.QgmUXpJJ/test.c
    1   int main(void){ return 0; }
END ./ffconf.QgmUXpJJ/test.c
clang-cl -nologo -I/d/code/chrome/src/third_party/opus/src/include -I/d/code/chrome/src/third_party/ffmpeg/chromium/include/win -O2 -imsvc/d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/win_sdk/bin/../../win_sdk/Include/10.0.15063.0/um -imsvc/d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/win_sdk/bin/../../win_sdk/Include/10.0.15063.0/shared -imsvc/d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/win_sdk/bin/../../win_sdk/Include/10.0.15063.0/winrt -imsvc/d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/win_sdk/bin/../../win_sdk/Include/10.0.15063.0/ucrt -imsvc/d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/win_sdk/bin/../../VC/Tools/MSVC/14.11.25503/include -imsvc/d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/win_sdk/bin/../../VC/Tools/MSVC/14.11.25503/atlmfc/include -c -Fo./ffconf.QgmUXpJJ/test.o ./ffconf.QgmUXpJJ/test.c
lld-link -libpath:/d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/VC/Tools/MSVC/14.11.25503/atlmfc/lib/x64 -libpath:/d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/win_sdk/Lib/10.0.15063.0/um/x64 -libpath:/d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/VC/Tools/MSVC/14.11.25503/lib/x64 -out:./ffconf.QgmUXpJJ/test.exe ./ffconf.QgmUXpJJ/test.o
lld-link: error: could not open libucrt.lib: No such file or directory

Actually looks like the error is different than the mainCRTstartup one I saw earlier. lld-link just fails to find the lib entirely.
$  find third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/ -name libucrt.lib
third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0//win_sdk/Lib/10.0.15063.0/ucrt/x64/libucrt.lib
third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0//win_sdk/Lib/10.0.15063.0/ucrt/x86/libucrt.lib


So I guess we should add that; weird we don't need it in chrome.

Oh wait, we do add it to the json file: https://cs.chromium.org/chromium/tools/depot_tools/win_toolchain/package_from_installed.py?type=cs&q=atlmfc+file:%5C.py&sq=package:chromium&l=292 => third_party/depot_tools/win_toolchain/vs_files//1180cb75833ea365097e279efb2d5d7a42dee4b0/win_sdk/bin/SetEnv.x64.json

My guess is that the setup_toolchain.py changes in https://chromium.googlesource.com/chromium/src/+/c5686578e8f519eeec50f574b284fbc12e6e15d8 probably broke this. Not sure why it didn't break the chrome build though.
That looks right. That CL explicitly replaced pulling all LIB entries with 3 cherry-picked ones. I'll see about sending a CL later today to add it back to the list.
ooooh I know why. I didn't land the change yet to not use out/gnwin/environment.x64 for links so we run that under a process that loads the environment from there -- and that file does include ucrt in its LIB.

So that just isn't hooked up yet. The Right Fix is to make setup_toolchain.py look at 'LIB' in the json file and return that as list that gets passed through as /libpath: flags, similar to the -imsvc flags for INCLUDE. (But lld still needs PATH at the moment for mt.exe on Windows, so either it can only happen on non-Win hosts, or we need to wait for me to finish https://reviews.llvm.org/D42910 so lld no longer relies on PATH)

So this just never worked and isn't hooked up in the chrome build yet. Maybe you could use the subprocess env block thing until then; from out/gnwin/toolchain.ninja:

rule link
  command = python ../../build/toolchain/win/tool_wrapper.py link-wrapper environment.x64 False ../../third_party/llvm-build/Release+Asserts/bin/lld-link --rsp-quoting=posix /nologo /OUT:${output_dir}/${target_output_name}${output_extension} /PDB:${output_dir}/${target_output_name}${output_extension}.pdb @${output_dir}/${target_output_name}${output_extension}.rsp
  description = LINK ${out}
  rspfile = ${output_dir}/${target_output_name}${output_extension}.rsp
  rspfile_content = ${in_newline} ${libs} ${solibs} ${ldflags}
  pool = build_toolchain_link_pool

The lhs of the change i linked to also has 3 libs: https://chromium.googlesource.com/chromium/src/+/6520f685d3ec41fcd4bafec8fd7b3038920d5186/build/config/win/BUILD.gn#256

So the change I linked to is probably innocent and this just never worked; see comment 19
It's fine to only work on non-windows hosts for us right now, so I think the s/um/ucrt/ hack is fine for the moment if we don't want to expand the vars printed by setup_toolchain.py yet. I'll file another bug for that if you want to tie it to landing your llvm cl.
Project Member

Comment 22 by bugdroid1@chromium.org, Apr 24 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/third_party/ffmpeg/+/24bf13b3c13a22c5d1ae4295badc9b79f94e6398

commit 24bf13b3c13a22c5d1ae4295badc9b79f94e6398
Author: Dale Curtis <dalecurtis@chromium.org>
Date: Tue Apr 24 03:53:05 2018

Add support for building the Windows ffmpeg configuration on Linux!

This adds cross-compiling support for Windows ffmpeg configurations;
it also updates the configurations with the generated results!

This uses a couple of existing Chromium scripts for setting up the
correct MSVC paths and passing the right cflags and ldflags to
chromium such that compilation can succeed.

This also pulls in an upstream patch for configure to make it detect
the proper command line flag type '/' vs '-':
https://patchwork.ffmpeg.org/patch/7469/

There's one further change to the makedef line in configure to
ensure that it's run using the substituted AR and NM commands
instead of the defaults lib and dumpbin.

BUG= 783021 
TEST=chrome works!

Change-Id: Ia6951b66ae7ecf1e6c700d6cf8bc92f4ea2ef985
Reviewed-on: https://chromium-review.googlesource.com/1013323
Reviewed-by: Frank Liberato <liberato@chromium.org>

[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/chromium/config/Chrome/win/x64/libavutil/ffversion.h
[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/chromium/config/Chrome/win/ia32/config.asm
[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/chromium/config/Chromium/win/x64/config.asm
[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/chromium/config/Chromium/win/x64/config.h
[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/chromium/config/Chrome/win/x64/config.h
[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/chromium/config/Chromium/win/ia32/config.h
[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/chromium/config/Chromium/win/ia32/libavutil/ffversion.h
[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/BUILD.gn
[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/chromium/config/Chrome/win/ia32/libavutil/ffversion.h
[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/chromium/config/Chrome/win/ia32/config.h
[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/configure
[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/chromium/scripts/build_ffmpeg.py
[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/chromium/config/Chromium/win/x64/libavutil/ffversion.h
[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/chromium/config/Chrome/win/x64/config.asm
[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/chromium/config/Chromium/win/ia32/config.asm
[modify] https://crrev.com/24bf13b3c13a22c5d1ae4295badc9b79f94e6398/chromium/patches/README

Blocking: -803898 832852
Cc: wolenetz@chromium.org
Fwd to M68
Updating third_party/ffmpeg to origin/master will fail with not enough registers for H264 compilation; which I thought I had fixed. Debugging now, but there's also a clang crash I'll see about filing:

export GN_DEFINES='is_component_build=true proprietary_codecs=true enable_nacl=false dcheck_always_on=true is_clang=true symbol_level=1 enable_mse_mpeg2ts_stream_parser=true enable_ac3_eac3_audio_demuxing=true ffmpeg_branding="Chrome" is_debug=false target_os="win" target_cpu="x86"'
ninja -C out/Release ffmpeg_internal -j 256


0.	Program arguments: /d/code/chrome/src/third_party/llvm-build/Release+Asserts/bin/clang -cc1 -triple i386-pc-windows-msvc19.11.0 -emit-obj -disable-free -main-file-name h264_cabac.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu pentium4 -mllvm -x86-asm-syntax=intel -D_MT -D_DLL --dependent-lib=msvcrt --dependent-lib=oldnames --show-includes -stack-protector 2 -fms-volatile -fdiagnostics-format msvc -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -ffunction-sections -fdata-sections -coverage-notes-file /d/code/chrome/src/out_win/Release/h264_cabac.gcno -nostdsysteminc -resource-dir /d/code/chrome/src/third_party/llvm-build/Release+Asserts/lib/clang/7.0.0 -include compat/msvcrt/snprintf.h -include compat/msvcrt/strtod.h -D HAVE_AV_CONFIG_H -D _POSIX_C_SOURCE=200112 -D _XOPEN_SOURCE=600 -D PIC -D FFMPEG_CONFIGURATION=NULL -D HAVE_EBP_AVAILABLE=1 -D _ISOC99_SOURCE -D _LARGEFILE_SOURCE -D HAVE_AV_CONFIG_H -D HAVE_INLINE_ASM=1 -D V8_DEPRECATION_WARNINGS -D DCHECK_ALWAYS_ON=1 -D USE_AURA=1 -D NO_TCMALLOC -D FULL_SAFE_BROWSING -D SAFE_BROWSING_CSD -D SAFE_BROWSING_DB_LOCAL -D CHROMIUM_BUILD -D FIELDTRIAL_TESTING_ENABLED -D CR_CLANG_REVISION="329921-1" -D _HAS_EXCEPTIONS=0 -D COMPONENT_BUILD -D __STD_C -D _CRT_RAND_S -D _CRT_SECURE_NO_DEPRECATE -D _SCL_SECURE_NO_DEPRECATE -D DEPRECATEDENUMERATOR(x)=[[deprecated(x)]] -D _ATL_NO_OPENGL -D _WINDOWS -D CERT_CHAIN_PARA_HAS_EXTRA_FIELDS -D PSAPI_VERSION=1 -D WIN32 -D _SECURE_ATL -D _USING_V110_SDK71_ -D WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D WIN32_LEAN_AND_MEAN -D NOMINMAX -D _UNICODE -D UNICODE -D NTDDI_VERSION=0x0A000002 -D _WIN32_WINNT=0x0A00 -D WINVER=0x0A00 -D NDEBUG -D NVALGRIND -D DYNAMIC_ANNOTATIONS_ENABLED=0 -D _CRT_NONSTDC_NO_WARNINGS -D _CRT_NONSTDC_NO_DEPRECATE -I ../../third_party/ffmpeg/chromium/config/Chrome/win/ia32 -I ../../third_party/ffmpeg -I ../.. -I gen -I ../../third_party/opus/src/include -D __DATE__= -D __TIME__= -D __TIMESTAMP__= -internal-isystem /d/code/chrome/src/third_party/llvm-build/Release+Asserts/lib/clang/7.0.0/include -internal-isystem /d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/win_sdk/bin/../../win_sdk/Include/10.0.15063.0/um -internal-isystem /d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/win_sdk/bin/../../win_sdk/Include/10.0.15063.0/shared -internal-isystem /d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/win_sdk/bin/../../win_sdk/Include/10.0.15063.0/winrt -internal-isystem /d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/win_sdk/bin/../../win_sdk/Include/10.0.15063.0/ucrt -internal-isystem /d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/win_sdk/bin/../../VC/Tools/MSVC/14.11.25503/include -internal-isystem /d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/1180cb75833ea365097e279efb2d5d7a42dee4b0/win_sdk/bin/../../VC/Tools/MSVC/14.11.25503/atlmfc/include -Os -Wno-deprecated-declarations -Wno-sign-compare -Wno-macro-redefined -Wno-builtin-macro-redefined -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wall -Wno-deprecated-declarations -Wno-unused-variable -Werror -Wno-unused-parameter -Wno-deprecated-declarations -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-unneeded-internal-declaration -Wno-inconsistent-missing-override -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-address-of-packed-member -Wno-unused-lambda-capture -Wno-user-defined-warnings -Wno-enum-compare-switch -Wno-null-pointer-arithmetic -Wno-ignored-pragma-optimize -Wno-return-std-move -Wno-incompatible-pointer-types -Wno-absolute-value -Wno-deprecated-declarations -Wno-incompatible-pointer-types -Wno-logical-op-parentheses -Wno-parentheses -Wno-pointer-sign -Wno-switch -Wno-unused-label -Wno-unused-variable -Wno-string-conversion -Wno-sometimes-uninitialized -Wno-unguarded-availability -Wno-unused-function -Wno-constant-conversion -Wno-inconsistent-dllimport -fdebug-compilation-dir /d/code/chrome/src/out_win/Release -ferror-limit 19 -fmessage-length 0 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 -fdelayed-template-parsing -finline-functions -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -load ../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so -add-plugin find-bad-constructs -plugin-arg-find-bad-constructs no-realpath -plugin-arg-find-bad-constructs check-enum-max-value -o obj/third_party/ffmpeg/ffmpeg_internal/h264_cabac.obj -x c ../../third_party/ffmpeg/libavcodec/h264_cabac.c 
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '../../third_party/ffmpeg/libavcodec/h264_cabac.c'.
4.	Running pass 'Greedy Register Allocator' on function '@ff_h264_decode_mb_cabac'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 7.0.0 (trunk 329921)
Target: i386-pc-windows-msvc
Thread model: posix
InstalledDir: /d/code/chrome/src/out_win/Release/../../third_party/llvm-build/Release+Asserts/bin
clang: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/h264_cabac-dd2374.c
clang: note: diagnostic msg: /tmp/h264_cabac-dd2374.sh
clang: note: diagnostic msg: 

********************
[590/591] CC obj/third_party/ffmpeg/ffmpeg_internal/h264qpel.obj

Project Member

Comment 25 by bugdroid1@chromium.org, Apr 25 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ff42c85019a8bcac70d988c76a28c84665cd0974

commit ff42c85019a8bcac70d988c76a28c84665cd0974
Author: Dale Curtis <dalecurtis@chromium.org>
Date: Wed Apr 25 00:54:23 2018

Roll src/third_party/ffmpeg/ c6aed052a..ba3208031 (4 commits)

https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+log/c6aed052aba9..ba32080311ac

$ git log c6aed052a..ba3208031 --date=short --no-merges --format='%ad %ae %s'
2018-04-24 dalecurtis Force HAVE_EBP_AVAILABLE=0 for Windows ia32 builds.
2018-04-17 dalecurtis Add support for building the Windows ffmpeg configuration on Linux!
2018-04-16 dalecurtis Run pyformat over chromium/scripts directory.
2018-04-16 dalecurtis Comment out FFMPEG_CONFIGURATION to avoid long string in binary.

Created with:
  roll-dep src/third_party/ffmpeg

BUG= 783021 
TBR=liberato

Change-Id: Ic6f2fd6c9df5b83ff806f658eb4b4cf20062e310
Reviewed-on: https://chromium-review.googlesource.com/1026209
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553401}
[modify] https://crrev.com/ff42c85019a8bcac70d988c76a28c84665cd0974/DEPS

Cc: mbonadei@chromium.org phoglund@chromium.org
Hi, https://chromium-review.googlesource.com/c/chromium/third_party/ffmpeg/+/1013323 prevents the Chromium Roll into WebRTC (WebRTC depends on ffmpeg).

The root cause is that WebRTC still supports MSVC and https://chromium-review.googlesource.com/c/chromium/third_party/ffmpeg/+/1013323 breaks these bots.

Some examples here:
https://build.chromium.org/p/tryserver.webrtc/builders/win_dbg/builds/32578
https://build.chromium.org/p/tryserver.webrtc/builders/win_rel/builds/40091
https://build.chromium.org/p/tryserver.webrtc/builders/win_x64_dbg/builds/22726
https://build.chromium.org/p/tryserver.webrtc/builders/win_x64_rel/builds/39436

I am wondering how we can fix this for the long term. Chromium is free to drop MSVC support since it is a binary and can actually dictate its agenda, but libraries are in a more complex situation. I think libraries that live in the Chromium ecosystem (e.g. WebRTC, V8, ffmpeg, etc..) should all agree on the minimum set of supported compilers. If we don't do that we'll end up in a situation like this one, where dependencies will stop supporting MSVC while libraries that use these dependencies still support it. :)

The short term solution is probably revert https://chromium-review.googlesource.com/c/chromium/third_party/ffmpeg/+/1013323. :(
imho webrtc is free to choose to support msvc, but it shouldn't impose that on its deps. If you want to keep this working, you should send a patch to make the deps compile again.
Yes, this is a possible solution even if it will be a bit painful for us.

Some problems are caused by inlined assembly routines enabled by HAVE_MMX_INLINE (and others).

Do you have any advice about how to fix this? I've read crbug.com/762167 but I am missing a lot of context here. :(
Hmm, I tried to keep this working by controlling the HAVE_INLINE_ASM flag in BUILD.gn; if it's not clang that should be set to zero and guard any usage of the INLINE assembly pieces. If that's not working probably we just need to update the failing locations to properly include HAVE_INLINE_ASM in their tests. Can 
https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/master/BUILD.gn#335

Looks like not every case is checking that flag. I.e. emms.h isn't checking correctly. We could also rewrite all HAVE_INLINE_{MMX|AVX} #define entries to HAVE_INLINE_ASM since I think it's always all or none since we have modern compilation.
Seems this boosted some webrtc quality metrics too:

https://chromeperf.appspot.com/group_report?rev=553401
Project Member

Comment 33 by bugdroid1@chromium.org, Apr 25 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/third_party/ffmpeg/+/16ee25d20583df326539f70180287acc39e53651

commit 16ee25d20583df326539f70180287acc39e53651
Author: Dale Curtis <dalecurtis@chromium.org>
Date: Wed Apr 25 21:06:04 2018

Allow msvc builds to keep working with inline assmebly.

Unfortunately ffmpeg doesn't properly (perhaps intentionally) guard
all inline assembly behind HAVE_INLINE_ASM, it instead uses both
that define as well as subfeature guards like HAVE_MMX_INLINE.

This patch rewrites "HAVE_\w+_INLINE 1" to be HAVE_INLINE_ASM which
is fine since we're always using a modern compiler so our flags are
either all or nothing.

A subsequent patch will add this to build_ffmpeg.py but this manual
patch unblocks the WebRTC roll.

BUG= 783021 
TEST=none

Change-Id: If0ee44cf9bf2bd08f8d937f330e56275d66e89ef
Reviewed-on: https://chromium-review.googlesource.com/1028839
Reviewed-by: Frank Liberato <liberato@chromium.org>

[modify] https://crrev.com/16ee25d20583df326539f70180287acc39e53651/chromium/config/Chromium/win/ia32/config.h
[modify] https://crrev.com/16ee25d20583df326539f70180287acc39e53651/chromium/config/Chrome/win/x64/config.h
[modify] https://crrev.com/16ee25d20583df326539f70180287acc39e53651/chromium/config/Chrome/win/ia32/config.h
[modify] https://crrev.com/16ee25d20583df326539f70180287acc39e53651/chromium/config/Chromium/win/x64/config.h

@#32 I'm not certain such boosting occurred, unfortunately. Those two improving metrics look like they're reverting a recent perf regression:

https://chromeperf.appspot.com/group_report?keys=agxzfmNocm9tZXBlcmZyFAsSB0Fub21hbHkYgICQzqaloQkM

https://chromeperf.appspot.com/group_report?keys=agxzfmNocm9tZXBlcmZyFAsSB0Fub21hbHkYgICQjpf_pwsM
Ahh, thanks Matt. Booo :p
Project Member

Comment 36 by bugdroid1@chromium.org, Apr 25 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/df34887d5cf2c0ea0461656a5f8d6057257bf40c

commit df34887d5cf2c0ea0461656a5f8d6057257bf40c
Author: Dale Curtis <dalecurtis@chromium.org>
Date: Wed Apr 25 23:22:52 2018

Roll src/third_party/ffmpeg/ ba3208031..16ee25d20 (1 commit)

https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+log/ba32080311ac..16ee25d20583

$ git log ba3208031..16ee25d20 --date=short --no-merges --format='%ad %ae %s'
2018-04-25 dalecurtis Allow msvc builds to keep working with inline assmebly.

Created with:
  roll-dep src/third_party/ffmpeg

BUG= 783021 
TEST=none
TBR=liberato

Change-Id: I7e113fab5b3e03393a40bee445c26290778481cb
Reviewed-on: https://chromium-review.googlesource.com/1028842
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553814}
[modify] https://crrev.com/df34887d5cf2c0ea0461656a5f8d6057257bf40c/DEPS

Cc: oprypin@chromium.org
Seems this didn't completely resolve the issue per +oprypin. There are a few other variables that MSVC needs set. Supporting all of these rewrites is going to be an ongoing maintenance pain, so instead I'll copy back the msvc configs into a new win-msvc directory.

This will _temporarily_ allow msvc support to continue for the next couple weeks, but when liberato@ updates the config files like we do every 6 weeks, they will break again. The overhead of generating these configs on windows every six weeks is quite painful and the most exciting thing about clang-cl for us.

After that point, we'll follow the general guidelines thakis@ mentions above, msvc support patches will be accepted if someone else wants to update the configuration files. I'll leave the code in build_ffmpeg.py for this, but we won't keep it up to date anymore. So you'll need to transition the webrtc bots to use clang-cl or identify another path forward here.
// The previous message refers to this comment:
https://chromium-review.googlesource.com/c/chromium/third_party/ffmpeg/+/1028839#message-97daba5e46fd86f6b79d61531fadd572573513b4

Thanks for the temporary solution.
The point isn't about the bots, it's that WebRTC has to support MSVC, and having MSVC bots is necessary to keep that up.
That's fine, but it doesn't mean Chromium has to continue to support MSVC per thakis@ above; so you'll need to identify another way for that process to work.
Project Member

Comment 41 by bugdroid1@chromium.org, Apr 26 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/third_party/ffmpeg/+/156e91a4f377b985b6455155a8d4ba0f7608a96a

commit 156e91a4f377b985b6455155a8d4ba0f7608a96a
Author: Dale Curtis <dalecurtis@chromium.org>
Date: Thu Apr 26 18:50:26 2018

Remove HAVE_INLINE_ASM overrides. Copy msvc configs to win-msvc.

To temporarily unblock the WebRTC team, we'll keep a copy of the
old msvc based configuration files so that ffmpeg can continue
to be built with msvc.

Going forward the media team won't update these files; i.e., we
will only maintain the clang-cl based versions. We will accept
patches to update them though per the wider chromium mandate to
accept such patches.

This change copies the pre-clang-cl config files to a new win-msvc
directory and teaches the chromium build to select them when clang
is not used. It also removes all the HAVE_INLINE_ASM overrides since
they don't seem to work anyways.

BUG= 783021 
TEST=none

Change-Id: Ie2f6ce813d08a24441b4a3cd95219385d493b14c
Reviewed-on: https://chromium-review.googlesource.com/1030779
Reviewed-by: Frank Liberato <liberato@chromium.org>

[modify] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win/x64/config.h
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/ia32/libavcodec/bsf_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/ia32/libavformat/demuxer_list.c
[modify] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/ffmpeg_options.gni
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/x64/config.asm
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/ia32/libavcodec/parser_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/x64/libavcodec/codec_list.c
[modify] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win/ia32/config.h
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/ia32/libavcodec/parser_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/ia32/libavformat/demuxer_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/x64/libavutil/avconfig.h
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/ia32/libavutil/avconfig.h
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/ia32/config.h
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/ia32/libavformat/muxer_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/x64/libavcodec/parser_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/x64/libavformat/demuxer_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/x64/libavcodec/bsf_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/ia32/libavformat/protocol_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/x64/libavcodec/bsf_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/x64/libavutil/ffversion.h
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/x64/libavutil/ffversion.h
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/ia32/libavcodec/codec_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/x64/config.h
[modify] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win/x64/config.h
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/ia32/libavutil/ffversion.h
[modify] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win/ia32/config.h
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/ia32/libavcodec/codec_list.c
[modify] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/BUILD.gn
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/x64/config.h
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/ia32/config.h
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/x64/libavutil/avconfig.h
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/x64/libavformat/demuxer_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/ia32/libavutil/ffversion.h
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/x64/libavcodec/codec_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/ia32/libavutil/avconfig.h
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/ia32/libavformat/muxer_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/x64/libavformat/protocol_list.c
[modify] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/scripts/build_ffmpeg.py
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/x64/libavformat/protocol_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/ia32/libavcodec/bsf_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/ia32/config.asm
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/x64/libavformat/muxer_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/x64/libavformat/muxer_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/ia32/libavformat/protocol_list.c
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/x64/config.asm
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chrome/win-msvc/ia32/config.asm
[add] https://crrev.com/156e91a4f377b985b6455155a8d4ba0f7608a96a/chromium/config/Chromium/win-msvc/x64/libavcodec/parser_list.c

Project Member

Comment 42 by bugdroid1@chromium.org, Apr 26 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/third_party/ffmpeg/+/32dbc2392125c317dc63100649878ee60999516f

commit 32dbc2392125c317dc63100649878ee60999516f
Author: Dale Curtis <dalecurtis@chromium.org>
Date: Thu Apr 26 20:55:14 2018

Update windows cross-compile build for removed setup_toolchain.py param.

BUG= 783021 

Change-Id: Ia12351bfcee553b7759673af6fc7699eb578c76d
Reviewed-on: https://chromium-review.googlesource.com/1030970
Reviewed-by: Frank Liberato <liberato@chromium.org>

[modify] https://crrev.com/32dbc2392125c317dc63100649878ee60999516f/chromium/scripts/build_ffmpeg.py

Project Member

Comment 43 by bugdroid1@chromium.org, Apr 27 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1d11e0cd42e1f26798df1f843a5d285daf2ef7f7

commit 1d11e0cd42e1f26798df1f843a5d285daf2ef7f7
Author: Dale Curtis <dalecurtis@chromium.org>
Date: Fri Apr 27 01:01:20 2018

Roll src/third_party/ffmpeg/ 16ee25d20..156e91a4f (1 commit)

https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+log/16ee25d20583..156e91a4f377

$ git log 16ee25d20..156e91a4f --date=short --no-merges --format='%ad %ae %s'
2018-04-26 dalecurtis Remove HAVE_INLINE_ASM overrides. Copy msvc configs to win-msvc.

Created with:
  roll-dep src/third_party/ffmpeg

BUG= 783021 
TBR=liberato

Change-Id: Id89cb88205204ba071aea4a447ca940a7f8f1218
Reviewed-on: https://chromium-review.googlesource.com/1030819
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554246}
[modify] https://crrev.com/1d11e0cd42e1f26798df1f843a5d285daf2ef7f7/DEPS

Thanks Dale for unblocking us!

What needs to be done to generate those configs? Do you get a new ffmpeg, run ./configure for msvc and check them in to the win-msvc dir?
Labels: M-68
Status: Fixed (was: Assigned)
No, it's definitely not that simple or we wouldn't be against keeping it running. It's often broken and you can't run the build scripts without something like Cygwin or MSVC which require their own custom patches to even run. It's not unexpected for configure itself to be broken after an update (done every 6 weeks). Generally some amount of arcana is required to fix these problems.

Documentation is available in build_ffmpeg.py. I've also recovered the now-deleted instructions from our official documentation (linked from README.chromium) for how to update these configuration files for MSVC:

https://docs.google.com/document/d/e/2PACX-1vRD9l5KgwbJ25wBe7oKFRpHHFw1dIrxNUCUlEec-OzR7gHN9pCXNf_CZPeJ08iKZFGtc-AhHWgNo6mU/pub
(Another option for webrtc might be to offer prebuilt libraries. These could be built by clang-cl since it's ABI-compatible with MSVC.)
Err s/like Cygwin or MSVC/like Cygwin or MingW/
Re #45: I suspected as much :) Thanks for retrieving the documentation. Ok, we need to find some solution to that then. Nico's suggestion in #46 sounds worth looking into.

Filed https://bugs.chromium.org/p/webrtc/issues/detail?id=9213.

Sign in to add a comment