clsid2 / mpc-hc

Media Player Classic
GNU General Public License v3.0
10.54k stars 482 forks source link

Error during compiling MPC 1.9.2 #328

Closed YMahmoudnia closed 4 years ago

YMahmoudnia commented 4 years ago

Hello. What these errors ?

dav1d >= 0.4.0 not found using pkg-config LAVFilters C:\MPC\mpc-hc\src\thirdparty\LAVFilters\EXEC 1

And

Error MSB3073 The command "build_lavfilters.bat Rebuild Win32 Release Silent Nocolors" exited with code -1. LAVFilters C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets 49.

I use : Visual Studio 2017 - Latest Update MSYS_MinGW-w64_GCC_630_x86-x64 Windows 10 ENT x64 Latest Update

build.user.bat contents

@ECHO OFF SET "MPCHC_MSYS=C:\MSYS" SET "MPCHC_MINGW32=%MPCHC_MSYS%\mingw" SET "MPCHC_MINGW64=%MPCHC_MINGW32%" REM Git is optional to set if you chose to add it in PATH when installing it SET "MPCHC_GIT=C:\Program Files\Git\bin" REM Optional, if you plan to modify the translations, install Python 2.7 or set the variable to its path SET "MPCHC_PYTHON=C:\Python27"

MPC-HC compiled with these errors but LAVFilters not.

Thank you.

clsid2 commented 4 years ago

I use the following method of installing MSYS:

Download MSYS2 https://sourceforge.net/projects/msys2/files/Base/x86_64/

Install it in c:\msys64

Open MSYS2 command prompt, and then update: pacman -Syuu (repeat until no more updates are available)

Then install these extra components: pacman -S pkg-config pacman -S diffutils pacman -S make

Extract latest MinGW GCC package from nevcairiel into c:\msys64\mingw64 https://files.1f0.de/mingw/

Download Yasm: http://www.tortall.net/projects/yasm/releases/yasm-1.3.0-win64.exe

Rename it to yasm.exe Put it in C:\msys64\mingw64\bin

(OPTIONAL) Add to %PATH% environment variable in Windows System settings: C:\msys64\mingw64\bin;c:\msys64\usr\bin

YMahmoudnia commented 4 years ago

Thank you @clsid2 for useful information but I think I have serious problem with LAVFilters. I did all of your instructions step by step but still get same errors.

Is there anything else ? maybe I forgot some prerequisites steps. I don't know.

bfoos commented 4 years ago

Where do you have all of your build tools installed? If you've installed them someplace other than the default variables set in the build.user.bat, you will need to edit that .bat appropriately. LAV can be a tricky beast to compile on it's own for me but I've never had issues with compilation of it inside the mpc-hc.sln projects list while following the steps in the Compilation.md file in /Docs/

clsid2 commented 4 years ago

It seems to be unable to locate the pkg-config configuration files.

Open the build_ffmpeg.sh file and try with an absolute path in this lines: export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:../thirdparty/32/lib/pkgconfig/" PKG_CONFIG_PREFIX_DIR="--define-variable=prefix=../thirdparty/32"

adipose commented 4 years ago

@bfoos

Make sure you manually get the mingw64, rather than the msys2 bundle.

bfoos commented 4 years ago

Ummm ok sure why not. It's Saturday, I'm self-isolating after all. May as well butcher my perfectly functional build setup. Seriously, I'm going to do it! Actually I already did that. I use msys2/mingw for other things and MPC compiles using mingw64 9.2 r31 from here

adipose commented 4 years ago

This is my user.bat:

    @ECHO OFF
    SET "MSYSTEM=MINGW32"
    SET "MPCHC_MSYS=C:\MSYS64"
    SET "MPCHC_MINGW32=%MPCHC_MSYS%\mingw"
    SET "MPCHC_MINGW64=%MPCHC_MINGW32%"
    REM You can set `MSYS2_PATH_TYPE` here or in environment variables so that Git is properly added to your `PATH`
    REM SET "MSYS2_PATH_TYPE=inherit"
    REM `MPCHC_GIT` is optional to set if you chose to add it in `PATH` when installing it and have set `MSYS2_PATH_TYPE`
    SET "MPCHC_GIT=C:\Program Files\Git"
    REM Optional, if you plan to modify the translations, install Python 2.7 or set the variable to its path
    SET "MPCHC_PYTHON=C:\Python27"
    REM Optional, If you want to customize the Windows SDK version used, set the variable
    SET "MPCHC_WINSDK_VER=8.1"
adipose commented 4 years ago

So, I have mingw32 and mingw64 in my msys2 install, but the mingw I use has been placed in the msys64\mingw folder. Looks like yours is pointing at the same place.

It shouldn't cause issues with other toolchains.

bfoos commented 4 years ago

It doesn't cause issues with other toolchains.

adipose commented 4 years ago

@bfoos , sorry, I meant to send those messages to @SecureByte , not you!

bfoos commented 4 years ago

@adipose Haha, no worries. I have been experimenting lately with trying to simplify my toolchain setup after reinstalling Windows, which is why I didn't post my build.user as it points to other places on other drives as I don't like cluttering up the root of my system drive with build tools. All I can say is pay close attention to paths if you do this. One errant quotation mark can make for a confusing and frustrating experience!

clsid2 commented 4 years ago

When adding the folders to %PATH%, make sure they are in front of other third party stuff.

For example Git also adds itself there and contains stuff like bash in its folder. So to avoid potential issues, the MSYS/MinGW paths should have higher priority in the lookup chain.

adipose commented 4 years ago

I personally don't add anything special to the path. The user bat I posted is enough for my builds.

clsid2 commented 4 years ago

I have been able to reproduce the error.

Be sure to use GCC 9.2 build from here: http://files.1f0.de/mingw/

8.3 (and older probably also) will cause the error.

bfoos commented 4 years ago

@adipose I don't add anything special to %PATH% either. The paths I was referring to were specifically for the build.user.bat

kenny1983 commented 3 years ago

@adipose Haha, no worries. I have been experimenting lately with trying to simplify my toolchain setup after reinstalling Windows, which is why I didn't post my build.user as it points to other places on other drives as I don't like cluttering up the root of my system drive with build tools. All I can say is pay close attention to paths if you do this. One errant quotation mark can make for a confusing and frustrating experience!

Ain't that the truth!! In my case it wasn't an errant quotation mark, but the fact that the suggested place to extract MinGW to is C:\MSYS64\mingw64\, while the default build.user.bat expects it to be at %MPCHC_MSYS%\mingw (note the lack of the '64' part). Two freaking characters missing from my build.user.bat caused three freaking hours of utter confusion and screaming at the computer!

This really needs to be made more clear in docs/Compilation.md, so I will do so in my forked repo, but I'm also stating it here in case some other noob like me comes across the same issue in the future. Hope it helps someone ;-)

P.S. I am still utterly confused as to how anyone has ever gotten the default build.user.bat to work properly in this regard, and would appreciate an explanation from @clsid2 or one of the other main devs. Thanks 😄

clsid2 commented 3 years ago

It clearly says to adapt the paths to the ones that you used. I will adjust the example to use mingw64.

kenny1983 commented 3 years ago

Yes I understand that I didn't adapt paths as necessary, but yeah it's very confusing (for me at least) to see one instruction saying one path, and another saying another. You, for whatever reason, made a simple typo that I, due to tiredness and oversight, wasn't able to correct for 3 hours.

Anyway thank you for accepting my suggestion to fix it. I hope that once I finally get this project to compile, I'll be able to stop complaining and start contributing in an appreciated manner 😄 And also a huge thanks for rebirthing this project and giving me a place to contribute to in the first place. I've used and loved MPC-HC ever since it was called Media Player Classic and maintained by Gabest (too long to remember exactly how long, but at least a decade, maybe even two! 😉)