mgba icon indicating copy to clipboard operation
mgba copied to clipboard

Visual Studio CMake errors

Open jwalway opened this issue 2 years ago • 18 comments

Hello,

I'm getting CMake errors.

Some details:

I'm using the most recent build, I assume. I cloned the repository today. I'm not sure where to find the build version number. I looked around for it on this github repository.

I'm on Windows 10, 64-bit

Graphics Card: AMD Radeon (TM) R9 380 Series

I was following the Visual Studio building instructions on the front page: https://github.com/mgba-emu/mgba

I installed these: vcpkg install ffmpeg[vpx,x264] libepoxy libpng libzip lua sdl2 sqlite3

and I installed these: vcpkg install qt5-base qt5-multimedia

This took about four hours total. I think that all went well.

I then used Visual Studio to clone the project from here https://github.com/mgba-emu/mgba.git. That worked fine.

Finally, I got to the CMake part and in Visual Studio it gave the output I show below.

It says it couldn't find the epoxy module. It says "Windows requires epoxy module!" I don't normally use CMake to build Visual Studio projects. I mean, I have used CMake on the command line, but not within Visual Studio. I also assumed this would be 32-bit build. VS seems to want a 64-bit build.

I wonder if anyone knows what I'm doing wrong here.

1> CMake generation started for configuration: 'x64-Debug'.
1> Found and using vcpkg toolchain file (E:/Programs/vcpkg/vcpkg-master/scripts/buildsystems/vcpkg.cmake).
1> Command line: "C:\WINDOWS\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="E:\Projects\Fiverr\jek0jak21\mgba\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe"  -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" -DCMAKE_TOOLCHAIN_FILE="E:/Programs/vcpkg/vcpkg-master/scripts/buildsystems/vcpkg.cmake" "E:\Projects\Fiverr\jek0jak21\mgba" 2>&1"
1> Working directory: E:\Projects\Fiverr\jek0jak21\mgba\out\build\x64-Debug
1> [CMake] -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
1> [CMake] -- Checking for one of the modules 'FFMPEG'
1> [CMake] CMake Warning at src/platform/cmake/FindFeature.cmake:83 (message):
1> [CMake]   Requested module FFMPEG missing for feature USE_FFMPEG.  Feature disabled.
1> [CMake] Call Stack (most recent call first):
1> [CMake]   CMakeLists.txt:476 (find_feature)
1> [CMake] -- Checking for one of the modules 'minizip'
1> [CMake] CMake Warning at src/platform/cmake/FindFeature.cmake:83 (message):
1> [CMake]   Requested module minizip missing for feature USE_MINIZIP.  Feature
1> [CMake]   disabled.
1> [CMake] Call Stack (most recent call first):
1> [CMake]   CMakeLists.txt:485 (find_feature)
1> [CMake] -- Checking for one of the modules 'libzip'
1> [CMake] CMake Warning at src/platform/cmake/FindFeature.cmake:83 (message):
1> [CMake]   Requested module libzip missing for feature USE_LIBZIP.  Feature disabled.
1> [CMake] Call Stack (most recent call first):
1> [CMake]   CMakeLists.txt:487 (find_feature)
1> [CMake] -- Checking for one of the modules 'epoxy'
1> [CMake] CMake Warning at src/platform/cmake/FindFeature.cmake:83 (message):
1> [CMake]   Requested module epoxy missing for feature USE_EPOXY.  Feature disabled.
1> [CMake] Call Stack (most recent call first):
1> [CMake]   CMakeLists.txt:488 (find_feature)
1> [CMake] -- Checking for one of the modules 'libelf'
1> [CMake] CMake Warning at src/platform/cmake/FindFeature.cmake:83 (message):
1> [CMake]   Requested module libelf missing for feature USE_ELF.  Feature disabled.
1> [CMake] Call Stack (most recent call first):
1> [CMake]   CMakeLists.txt:491 (find_feature)
1> [CMake] CMake Error at E:\Projects\Fiverr\jek0jak21\mgba\CMakeLists.txt:719 (message):
1> [CMake]   Windows requires epoxy module!
1> [CMake] 
1> [CMake] 
1> [CMake] -- Configuring incomplete, errors occurred!
1> [CMake] See also "E:/Projects/Fiverr/jek0jak21/mgba/out/build/x64-Debug/CMakeFiles/CMakeOutput.log".
1> [CMake] See also "E:/Projects/Fiverr/jek0jak21/mgba/out/build/x64-Debug/CMakeFiles/CMakeError.log".
1> 'C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="E:\Projects\Fiverr\jek0jak21\mgba\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe"  -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" -DCMAKE_TOOLCHAIN_FILE="E:/Programs/vcpkg/vcpkg-master/scripts/buildsystems/vcpkg.cmake" "E:\Projects\Fiverr\jek0jak21\mgba" 2>&1"' execution failed with error: ''C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="E:\Projects\Fiverr\jek0jak21\mgba\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe"  -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" -DCMAKE_TOOLCHAIN_FILE="E:/Programs/vcpkg/vcpkg-master/scripts/buildsystems/vcpkg.cmake" "E:\Projects\Fiverr\jek0jak21\mgba" 2>&1"' returned with exit code: 1'.

jwalway avatar Jul 12 '22 23:07 jwalway

Make sure to run vcpkg integrate install: https://vcpkg.io/en/docs/users/buildsystems/msbuild-integration.html

endrift avatar Jul 14 '22 00:07 endrift

Make sure to run vcpkg integrate install: https://vcpkg.io/en/docs/users/buildsystems/msbuild-integration.html

Thanks. I did this, but it didn't change the results. I assume the big problem is it not being able to find the epoxy module?

jwalway avatar Jul 14 '22 11:07 jwalway

I've been studying CMake in an attempt to figure out how to fix this problem, but as yet I've not discovered the answer. There is a function in CMake called "find_feature()". As you can see by the output in my first post above, that's where it is failing. I tried to find a CMake function called "find_feature()", but I have not been able to.

Anyway, I'd be grateful if anyone has the answer to this. I'm still studying it.

Thanks! ...John

jwalway avatar Jul 16 '22 17:07 jwalway

It sounds like the root issue is just that Visual Studio can't find vcpkg. Take a look at this article too: https://vcpkg.io/en/docs/users/buildsystems/cmake-integration.html#visual-studio

endrift avatar Jul 19 '22 02:07 endrift

It sounds like the root issue is just that Visual Studio can't find vcpkg. Take a look at this article too: https://vcpkg.io/en/docs/users/buildsystems/cmake-integration.html#visual-studio

Thanks for your reply. I turned out that Visual Studio defaulted to a 64-bit configuration for CMake. So, I had to figure out how to change it to 32-bit. I ended up going through a long tortured path to figure out how you create projects with CMake through Visual Studio. I learned that they have a filed named CMakeSettings.json. I had to then figure out how to change the settings to a 32-bit build (since all of the libraries downloaded were 32 bit). However, along the way I learned that there is a new system that uses a CMakePresets.json file. I played with this for a while, and after some headaches there decided to go back to CMakeSettings.json to try and get to the end point faster.

Well, I got there and it compiled!!

However, when I load a game into the emulator it freezes.

jwalway avatar Jul 20 '22 01:07 jwalway

What's the audio driver set to? You're not the first person to report this problem.

endrift avatar Jul 20 '22 02:07 endrift

What's the audio driver set to? You're not the first person to report this problem.

I downloaded binary for the emulator and it works great, so it's something with my build. Unless you are referring to a setting within the emulator?

I'm going to try again tomorrow. I downloaded the zip file to build. Tomorrow I'll clone from github.

jwalway avatar Jul 20 '22 04:07 jwalway

I do mean a setting in the emulator itself, yes.

endrift avatar Jul 20 '22 04:07 endrift

I do mean a setting in the emulator itself, yes.

Thanks! I'll look at that tomorrow.

jwalway avatar Jul 20 '22 04:07 jwalway

I do mean a setting in the emulator itself, yes.

Hello, I have the audio driver set to SDL.

jwalway avatar Jul 20 '22 20:07 jwalway

I did try the Qt Multimedia... It didn't work either. It took a little longer to freeze. The executable download works fine with SDL and OpenGL. So, I'm going to try a rebuild and see if there is something I can do there.

jwalway avatar Jul 20 '22 21:07 jwalway

Update... I cloned the project and built it again. I don't think I did anything different that I could see. However, I was able to load the game (Pokemon) and run it.

It did want the SDL2.dll (as did the other one I built). This time I also included the SDL2.pdb file, since this is a debug build. Maybe that's why this one worked better.

It felt a little touchy and the noise was garbled, so it feels like something is still amiss.

CMake doesn't build a Visual Studio.sln project file, as well. So, this way of building within VS is new to me.

jwalway avatar Jul 20 '22 23:07 jwalway

I have the same issue as @jwalway mentioned above. Until now, I can not build it successfully. Cmake outputs "Windows requires epoxy module!" although I installed libepoxy before (vcpkg install libepoxy:x64-windows) @endrift Did you build successfully mGBA on VS 2019 before?

uocnx avatar Aug 11 '22 02:08 uocnx

I have the same issue as @jwalway mentioned above. Until now, I can not build it successfully. Cmake outputs "Windows requires epoxy module!" although I installed libepoxy before (vcpkg install libepoxy:x64-windows) @endrift Did you build successfully mGBA on VS 2019 before?

Please take a look at the solution for that I already posted here: https://github.com/mgba-emu/mgba/issues/2591#issuecomment-1188511836

endrift avatar Aug 11 '22 02:08 endrift

@endrift, Thank you for your support. I built successfully on VS 2019 but I can not debug. I get an error as follows: image Do you have an idea for this issue? Thank you.

uocnx avatar Aug 11 '22 09:08 uocnx

Never seen that before. I have some testing I need to do soon, I'll be updating this thread as I do that.

endrift avatar Aug 11 '22 09:08 endrift

@endrift, I have fixed it as: https://stackoverflow.com/questions/55175387/unable-to-start-program-access-is-denied#:~:text=It%20is%20because%20you%20didn,This%20will%20solve%20your%20problem. Thank you.

uocnx avatar Aug 11 '22 09:08 uocnx

@endrift, I am now debugging mgba.exe with mgba.dll library in visual studio 2019. However, I can only debug mgba-qt project and can not debug through mgba.dll which includes .c files to see something more deeply (breakpoints I set on .c file never hit). I also check some guides on internet but I have not found any solution. Can you help me now? Thank you so much.

uocnx avatar Aug 17 '22 03:08 uocnx