FFmpegInterop: cl is unable to create an executable file.

Followed the guide

Configure throws:

cl is unable to create an executable file. C compiler test failed.

$ which link
/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/x86_amd64/link

$ which cl
/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/x86_amd64/cl

$ echo $PATH
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/CommonExtensions/Microsoft/TestWindow:/c/Program Files (x86)/MSBuild/14.0/bin:/c/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE:/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/x86_amd64:/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN:/c/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/Tools:/c/WINDOWS/Microsoft.NET/Framework/v4.0.30319:/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/VCPackages:/c/Program Files (x86)/HTML Help Workshop:/c/Program Files (x86)/Microsoft Visual Studio 14.0/Team Tools/Performance Tools:/c/Program Files (x86)/Windows Kits/8.1/bin/x86:/c/Program Files (x86)/Microsoft SDKs/Windows/v10.0A/bin/NETFX 4.6 Tools:/c/ProgramData/Oracle/Java/javapath:/c/Program Files (x86)/Common Files/Intel/Shared Libraries/redist/intel64/compiler:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files (x86)/QuickTime/QTSystem:/c/Program Files (x86)/Livestreamer:/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/c/Program Files (x86)/GtkSharp/2.12/bin:/c/Program Files/nodejs:/c/Program Files (x86)/Skype/Phone:/c/Program Files/OpenVPN/bin:/c/Program Files/Common Files/Autodesk Shared:/c/Program Files (x86)/Autodesk/Backburner:/c/Users/coral/AppData/Local/Programs/Python/Python35/Scripts:/c/Users/coral/AppData/Local/Programs/Python/Python35/ :/c/ffmpeg/bin:/c/Users/coral/AppData/Roaming/npm:/c/Users/coral/AppData/Local/Programs/Git/cmd:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 24 (7 by maintainers)

Most upvoted comments

I ran into this problem recently and found this issue at the top of Google, so I figured I’d drop this here for any future pioneers building FFMPEG in this manner, following this guide

https://trac.ffmpeg.org/wiki/CompilationGuide/WinRT

The problem with that guide is when it tells you to set some environment variables in the command prompt before launching the MSYS2 shell, to build the actual code (ffmpeg). Specifically This. Friggin. Step.

SET LIB=%VSINSTALLDIR%VC\lib\store\amd64;%VSINSTALLDIR%VC\atlmfc\lib\amd64;%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64;;%UniversalCRTSdkDir%lib\%UCRTVersion%\um\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\lib\um\x64;;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\Lib\um\x64
SET LIBPATH=%VSINSTALLDIR%VC\atlmfc\lib\amd64;%VSINSTALLDIR%VC\lib\amd64;
SET INCLUDE=%VSINSTALLDIR%VC\include;%VSINSTALLDIR%VC\atlmfc\include;%UniversalCRTSdkDir%Include\%UCRTVersion%\ucrt;%UniversalCRTSdkDir%Include\%UCRTVersion%\um;%UniversalCRTSdkDir%Include\%UCRTVersion%\shared;%UniversalCRTSdkDir%Include\%UCRTVersion%\winrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\Include\um;

First of all, those paths may not even resolve to anything so double check. in my case %VSINSTALLDIR% wasn’t even defined. These paths also vary depending on which version of VS you have, and which version of the build tools. For example:

%VSINSTALLDIR%VC\lib\store\amd64

was flat out wrong. I had to change it to

%VSINSTALLDIR%VC\Tools\MSVC\14.22.27905\lib\x64\store

to actually point it to the right place

Anyways, root cause is likely this: it can’t compile because it can’t find the dang libs or headers, cause the Include And Lib paths are likely borked, so double check those paths before building anything. Daggum

Hi @arn0dre

It looks like link in your path is the one from MSYS and not from Visual Studio. From the instructions on https://trac.ffmpeg.org/wiki/CompilationGuide/WinRT You might have missed this following step: Rename or remove link.exe in the MSYS2 usr bin folder (E.g. C:\msys64\usr\bin\link.exe) to prevent conflict with MSVC link.exe

in Developer Command Prompt try this msys2_shell.cmd -use-full-path

I’m getting the same problems in a different project while building libav on Windows, but running this command from msys2 root folder solved the cl problem for me!

Hi @DaweiX,

Can you open FFmpegConfig.sh and copy the command-line to build FFmpeg and see if that works? If cl is not found that’s usually a sign that the path is not properly passed to MSys2.

I installed pkg-config with pacman -S pkg-config, but still I’m unable to build.

config.log

zoompan_filter_deps=swscale
mktemp -u XXXXXX
PSKP72
check_ld cc
check_cc
BEGIN ./ffconf.8gJjbbTD.c
    1   int main(void){ return 0; }
END ./ffconf.8gJjbbTD.c
cl -nologo -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64 -MD -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_WIN32_WINNT=0x0A00 -c -Fo./ffconf.RhmeOMsT.o ./ffconf.8gJjbbTD.c
ffconf.8gJjbbTD.c
link -APPCONTAINER WindowsApp.lib -o ./ffconf.1PVtJIuY.exe ./ffconf.RhmeOMsT.o
link: unknown option -- A
Try 'link --help' for more information.
C compiler test failed.
$ which cl
/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/amd64_x86/cl

$ which link
/usr/bin/link

$ which armasm
/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_arm/armasm

$ which yasm
/usr/bin/yasm

$ which cpp
/usr/bin/cpp

in BuildFFmpeg.bat I also set the MSYS2_PATH_TYPE=inherit

@setlocal
@echo off

if "%1" == "/?" goto Usage
if "%~1" == "" goto Usage

:: Initialize build configuration
set BUILD.ARM=N
set BUILD.x86=N
set BUILD.x64=N
set BUILD.win10=N
set BUILD.win8.1=N
set BUILD.phone8.1=N
set MSYS2_PATH_TYPE=inherit

Visual Studio Community 2015, Win 10