microsoft / FFmpegInterop

This is a code sample to make it easier to use FFmpeg in Windows applications.
Apache License 2.0
1.29k stars 310 forks source link

which: no cl in... help needed #92

Closed Hanzalah-Adalan closed 5 years ago

Hanzalah-Adalan commented 8 years ago

I followed exactly step-by-step what has been told in https://trac.ffmpeg.org/wiki/CompilationGuide/WinRT .. everything is happy till the instructions on the page told me to verify my FFmpeg Environment Setup by running the following commands:

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

$ which link
/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/x86_ARM/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

$ which gas-preprocessor.pl
/usr/bin/gas-preprocessor.pl

unfortunately, this is what I got msys2 error

one more thing that has changed in the msys64 installation folder, there's no "msys2_shell.bat", what's there instead "msys2_shell.cmd".. msys2 missing file

I did some quick search on google and found that there's almost no practical difference between .bat and .cmd file, thus I assumed that this is not a real problem.. I'm so sorry if this happens to be way too noob to ask.. all I care about right now is just I want to see my FFmpegInterop.vcxproj build with no error..

to all geniuses out there, if you were to answer this please make your explanation as simple as possible so that a total noob like me can follow along without flowing their tears..

Regards.

Belunn commented 8 years ago

Did yot start the msys2_shell.cmd from the Visual studio command prompt? If you start the msys2_shell.cmd directly by simply double click it you will get this error. You have to first start the "VS2015 x86 ARM Cross Tools Command Prompt" and run the .cmd file from there. The fact that it is a cmd file and not a bat file does not matter. I also have to run the "VS2015 x86 ARM Cross Tools Command Prompt" as an administrator in order for it to work.

Hanzalah-Adalan commented 8 years ago

I do start the msys2_shell.cmd from the Visual studio command prompt and tried to run the "VS2015 x86 ARM Cross Tools Command Prompt" as an administrator, but I still get those errors: result

I noticed the capitalization is a little different between what's shown on the instructions page and what's on my machine running Visual Studio 2015 with update 3 (anniversary update).. this is what I mean

what's on the instructions page: original dir

what's on my machine: different vs dir

I'm not sure if this "case sensitive stuff" is really the issue here..

come someone out there remake the compilation guide with the latest and updated tools and information.. I'm really stuck here.. or is there any other alternative I can choose to make use of ffmpeg for UWP?

khouzam commented 8 years ago

Hi @Hanzalah-Adalan

We've included a script to help get FFmpeg built, you can find it at the root folder of FFmpegInterop: buildFFmpeg.bat, this will setup your environment appropriately and allow you to choose which platform and architecture to build. I just tried it a few days ago on a clean machine with VS 2015 Update 3.

Also, we've recently updated the build instructions for the environment changes that MSys makes when you update it and doesn't inherit the environment from the invoking shell by default. You need to set the following environment variable to get the inheritance to work: set MSYS2_PATH_TYPE=inherit

Perhaps we didn't make it clear enough in the instruction: Download the latest MSYS2 installer from ​http://msys2.github.io/ and follow the installation instruction closely from the installation webpage. In order for the environment from the Windows side to be inherited on the MSYS2 side, uncomment the following line from msys2_shell.bat if it is present: replace rem set MSYS2_PATH_TYPE=inherit with set MSYS2_PATH_TYPE=inherit this will allow the environment variables for Visual Studio to be transferred to the MSYS2 environment and back.

Please try and tell us how it goes.

Thanks

Hanzalah-Adalan commented 8 years ago

I've already uncommented rem set MSYS2_PATH_TYPE=inherit by removing the REM keyword using VS editor rem

but I still get those errors.. One thing that disturbs me right now is that the msys2 shell is suppossed to close and re-open once I run this command C:\msys64\msys2_shell.cmd in Visual Studio ARM Cross Tools Command Prompt like what's been told on the page potential

..but in my case that command open a new instance of the msys2 shell instead separate

I guess this is where I made mistake and I don't know how to make it right..

khouzam commented 8 years ago

That's interesting, the path seems to indicate that the environment is still not inherited. Can you try to set the environment variable in the developer prompt before invoking the msys_shell?

Can you try to remove the echo off and see the output of the commands that get executed when you start the msys shell? Opening in a new windows is not a problem.

Sorry to ask again, but have you tried our BuildFFMpeg.bat script? It should do everything that you need automatically.

Hanzalah-Adalan commented 8 years ago

I tried to invoke the BuildFFMpeg.bat by double-clicking it, it executes in the blink of an eye.. I don't know what was going on.. what did the batch file do exactly.. I'm not sure whether it worked or crashed.. lol.. Sorry I'm not used to batch programming at all.. giphy

after I removed the @echo off in the beginning of the msys2_shell.cmd file, it outputs the following lines in Visual Studio ARM Cross Tools Command Prompt:

C:\WINDOWS\system32>C:\msys64\msys2_shell.cmd

C:\WINDOWS\system32>setlocal

C:\WINDOWS\system32>set "WD=C:\WINDOWS\system32\"

C:\WINDOWS\system32>if NOT EXIST "C:\WINDOWS\system32\msys-2.0.dll" set "WD=C:\msys64\usr\bin\"

C:\WINDOWS\system32>rem To activate windows native symlinks uncomment next line

C:\WINDOWS\system32>rem set MSYS=winsymlinks:nativestrict

C:\WINDOWS\system32>rem Set debugging program for errors

C:\WINDOWS\system32>rem set MSYS=error_start:C:\msys64\usr\bin\../../mingw64/bin/qtcreator.exe^|-debug^|^<process-id^>

C:\WINDOWS\system32>rem To export full current PATH from environment into MSYS2 use '-use-full-path' parameter

C:\WINDOWS\system32>rem or uncomment next line

C:\WINDOWS\system32>set msys2_path_type=inherit

C:\WINDOWS\system32>rem Help option

C:\WINDOWS\system32>if "x" == "x-help" (
call :printhelp "msys2_shell.cmd"
 exit /b 0
)

C:\WINDOWS\system32>if "x" == "x--help" (
call :printhelp "msys2_shell.cmd"
 exit /b 0
)

C:\WINDOWS\system32>if "x" == "x-?" (
call :printhelp "msys2_shell.cmd"
 exit /b 0
)

C:\WINDOWS\system32>if "x" == "x/?" (
call :printhelp "msys2_shell.cmd"
 exit /b 0
)

C:\WINDOWS\system32>rem Shell types

C:\WINDOWS\system32>if "x" == "x-msys" shift & set MSYSTEM=MSYS  & goto :checkparams

C:\WINDOWS\system32>if "x" == "x-msys2" shift & set MSYSTEM=MSYS  & goto :checkparams

C:\WINDOWS\system32>if "x" == "x-mingw32" shift & set MSYSTEM=MINGW32  & goto :checkparams

C:\WINDOWS\system32>if "x" == "x-mingw64" shift & set MSYSTEM=MINGW64  & goto :checkparams

C:\WINDOWS\system32>if "x" == "x-mingw" shift & (if exist "C:\msys64\usr\bin\..\..\mingw64" (set MSYSTEM=MINGW64 )  else (set MSYSTEM=MINGW32 ) )  & goto :checkparams

C:\WINDOWS\system32>rem Console types

C:\WINDOWS\system32>if "x" == "x-consolez" shift & set MSYSCON=console.exe  & goto :checkparams

C:\WINDOWS\system32>if "x" == "x-mintty" shift & set MSYSCON=mintty.exe  & goto :checkparams

C:\WINDOWS\system32>if "x" == "x-conemu" shift & set MSYSCON=conemu  & goto :checkparams

C:\WINDOWS\system32>if "x" == "x-defterm" shift & set MSYSCON=defterm  & goto :checkparams

C:\WINDOWS\system32>rem Other parameters

C:\WINDOWS\system32>if "x" == "x-full-path" shift & set MSYS2_PATH_TYPE=inherit  & goto :checkparams

C:\WINDOWS\system32>if "x" == "x-use-full-path" shift & set MSYS2_PATH_TYPE=inherit  & goto :checkparams

C:\WINDOWS\system32>if "x" == "x-here" shift & set CHERE_INVOKING=enabled_from_arguments  & goto :checkparams

C:\WINDOWS\system32>if "x" == "x-where" (
if "x" == "x" (
echo Working directory is not specified for -where parameter.  1>&2
 exit /b 2
)
 cd /d ""   || (
echo Cannot set specified working diretory "".  1>&2
 exit /b 2
)
 set CHERE_INVOKING=enabled_from_arguments
)  & shift & shift & goto :checkparams

C:\WINDOWS\system32>rem Setup proper title

C:\WINDOWS\system32>if "" == "MINGW32" (set "CONTITLE=MinGW x32" )  else if "" == "MINGW64" (set "CONTITLE=MinGW x64" )  else (set "CONTITLE=MSYS2 MSYS" )

C:\WINDOWS\system32>if "x" == "xmintty.exe" goto startmintty

C:\WINDOWS\system32>if "x" == "xconsole.exe" goto startconsolez

C:\WINDOWS\system32>if "x" == "xconemu" goto startconemu

C:\WINDOWS\system32>if "x" == "xdefterm" goto startsh

C:\WINDOWS\system32>if NOT EXIST "C:\msys64\usr\bin\mintty.exe" goto startsh

C:\WINDOWS\system32>set MSYSCON=mintty.exe

C:\WINDOWS\system32>start "MSYS2 MSYS" "C:\msys64\usr\bin\mintty" -i /msys2.ico /usr/bin/bash --login

C:\WINDOWS\system32>exit /b 0

C:\WINDOWS\system32>

this is just not my day I guess because I only know VB and C#.... scripting in batch/cmd and C++ is relatively new to me.. thank you so much anyway @khouzam for answering

khouzam commented 8 years ago

Hi @Hanzalah-Adalan,

In order to run the build script so that it doesn't close, you can simply run it from a developer command prompt (or even a regular command prompt). It will fail the first time, asking your to specify the location of MSYS2. If you installed it in the default location, then simply copying the set MSYS2_BIN="C:\msys64\usr\bin\bash.exe" command and re-running the batch file should just work. If it fails, then we can look at the config.log to try to understand what's wrong.

ghost commented 7 years ago

@Hanzalah-Adalan https://blogs.msdn.microsoft.com/vcblog/2013/04/19/finding-the-visual-studio-command-prompts-in-visual-studio-2012/

I had the same issue and this solved it!